Commit Graph

65256 Commits

Author SHA1 Message Date
Saki Takamachi
7466f9c99c
Fixed handshake response charset. (#13470)
The character set ID included in the handshake data at the time of connection
actually only includes the lower 8 bits of the ID, so if  try to use this to specify
a character set, the corresponding character set may not exist.

In case of an invalid character set, the default character set is now used
without an error.

Fixes #13452
Closes #13470
2024-03-04 21:53:48 +09:00
Saki Takamachi
04eeaa0bc7
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Added validation of `\n` in $additional_headers of mail()
2024-03-04 21:30:27 +09:00
Saki Takamachi
04e8e55f47
Added validation of \n in $additional_headers of mail()
When $additional_headers of mail() is an array, the same validation as
`\r\n` is now applied to `\n` alone too.
2024-03-04 21:30:07 +09:00
Niels Dossche
dfd37c7175 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-11808: Live filesystem modified by tests (security)
2024-03-01 18:46:30 +01:00
Niels Dossche
7c8a3e426e Fix GH-11808: Live filesystem modified by tests (security)
There's a test that tries to make /etc world-writable, and asserts that
it fails. Although this test is guarded by a root user check, there are
situations where you don't need to be root to be able to do this.
This may thus have unwanted effects on your live filesystem.

The simple solution is to remove that part of the test. It doesn't
really add value anyway: we're trying to test the chmod error path, but
that exact same error path can be reached with any failure condition
that the kernel gives. For example, trying to chmod a non-existent file
will trigger the same code path.

While at it, also prefix the test path for the non-existent file such
that we don't accidentally modify the filesystem.

The chroot now has a better root-user check, that will not modify the
filesystem.

Other root-modifying mkdir tests were removed because they added no
value either.

Closes GH-13566.
2024-03-01 18:45:54 +01:00
Tim Düsterhus
e6c0b09e88
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  random: Fix unknown `mt_srand()` compatibility for unknown modes (#13544)
  Removed `REPORT_EXIT_STATUS=no` in libmysql tests
  Revert "Fix GH-13519: PGSQL_CONNECT_FORCE_RENEW with persistent connections." (#13546)
2024-02-29 18:10:39 +01:00
Tim Düsterhus
e059498c04
random: Fix unknown mt_srand() compatibility for unknown modes (#13544)
PHP 8.1 and below interpreted unknown modes as `MT_RAND_MT19937`, but PHP 8.2+
interprets them as `MT_RAND_PHP`.

Align the behavior with PHP 8.1 and below, because folks should be steered
towards the standard mode.
2024-02-29 18:05:59 +01:00
Saki Takamachi
116166cd30
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Removed `REPORT_EXIT_STATUS=no` in libmysql tests
2024-02-29 08:49:04 +09:00
Saki Takamachi
99688dbe7a
Removed REPORT_EXIT_STATUS=no in libmysql tests 2024-02-29 08:41:36 +09:00
Jakub Zelenka
0306983fa4
Merge branch 'PHP-8.2' into PHP-8.3 2024-02-27 23:03:52 +00:00
Jakub Zelenka
330b26e04c
Revert "Fix GH-13519: PGSQL_CONNECT_FORCE_RENEW with persistent connections."
This reverts commit b9a9790be0.
2024-02-27 23:03:28 +00:00
Niels Dossche
0285395126 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-13531: Unable to resize SplfixedArray after being unserialized in PHP 8.2.15
2024-02-27 23:05:26 +01:00
Niels Dossche
8494058a1f Fix GH-13531: Unable to resize SplfixedArray after being unserialized in PHP 8.2.15
When unserializing, the cached_resize field was not reset to -1
correctly, causing the setSize() method to think we were inside of a
resize operation.

Closes GH-13543.
2024-02-27 23:04:23 +01:00
Niels Dossche
8bb2a15d01 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-13517: Multiple test failures when building with --with-expat
2024-02-27 21:49:39 +01:00
Niels Dossche
552ea62e1f Fix GH-13517: Multiple test failures when building with --with-expat
The reflection failure is because the XML extension is used to check the
module dependency information, but that extension can be configured to
not depend on ext/libxml, resulting in a different output. The solution
is to check another extension instead.

The test failures in ext/xml/tests are because of different behaviour
between libxml2 and Expat error handling. These are expected differences
and the solution is to split the tests.

Closes GH-13522.
2024-02-27 21:49:01 +01:00
Gina Peter Banyard
ddebe469e1
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  ext/pdo: Fix various PDORow bugs
2024-02-27 15:31:48 +00:00
Gina Peter Banyard
b4e272c56a
ext/pdo: Fix various PDORow bugs
- Add tests
- NULL derefencing in read_dimension handler
- Fix isset()
- Fix empty() with column numbers as offsets
- Refactoring to use common functions
2024-02-27 15:30:23 +00:00
David Carlier
12f52365a5 Merge branch 'PHP-8.2' into PHP-8.3 2024-02-27 00:31:05 +00:00
David Carlier
b9a9790be0 Fix GH-13519: PGSQL_CONNECT_FORCE_RENEW with persistent connections.
persistent connections did not take in account this flag, after the
usual link sanity checks, we remove its entry.

Close GH-13519
2024-02-27 00:30:48 +00:00
Niels Dossche
c5a63a90fa Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix reference access in dimensions for DOMNodeList and DOMNodeMap
2024-02-26 19:44:39 +01:00
Niels Dossche
b8a1041fd2 Fix reference access in dimensions for DOMNodeList and DOMNodeMap
Closes GH-13511.
2024-02-26 19:42:54 +01:00
Peter Kokot
d20f82669d Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix detection of image formats in system gd library
2024-02-26 14:00:08 +01:00
Michael Orlitzky
f732ab8b3e Fix detection of image formats in system gd library
- Use gdFontCacheShutdown() to detect freetype
  Currently we look for gdImageStringFT() to determine whether or not gd
  has freetype support... but that function always exists. This leads
  PHP to believe that gd has freetype support when it does not, and can
  lead to build failures.

  The gdFontCacheShutdown() function, on the other hand, is only present
  when gd was built with freetype support. Let's use that instead.

- Fix GD image format detection
  We currently check for, say, AVIF support by attempting to link a
  program that calls libgd's gdImageCreateFromAvif() function. But
  perversely, that function always exists in libgd; moreover when AVIF
  support is missing it emits a warning and returns normally. Thus
  our straightforward link test becomes not so straightforward.

  This commit adds a new macro PHP_GD_CHECK_FORMAT that compiles, links,
  and runs a test program instead. The test program overrides that "emit
  a warning" handler so that the program actually fails if the format
  we're looking for is not supported. This fixes detection of AVIF and
  the other formats we check for in an external libgd.

- ext/gd/tests/bug77391.phpt: skip if gd lacks BMP support
  I don't actually know how to remove BMP support from libgd, but PHP
  has a ./configure test for it, so we should probably treat it as
  optional.

Closes GH-12019
2024-02-26 13:59:21 +01:00
Matteo Beccati
5373f5dd9d Fix test on non-UTC environments 2024-02-19 15:18:48 +01:00
Dmitry Stogov
00259952e4 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Prevent recording traces started from usupported VM instruction
2024-02-19 13:23:05 +03:00
Dmitry Stogov
728b81d92e Prevent recording traces started from usupported VM instruction 2024-02-19 13:22:30 +03:00
Ilija Tovilo
f057d2b138
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Disable JIT on Apple Silicon + ZTS
2024-02-18 00:08:42 +01:00
Ilija Tovilo
6db95512b4
Disable JIT on Apple Silicon + ZTS
Apple Silicon has stricter rules about rwx mmap regions. They need to be created
using the MAP_JIT flag. However, the MAP_JIT seems to be incompatible with
MAP_SHARED. ZTS requires MAP_SHARED so that some threads may execute code from a
page while another writes/appends to it. We did not find another solution, other
than completely disabling JIT for Apple Silicon + ZTS.

See discussion in https://github.com/php/php-src/pull/13351.

Co-authored-by: Peter Kokot <peterkokot@gmail.com>
Fixes GH-13400
Closes GH-13396
2024-02-18 00:07:46 +01:00
Niels Dossche
e71b597f4d Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-13344: finfo::buffer(): Failed identify data 0:(null)
2024-02-13 21:15:37 +01:00
Niels Dossche
c2b671cb1b Fix GH-13344: finfo::buffer(): Failed identify data 0:(null)
Credits to ranvis for finding the upstream commit that fixes the issue.

This backports 029b82459e

Closes GH-13370.
2024-02-13 21:13:43 +01:00
Dmitry Stogov
667b08c953 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix TLS access in JIT with MUSL (#13329)
2024-02-12 08:14:08 +03:00
Dmitry Stogov
94ba883e19
Fix TLS access in JIT with MUSL (#13329) 2024-02-12 08:13:23 +03:00
Niels Dossche
ca60912c8f Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fixed not to set CR_MALFORMED_PACKET to error if CR_SERVER_GONE_ERROR is already set
2024-02-10 14:05:19 +01:00
Saki Takamachi
199e48b567 Fixed not to set CR_MALFORMED_PACKET to error if CR_SERVER_GONE_ERROR is already set
Closes GH-11951.
2024-02-10 14:04:49 +01:00
David Carlier
a9c01b92b2 Merge branch 'PHP-8.2' into PHP-8.3 2024-02-08 22:42:19 +00:00
George Barbarosie
452e008f4f Fix GH-13354: ext/pgsql: pg_execute, pg_send_query_params and_send_execute null value by reference.
For these, when passing null values by refence, queries return erroneous values unlike
pg_query_params behaving as expected.

close GH-13355.
2024-02-08 22:42:04 +00:00
Niels Dossche
ab508c98b3 Fix unlikely memory leak in case of namespace removal with extremely deep trees 2024-02-05 22:49:15 +01:00
Jakub Zelenka
ae44ab47a7
Merge branch 'PHP-8.2' into PHP-8.3 2024-02-04 12:00:36 +00:00
Jakub Zelenka
bc30ae4f04
Fix bug #75712: getenv in php-fpm should not read $_ENV, $_SERVER
Closes GH-13195
2024-02-04 11:58:18 +00:00
David Carlier
e32821258e Merge branch 'PHP-8.2' into PHP-8.3 2024-02-03 13:22:58 +00:00
David Carlier
b06d6dba4f Forgotten piece of GH-13309/GH-13310 previous PR 2024-02-03 13:22:45 +00:00
David Carlier
6842d3c03a Merge branch 'PHP-8.2' into PHP-8.3 2024-02-03 13:07:51 +00:00
David Carlier
d91224cd2f Fix GH-13309 and GH-13310: array hashes comparison, wrong buffer len calculation.
php_array_key_compare_string_case_unstable_i has a typo for the second
operand resulting in a wrong buffer size calculation.

Issue reported by @AlexRudyuk

Close GH-13315
2024-02-03 13:07:15 +00:00
Derick Rethans
0dea244999 Updated to version 2024.1 (2024a) 2024-02-02 10:23:35 +00:00
Derick Rethans
7d5a96614c Updated to version 2024.1 (2024a) 2024-02-02 10:23:33 +00:00
Niels Dossche
7e3a6a1b42 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  ext/curl: Fix failing tests due to string changes in libcurl 8.6.0
2024-01-31 21:58:59 +01:00
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]: https://github.com/curl/curl/commit/45cf4755e71f#diff-a8a54563608f8155973318f4ddb61d7328dab512b8ff2b5cc48cc76979d4204cL1683

Closes GH-13293.
2024-01-31 21:58:27 +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
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