1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Commit Graph

140214 Commits

Author SHA1 Message Date
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
Ilija Tovilo
b14469b36f Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix mysql mysql_native_password error on CircleCI
2025-01-27 17:14:12 +01:00
Ilija Tovilo
199e42644a Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix mysql mysql_native_password error on CircleCI
2025-01-27 17:13:41 +01:00
Ilija Tovilo
1a4810a23d Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix mysql mysql_native_password error on CircleCI
2025-01-27 17:13:30 +01:00
Ilija Tovilo
ad8ba85903 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix mysql mysql_native_password error on CircleCI
2025-01-27 17:13:20 +01:00
Ilija Tovilo
c99fb05929 Fix mysql mysql_native_password error on CircleCI
This is already fixed in higher branches. We'll need to fix this
properly when upgrading to MySQL 8.4, which we should do soon as 8.3 is
already EOL.

Closes GH-17560
2025-01-27 17:11:29 +01:00
Tim Düsterhus
47fc970e03 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix `#[\Deprecated]` for `__call()` and `__callStatic()` (#17592)
2025-01-27 13:41:50 +01:00
Tim Düsterhus
f37b165403 Fix #[\Deprecated] for __call() and __callStatic() (#17592)
* Fix `#[\Deprecated]` for `__call()` and `__callStatic()`

Fixes php/php-src#17597.

* Do not duplicate the `attributes` table in `zend_get_call_trampoline_func()`
2025-01-27 13:41:41 +01: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
Christoph M. Becker
ab996934eb Drop misleading comments about undefined behavior (GH-17532)
There is no undefined behavior here.  If `BitScan*()` returns zero, the
value written to the first parameter is undefined, but we return a
reasonable value.
2025-01-26 22:50:52 +01: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
63b6e905fa [skip ci] NEW/UPGRADING 2025-01-26 18:35:57 +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
Christoph M. Becker
bd23d3ab6b Remove unused variable (GH-17573) 2025-01-26 17:19:40 +01: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
75d7684e9f Remove useless compiler options (GH-17553)
* `/Fp` provides a path name for procompiled headers[1], but we don't use
  these.
* `/FR` is used to generate .sbr files; these have been important long
  ago for Visual Studio support, but as of Visual Studio 2008 the IDE
  no longer uses .sbr files.
* `/LD` is used to inform the *compiler* that it should build a DLL[3];
  however, we build all DLLs with the *linker*.

[1] <https://learn.microsoft.com/en-us/cpp/build/reference/fp-name-dot-pch-file>
[2] <https://learn.microsoft.com/en-us/cpp/build/reference/fr-fr-create-dot-sbr-file>
[3] <https://learn.microsoft.com/en-us/cpp/build/reference/md-mt-ld-use-run-time-library>
2025-01-25 19:59:12 +01: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
Christoph M. Becker
f2954bfb79 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix NULL arithmetic in System V shared memory emulation
2025-01-25 18:59:26 +01:00
Christoph M. Becker
5c066e04b2 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix NULL arithmetic in System V shared memory emulation
2025-01-25 18:59:00 +01:00
Christoph M. Becker
2e02cdfb5f Fix NULL arithmetic in System V shared memory emulation
For the first child process execution, `TWG(shm)` is `NULL`; we need to
catch that to avoid undefined behavior.

Closes GH-17550.
2025-01-25 18:57:30 +01:00
Christoph M. Becker
fa1af48c83 Merge branch 'PHP-8.4'
* PHP-8.4:
  Use preinstalled MySQL for Windows CI
2025-01-25 17:43:17 +01:00
Christoph M. Becker
be11d97ec7 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Use preinstalled MySQL for Windows CI
2025-01-25 17:42:37 +01:00
Christoph M. Becker
3a52aba20c Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Use preinstalled MySQL for Windows CI
2025-01-25 17:41:33 +01:00
Christoph M. Becker
2692b483db Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Use preinstalled MySQL for Windows CI
2025-01-25 17:40:48 +01:00
Christoph M. Becker
a403b76e88 Use preinstalled MySQL for Windows CI
Recent hosted GH Windows runners already have MySQL preinstalled, so
there is no particular need to install it again via Chocolatey or other
means.

If we ever need to address more specific needs, we may want to have a
look at <https://github.com/ankane/setup-mysql>.

Closes GH-17561.
Closes GH-17570.
2025-01-25 17:40:00 +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
88bab6e591 Merge branch 'PHP-8.4'
* PHP-8.4:
  [ci skip] NEWS for GH-17122
2025-01-24 23:31:24 +01:00
Niels Dossche
27187bd1da [ci skip] NEWS for GH-17122 2025-01-24 23:31:11 +01: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
Gina Peter Banyard
e6d917e4c9 Add NEWS entries
Closes GH-17539
2025-01-24 20:16:12 +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