Commit graph

134997 commits

Author SHA1 Message Date
Ayesh Karunaratne
404803577d ext/curl: Fix failing tests due to string changes in libcurl 8.6.0
Upstream libcurl 8.6.0 contains a change[^1] that caused a test failure.
This fixes it by updating the test's `EXPECTF` to use a regex to account for both string patterns.

[^1]: 45cf4755e7 (diff-a8a54563608f8155973318f4ddb61d7328dab512b8ff2b5cc48cc76979d4204cL1683)

Closes GH-13293.
2024-01-31 21:58:27 +01:00
Dmitry Stogov
c50255c626 Update IR
IR commit: 682cc0ca6761164dbcd791e5f56283f8e88537d2

Fixes GH-13286
2024-01-31 22:20:10 +03:00
Ilija Tovilo
a135517376
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix instable array during in-place modification in uksort
2024-01-31 19:25:59 +01:00
Ilija Tovilo
d65c395049
Fix instable array during in-place modification in uksort
The array isn't just observable if the array has RCn, but also if it is inside a
reference that is RCn. By-ref parameters are always RCn and as such always
observable.

Fixes GH-13279
Closes GH-13285
2024-01-31 19:25:30 +01:00
Ayesh Karunaratne
edb9f65f16
ext/curl: Bump minimum Curl version to >= 7.61.0 (#13259)
Bumps the minimum required libcurl version to 7.61.0.

Please also see #4917, which bumped minimum libcurl version to the current >= 7.29.0.
This bumps the minimum requirement to Curl 7.61.0 (released 2018 Sept).

Ubuntu, Debian, RHEL, and RHEL derivatives have major and LTS version bumps this year. Following are the
libcurl-dev/libcurl-devel versions available in the oldest supported (LTS or otherwise) in major OSs.

 - Debian buster: [7.64](https://packages.debian.org/buster/libcurl4-openssl-dev)
 - Ubuntu 20.04: [7.68](https://packages.ubuntu.com/focal/libcurl-dev)
 - CentOS/RHEL 7: 7.29
 - RHEL 8/Rocky 8/EL 8: 7.61
 - Fedora 38: 7.87

RHEL/CentOS 7 reaches EOL mid 2024, so for PHP 8.4 scheduled towards the end of this year, we can safely
bump the minimum libcurl version.

7.61.0 was selected as the new minimum because RHEL and derivatives have libcurl-devel version 7.61. RHEL 8 is
a current and supported RHEL version.
2024-01-31 13:48:17 +00:00
Ayesh Karunaratne
e30c11f599
ext/curl: Update sync_constants.php const matching to uncover more constants (#13282)
The `sync_constants.php` file uncovers constants present in libcurl source, but\
not present in PHP ext/curl source. There is a regular expression to match
Curl constants, but to it did not previously include `CURLE_*` and `CURLINFO_*`
constants, which PHP should expose as constants.

This updates the `sync_constants.php` file's constant filter regex to expose those
constants patterns as well. The new missing constants will be added in a later PR.
2024-01-31 13:36:23 +00:00
Jakub Zelenka
01e39c0ea9
Merge branch 'PHP-8.3' 2024-01-31 10:56:47 +00:00
Peter Kokot
1a349ab209 Update PHP 8.3 minor version 2024-01-31 10:55:43 +00:00
Peter Kokot
085da2725f Merge branch 'PHP-8.3'
* PHP-8.3:
  Use EXTENSIONS instead of SKIPIF sections in *.phpt
2024-01-31 11:20:56 +01:00
Peter Kokot
8d5fc8d23f Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Use EXTENSIONS instead of SKIPIF sections in *.phpt
2024-01-31 11:20:44 +01:00
Peter Kokot
218a93b898 Use EXTENSIONS instead of SKIPIF sections in *.phpt
This also fixes skipped tests due to different naming "zend-test"
instead of "zend_test" and "PDO" instead of "pdo":

- ext/dom/tests/libxml_global_state_entity_loader_bypass.phpt
- ext/simplexml/tests/libxml_global_state_entity_loader_bypass.phpt
- ext/xmlreader/tests/libxml_global_state_entity_loader_bypass.phpt
- ext/zend_test/tests/observer_sqlite_create_function.phpt

EXTENSIONS section is used for the Windows build to load the non-static
extensions.

Closes GH-13276
2024-01-31 11:18:21 +01:00
Tim Düsterhus
f39357b07b random: Call int-seeding functions directly
As the `__construct()` implementation is engine-specific anyway, we know what
engine were dealing with and can just call the seeding function directly
instead of going through a function pointer.

This likely improves construction performance a little, but I did not measure.
2024-01-31 08:49:17 +01:00
Tim Düsterhus
304c9c3db1 random: Add explicitly named seed64() helper for xoshiro256** 2024-01-31 08:49:17 +01:00
Tim Düsterhus
79f648ace2 random: Narrow the parameter types of seed128/seed256
These internal-only functions accepted a `php_random_status`, just to extract
the internal state from the `state` pointer. Make them take the state struct
directly to improve type safety.
2024-01-31 08:49:17 +01:00
David CARLIER
453f5ab053
ext/sockets: enabling multicast group for ipv4 on freebsd. (#13240)
bug#75721 patch from jonathan@tangential.ca.

MCAST_JOIN_GROUP/MCAST_LEAVE_GROUP socket option for the RFC 3678
support does not work on freebsd, using IP_ADD_MEMBERSHIP instead.
2024-01-31 06:58:27 +00:00
Eric Mann
4a08f41bb6
Merge branch 'PHP-8.3' 2024-01-30 12:58:19 -08:00
Eric Mann
5094a636ae
PHP-8.3 is now for PHP-8.3.4-dev 2024-01-30 12:42:45 -08:00
Pierrick Charron
4567556176
Merge branch 'PHP-8.3'
* PHP-8.3:
  PHP-8.2 is now for PHP 8.2.17-dev
2024-01-30 12:48:11 -05:00
Pierrick Charron
5982cb7a45
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  PHP-8.2 is now for PHP 8.2.17-dev
2024-01-30 12:46:09 -05:00
Pierrick Charron
0454f4ade4
PHP-8.2 is now for PHP 8.2.17-dev 2024-01-30 12:43:37 -05:00
Derick Rethans
b612269720 Merge branch 'PHP-8.3' 2024-01-30 17:32:02 +00:00
Derick Rethans
7c354b7cf2 Move most of this to https://github.com/php/policies as per Policies RFC 2024-01-30 17:31:55 +00:00
Ilija Tovilo
b06311cb3d
Improve ZEND_NEW RC inference
ZEND_NEW returns RC1 if the instanciated class has no constructor.

Closes GH-13239
2024-01-30 16:31:29 +01:00
Ilija Tovilo
8d082958fe
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix create_object checks
2024-01-30 16:14:08 +01:00
Ilija Tovilo
3a5edcca47
Fix create_object checks
Since PHP 8.3, object handlers may be changed by setting
ce->default_object_handlers, rather than in ce->create_object. Some checks need
to be extended to check for the default handlers.

Closes GH-13272
2024-01-30 16:13:51 +01:00
Peter Kokot
b3bdc23656 Remove unused Makefile variables FIBER_ASSEMBLER and FIBER_ASM_ARCH
In Windows build system these were replaced with common PHP_ASSEMBLER
and FIBER_ASM_ABI when adjusting for the arm64.

Closes GH-13263
2024-01-30 09:50:22 +01:00
Dmitry Stogov
373237edb2 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-13193: Significant performance degradation in 'foreach' starting from PHP 8.2.13 (caused by garbage collection) (#13265)
2024-01-30 06:40:56 +03:00
Dmitry Stogov
49f85c24da Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-13193: Significant performance degradation in 'foreach' starting from PHP 8.2.13 (caused by garbage collection) (#13265)
2024-01-30 06:40:44 +03:00
Dmitry Stogov
397d4c244d
Fix GH-13193: Significant performance degradation in 'foreach' starting from PHP 8.2.13 (caused by garbage collection) (#13265)
* Fix GH-13193: Significant performance degradation in 'foreach' starting from PHP 8.2.13 (caused by garbage collection)

* Don't run zend_gc_remove_root_tmpvars() if GC is not active or GC buffer is empty
2024-01-30 06:38:30 +03:00
Ilija Tovilo
34e2dc5697
Improve is_instanceof inference (#13238)
When a class is final, it may be treated as !is_instanceof.
2024-01-29 12:48:55 +01:00
Peter Kokot
52dba99d47 Sync headers installation
This syncs the installed sapi and extension headers on *nix and Windows
systems by installing only what is intended outside of php-src.

- ext/gd: without gd_arginfo.h and gd_compat.h
- ext/hash: php_hash_joaat.h and php_hash_fnv.h added also on Windows
  installation; xxhash/xxhash.h added on both installations as it is
  included in php_hash_xxhash.h; Include path for xxhash.h changed to
  relative so the php_hash_xxhash.h can be included outside of php-src;
  Redundant include flags removed
- ext/iconv: without iconv_arginfo.h
- ext/mysqli: mysqli_mysqlnd.h was missing on Windows
- ext/phar: php_phar.h was missing on Windows
- ext/sodium: php_libsodium.h was missing on *nix
- ext/xml: without xml_arginfo.h
- sapi/cli: cli.h was missing on Windows

Closes GH-13210
Closes GH-13213
2024-01-28 19:50:55 +01:00
Alex Dowad
c1c106e5a2 Merge branch 'PHP-8.3'
* PHP-8.3:
  Retroactively add NEWS entry for ec348a12
2024-01-28 20:40:32 +02:00
Alex Dowad
d978ade0a9 Retroactively add NEWS entry for ec348a12
Thanks to Kalle Sommer Nielsen for suggesting that the change in
ec348a12 should have been called out in NEWS.
2024-01-28 20:39:23 +02:00
Niels Dossche
b06fedb41d Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-10614: imagerotate will turn the picture all black, when rotated 90
2024-01-26 18:16:29 +01:00
Niels Dossche
b76ef301a0 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-10614: imagerotate will turn the picture all black, when rotated 90
2024-01-26 18:16:21 +01:00
Niels Dossche
f26dd1354b Fix GH-10614: imagerotate will turn the picture all black, when rotated 90
This is a backport of the upstream libgd PR that was recently committed
[1].

[1] https://github.com/libgd/libgd/pull/862

Closes GH-13246.
2024-01-26 18:15:52 +01:00
Dmitry Stogov
765382eeea Update IR
IR commit: 2ea3215ebd15a1fa332b8b6118df2bc51a60d81c

Fixes two recently introduced bugs caught by PHP nightly workwlow
2088438753
2024-01-26 07:32:34 +03:00
Dmitry Stogov
90bab1e732 Update IR
IR commit: 87bf12844ea0e36151b3a172dce28b55b5ae1503

Fixes ext/opcache/tests/jit/bug81225_2.phpt failure
2024-01-25 23:31:55 +03:00
Dmitry Stogov
136a972ccb Update IR
IR commit: 0108cdf808d1e7dd6b702738949e095151f49040
2024-01-25 22:50:30 +03:00
Niels Dossche
b8ff8c04f8 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-10344: imagettfbbox(): Could not find/open font UNC path
  Fix GH-13037: PharData incorrectly extracts zip file
2024-01-25 20:07:52 +01:00
Niels Dossche
78986a6734 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-10344: imagettfbbox(): Could not find/open font UNC path
  Fix GH-13037: PharData incorrectly extracts zip file
2024-01-25 20:07:33 +01:00
Niels Dossche
4a48729438 Fix GH-10344: imagettfbbox(): Could not find/open font UNC path
libgd uses an incorrect absolute path check in gdft.c.
It checks if either the path starts with a '/' (only valid on Posix
btw), or whether it contains something of the form C:\ or C:/.
However, this overlooks the possibility of using UNC paths on Windows.
As we already do PHP-specific stuff with VCWD_ macros, use
IS_ABSOLUTE_PATH to check for an absolute path which will take into
account UNC paths as well.

Closes GH-13241.
2024-01-25 20:06:28 +01:00
Niels Dossche
ba80372a58 Fix GH-13037: PharData incorrectly extracts zip file
The code currently assumes that the extra field length of the central
directory entry and the local entry are the same, but that's not the
case. For example, the "Extended Timestamp extra field" differs in size
for local vs central directory entries. This causes the file contents
offset to be incorrect because it is based on the central directory
length instead of the local entry length. Fix it by reading the local
entry and getting the size from there as well as checking consistency
for the file name length.

Closes GH-13045.
2024-01-25 20:05:45 +01:00
Gina Peter Banyard
a479ed7cc5
Zend: Add tests for offsets and containers (#12723)
Add various tests showcasing the behavioural variations of different offset types used on various container types in all possible operations:
 - Read
 - Write
 - Read Write
 - Appending
 - Unsetting
 - Existence checks with isset()/empty/null coalesce operator
 - Behaviour of nesting dimensions (e.g. $container[$offset1][$offset2])

Add a test to ensure compile time and runtime behaviour is identical for offsets.

Add an internal class that overloads the dimension object handlers to zend_test
2024-01-25 15:06:59 +00:00
Niels Dossche
8128d17cc2 Fix build warning in ext/mbstring 2024-01-24 19:44:17 +01:00
Niels Dossche
e2c3c48307 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-13232: Segmentation fault will be reported when JIT is off but JIT_debug is still on
2024-01-24 17:49:05 +01:00
Niels Dossche
31e8cea1d6 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-13232: Segmentation fault will be reported when JIT is off but JIT_debug is still on
2024-01-24 17:48:57 +01:00
Niels Dossche
d417072ebe Fix GH-13232: Segmentation fault will be reported when JIT is off but JIT_debug is still on
Closes GH-13234.
2024-01-24 17:47:40 +01:00
Alex Dowad
bcd4138185 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix segfault caused by use of 'pass' encoding when mbstring converts multipart form POST data
2024-01-24 18:41:36 +02:00
Alex Dowad
67051eb8ed Fix segfault caused by use of 'pass' encoding when mbstring converts multipart form POST data
When mbstring.encoding_translation=1, and PHP receives an (RFC1867)
form-based file upload, and the Content-Disposition HTTP header contains
a filename for the uploaded file, PHP will internally invoke mbstring
code to 1) try to auto-detect the text encoding of the filename, and if
that succeeds, 2) convert the filename to internal text encoding.

In such cases, the candidate text encodings which are considered during
"auto-detection" are those listed in the INI parameter
mbstring.http_input. Further, mbstring.http_input is one of the few
contexts where mbstring allows the magic string "pass" to appear in
place of an actual text encoding name.

Before mbstring's encoding auto-detection function was reimplemented,
the old implementation would never return "pass", even if "pass" was the
only candidate it was given to choose from. It is not clear if this was
intended by the original developers or not. This behavior was the result
of some rather subtle details of the implementation.

After mbstring's auto-detection function was reimplemented, if the new
implementation was given only one candidate to choose, and it was not
running in 'strict' mode, it would always return that candidate, even
if the candidate was the non-encoding "pass".

The upshot of all of this: Previously, if
mbstring.encoding_translation=1 and mbstring.http_input=pass, encoding
conversion of RFC1867 filenames would never be attempted. But after
the reimplementation, encoding 'conversion' would occur (uselessly).

Further, in December 2022, I reimplemented the relevant bit of
encoding conversion code. When doing this, I never bothered to
implement encoding/decoding routines for the non-encoding "pass",
because I thought that they would never be used. Well, in the one case
described above, those routines *would* have been used, had they
actually existed. Because they didn't exist, we get a nice NULL pointer
dereference and ensuing segfault instead.

Instead of 'fixing' this by adding encoding/decoding routines for the
non-encoding "pass", I have modified the function which the RFC1867
form-handling code invokes to auto-detect input encoding. This function
will never return "pass" now, just like the previous implementation.

Thanks to the GitHub user 'tstangner' for reporting this bug.
2024-01-24 17:15:27 +02:00