Commit graph

69347 commits

Author SHA1 Message Date
Niels Dossche
286030d532
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17609: Typo in error message: Dom\NO_DEFAULT_NS instead of Dom\HTML_NO_DEFAULT_NS
  PHP-8.4 is now for PHP 8.4.5-dev
2025-01-28 19:30:55 +01:00
Niels Dossche
359eb30351
Fix GH-17609: Typo in error message: Dom\NO_DEFAULT_NS instead of Dom\HTML_NO_DEFAULT_NS 2025-01-28 19:30:25 +01:00
Ilija Tovilo
98da67aa9a
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Another flaky macOS phar test
2025-01-28 12:59:31 +01:00
Ilija Tovilo
4d545f91bc
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [skip ci] Another flaky macOS phar test
2025-01-28 12:59:25 +01:00
Ilija Tovilo
dc06a52362
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  [skip ci] Another flaky macOS phar test
2025-01-28 12:58:55 +01:00
Ilija Tovilo
c14601cc90
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  [skip ci] Another flaky macOS phar test
2025-01-28 12:58:42 +01:00
Ilija Tovilo
d9744869e6
[skip ci] Another flaky macOS phar test 2025-01-28 12:58:30 +01:00
Ilija Tovilo
68a638d367
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix missing GC_PERSISTENT_LOCAL flag on accel_globals.key
2025-01-28 12:56:00 +01:00
Ilija Tovilo
ac42a8de75
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix missing GC_PERSISTENT_LOCAL flag on accel_globals.key
2025-01-28 12:55:55 +01:00
Ilija Tovilo
2ad778bc76
Fix missing GC_PERSISTENT_LOCAL flag on accel_globals.key 2025-01-28 12:55:09 +01:00
Ilija Tovilo
dfd8c0ca05
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Another flaky macOS phar test
2025-01-28 12:45:43 +01:00
Ilija Tovilo
c63460c92c
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [skip ci] Another flaky macOS phar test
2025-01-28 12:45:35 +01:00
Ilija Tovilo
b598dbf822
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  [skip ci] Another flaky macOS phar test
2025-01-28 12:45:17 +01:00
Ilija Tovilo
01309961bb
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  [skip ci] Another flaky macOS phar test
2025-01-28 12:45:10 +01:00
Ilija Tovilo
65b990a1e0
[skip ci] Another flaky macOS phar test 2025-01-28 12:44:24 +01:00
Christoph M. Becker
06c41ec6c5
Run curl_setopt_ssl.phpt on Windows, too (GH-16086)
The whole point of using `proc_open()` to execute `openssl s_client` is
that we can terminate the process when we're done.  However, when going
through the shell on Windows, we get a handle to the shell process, and
if we terminate that, the grandchild will stay open.  Since the pipes
of the grandchild will stay open, the PHP process will not terminate
either, so the test stalls.

We solve this by simply bypassing the shell.
2025-01-28 01:14:10 +01:00
Ilija Tovilo
3992ffa2c2
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix cve-2014-3538 test
2025-01-27 21:49:16 +01:00
Ilija Tovilo
c1b151020a
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix cve-2014-3538 test
2025-01-27 21:49:10 +01:00
Ilija Tovilo
cee3687180
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix cve-2014-3538 test
2025-01-27 21:49:03 +01:00
Ilija Tovilo
7bda7ad31d
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix cve-2014-3538 test
2025-01-27 21:48:47 +01:00
Christoph M. Becker
ef74ea08ce
Drop superfluous php_com_dotnet_object.ce (GH-17603)
* Drop superfluous php_com_dotnet_object.ce

This is readily available via the `zend_object` (i.e. `zo.ce`), so
there is no need to duplicate it.

There is also no need to assign the ce to the std object,
since this is done be `zend_object_std_init()` anyway.
2025-01-27 20:26:57 +01:00
Ilija Tovilo
d17d58a982
Fix cve-2014-3538 test
Make sure we have a unique test file to work with, and increase the time
for the nojit version to match the default version.

Closes GH-17600
2025-01-27 20:01:13 +01:00
Christoph M. Becker
efcdcd7bde
Drop NetWare support from bundled libgd (GH-17596)
This has been removed from upstream years ago[1], and PHP generally
dropped NetWare support even earlier.

[1] <e6bb110663>
[2] <https://externals.io/message/96838>
2025-01-27 20:00:34 +01:00
Ilija Tovilo
62b34412dc
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix inline zend_string using struct padding
2025-01-27 19:51:58 +01:00
Ilija Tovilo
1432a13413
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix inline zend_string using struct padding
2025-01-27 19:51:47 +01:00
Ilija Tovilo
8ea9b04a23
Fix inline zend_string using struct padding
As explained by Snape3058: On 64-bit machines, we typically have 7 bytes
of padding between the zend_string.val[0] char and the following char[].
This means that zend_string.val[1-7] write to and read from the struct
padding, which is a bad idea.

Allocate the given string separately instead.

Fixes GH-17564
Closes GH-17576
2025-01-27 19:50:38 +01:00
Niels Dossche
f926c5ce81
Fix GH-16883: gzopen() does not use the default stream context when opening HTTP URLs
Otherwise it's not possible to control the context; it's also consistent
with how the standard open functions work.

Closes GH-17589.
2025-01-27 19:25:52 +01:00
Calvin Buckley
a7df6a7759 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix crash in PDO_ODBC statement dtor (#17586)
2025-01-27 13:43:54 -04:00
Calvin Buckley
25bdbf96cf Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix crash in PDO_ODBC statement dtor (#17586)
2025-01-27 13:43:21 -04:00
Calvin Buckley
556def741c
Fix crash in PDO_ODBC statement dtor (#17586)
Port of 2ae897fff7 to PDO_ODBC.
2025-01-27 13:41:11 -04:00
Gina Peter Banyard
60ee42eb3e
Merge branch 'PHP-8.4'
* PHP-8.4:
  ext/pdo: Fix a UAF when changing default fetch class ctor args
2025-01-26 23:41:42 +00:00
Gina Peter Banyard
7f321a1313
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  ext/pdo: Fix a UAF when changing default fetch class ctor args
2025-01-26 23:37:14 +00:00
Gina Peter Banyard
3027600ffc
ext/pdo: Fix a UAF when changing default fetch class ctor args
Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
2025-01-26 23:32:35 +00:00
David Carlier
d6c6675bfe
ext/sodium: general buffer upper bounds adjustments.
For zend_string allocations, it was tested against SIZE_MAX now using
ZSTR_MAX_LEN to take in account zend_string type's metadata.

close GH-17588
2025-01-26 19:41:41 +00:00
David Carlier
f82f602ec8
ext/pgsql: few internal changes.
Z_PARAM_STR*/Z_PARAM_PATH. lo_write checks any null byte.

close GH-17587
2025-01-26 19:15:36 +00:00
David Carlier
71c19e2921
ext/snmp: internals calls renaming 2025-01-26 18:35:05 +00:00
David Carlier
81458f5dcf
ext/snmp: various internals rewrite.
close GH-17368
2025-01-26 18:27:53 +00:00
Niels Dossche
613c5e626e
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17572: getElementsByTagName returns collections with tagName-based indexing, causing loss of elements when converted to arrays
2025-01-26 16:22:04 +01:00
Niels Dossche
fc7c353519
Fix GH-17572: getElementsByTagName returns collections with tagName-based indexing, causing loss of elements when converted to arrays
Only (dtd) named node maps should have string-based indexing.
The ce check is fragile, just check for the presence of an xml hash
table.

Closes GH-17580.
2025-01-26 16:21:54 +01:00
Gina Peter Banyard
37cd00e170 ext/pdo: Add a test with a fetchAll() call being interupted partways 2025-01-26 13:31:16 +00:00
Gina Peter Banyard
8a81d005e5 ext/pdo: Add a test creating instances of Directory
This should not be possible, other opaque classes cannot be instantiated in practice as they do not have properties and prevent dynamic properties
2025-01-26 13:31:16 +00:00
Christoph M. Becker
5890761ef9
Overhaul GD test helpers and affected tests (GH-17309)
* Use type declarations instead of doc-block annotations

* Inline the terrible get_rgb() function

* Always traverse pixels in Z order

libgd stores the pixel as an array of rows, so we should use row-major-
order traversal to improve caching.

* Add assertions to avoid misuse of the functions

The assertion regarding the image dimensions won't break any tests, and
we had it already as a comment.

However, asserting that the images are truecolor images is important
for `calc_image_dissimilarity()` which otherwise would calculate
nonsense, and not unreasonable for `test_image_equals_image()` which
otherwise is overspecified (for our purposes, it doesn't matter which
palette entry a pixel refers to, but rather whether the actual colors
referred by a palette color match).

Since the truecolor assertions break two tests, we fix these by
converting to truecolor.  That should likely be backported to lower
branches.

* Drop implicit conversion to truecolor

Conversion to truecolor is a relatively expensive operation, and as
such should not be implicit; instead test authors are encouraged to use
truecolor images in the first place where possible, or to even find
better ways to verify expectations than doing a full image comparison.

* Merge similarity.inc into func.inc

There is no particular reason to have a separate file for similarity
comparisons.

* Simplify bug43475.phpt and bug64641.phpt

`calc_image_dissimilarity()` calculates the sum of the euclidean
distance of the RGB channels of all pixels.  The euclidean distance is
either zero or greater than or equal to one (but never in ]0, 1[).  The
sum of these values also has this property, so it doesn't make sense to
check for less than 1e-5.  Thus we just call `test_image_equals_file()`
instead.

* Replace calc_image_dissimilarity() with the well-known mse()

`calc_image_dissimilarity()` has the drawback that it did sum up the
pixel differences, so for large images the result could be way larger
than for small images.  It also has the drawback that it likely is not
as well understood as the mean squared error.  Thus we replace it with
the latter, and calculate the mean squared error of the individual RGB
channels (to be precise).  The result is always in range 0..255**2 what
makes reasoning about thresholds easier.
2025-01-25 19:48:38 +01:00
Christoph M. Becker
f698c62361
Fix bug 64823: ZTS GD fails to to find system TrueType font
First, the `$fontfile` parameter actually supports a semicolon
delimited list of fonts (as documented[1]); thus passing the full
string to `VCWD_REALPATH()` or `php_check_open_basedir()` makes no
sense; we could pass the individual parts, but …

Second, libgd uses an elaborate font detection.  There is a hard-
coded `DEFAULT_PATH` which can be overridden by the environment
variable `GDFONTPATH`.  Semantics are like the `PATH` environment
variable.  If `DEFAULT_PATH` was still exposed (it is no longer as of
libgd 2.1.0[2]), we could take that into account, but …

External libgd can be configured with font-config support, so font
aliases and even lookup patterns are supported.  There is no way to
cater to that upfront.

Thus, we no longer interfere with libgd's font lookup.  Checking the
realpath was already doubtful (we didn't even use the resolved path).
Lifting the open_basedir restriction is a bit more delicate, but the
manual still states that open_basedir would not apply, and more
relevant, not much harm can be done, because libgd only passes the
found font to `FT_New_Face()` which likely fails for any non font files
without any error which could reveal sensitive information.  And the
font file is never written.

It should be noted that this solves lookup of system fonts, does not
change the behavior for absolute font paths, but still does not resolve
issues with relative paths to font files in ZTS environments using
external libgd (our bundled libgd has a workaround for that).  This
particular issue cannot be solved, so users of ZTS builds still need to
add `realpath(.)` to the `GDFONTPATH` as documented in the manual (or
pass absolute paths as `$fontfile`).

[1] <https://www.php.net/imagettftext>
[2] <2a921c80fb>

Closes GH-17366.
2025-01-25 19:27:05 +01:00
Gina Peter Banyard
6fc49ab518
ext/pdo: Convert FETCH_INTO zval to a zend_object pointer (#17525) 2025-01-24 22:59:56 +00:00
Niels Dossche
f2b010f503
Merge branch 'PHP-8.4'
* PHP-8.4:
  Update test expectation for different Firebird version
2025-01-24 22:10:21 +01:00
Niels Dossche
77130794a3
Update test expectation for different Firebird version
libfbclient 5.0.1 with server 4.0.1 has a different error message and
code.
> Read only sql transaction

Closes GH-17565.
2025-01-24 22:10:08 +01:00
Gina Peter Banyard
5b06a066f6
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Add NEWS entries
  Fix crash in firebird statement dtor
  ext/pdo: Fix memory leak if GC needs to free PDO Statement
2025-01-24 20:22:13 +00:00
Gina Peter Banyard
8ed0d7fe96
Merge branch 'PHP-8.4'
* PHP-8.4:
  Add NEWS entries
  Fix crash in firebird statement dtor
  ext/pdo: Fix memory leak if GC needs to free PDO Statement
2025-01-24 20:20:11 +00:00
Gina Peter Banyard
eda8ce728a
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Add NEWS entries
  Fix crash in firebird statement dtor
  ext/pdo: Fix memory leak if GC needs to free PDO Statement
  Fix GHA config yml error
2025-01-24 20:20:01 +00:00
Niels Dossche
2ae897fff7
Fix crash in firebird statement dtor
If both the driver object and statement end up in the GC buffer and are
freed by the GC, then the destruction order is not deterministic and it
is possible that the driver object is freed before the statement. In
that case, accessing S->H will cause a UAF. As the resources are already
released we simply skip the destruction if the driver object is already
destroyed.
2025-01-24 20:16:12 +00:00