Commit Graph

15257 Commits

Author SHA1 Message Date
Bob Weinand
6d6cd29909 Merge branch 'PHP-8.2' of https://github.com/php/php-src into PHP-8.3 2024-03-18 19:04:12 +01:00
Bob Weinand
10d912d6e3
Fix GH-13712: Segmentation fault for enabled observers when calling trait method of internal trait when opcache is loaded (#13735)
Inherited methods regardless of source must share the original runtime cache. Traits were missed.
This adds ZEND_ACC_TRAIT_CLONE to internal functions as well to allow easy distinction of these.
2024-03-18 19:02:42 +01:00
Peter Kokot
f66696548b
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-12019: ext/gd/config.m4: don't forget GDLIB_CFLAGS in feature tests
2024-03-18 11:58:56 +01:00
Michael Orlitzky
00799320ec
Fix GH-12019: ext/gd/config.m4: don't forget GDLIB_CFLAGS in feature tests
In commit 85e5635a, a feature test for the various libgd image formats
was added. That test however erroneously omits the GDLIB_CFLAGS (from
pkg-config) during compilation. This can lead to build failures and
therefore false negatives from the test.

Here, we add $GDLIB_CFLAGS to $CFLAGS for the duration of the test.

Closes GH-12019
2024-03-18 11:57:20 +01:00
David Carlier
868257a3de Fix GH-13727: macro generating invalid call test prototypes fixes.
autoconf/libtool generating code to test features missed `void` for
C calls prototypes w/o arguments.
Note that specific changes related to libtool have to be upstreamed.

Co-authored-by: Peter Kokot <petk@php.net>

close GH-13732
2024-03-18 06:53:39 +00:00
Niels Dossche
dab5f8c15c Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-13685: Unexpected null pointer in zend_string.h
2024-03-17 18:38:36 +01:00
Niels Dossche
aa34e0acb4 Fix GH-13685: Unexpected null pointer in zend_string.h
Regressed in 6fbf81c.

There is a missing error check on spl_filesystem_file_read_line(), which
means that if the line could not be read (e.g. because we're at the end
of the file), it will not set intern->u.file.current_line, which will
cause a NULL pointer deref later on.

Fix it by adding a check, and reintroducing the silent flag partially to
be able to throw an exception like it did in the past.

Closes GH-13692.
2024-03-17 18:37:52 +01:00
Niels Dossche
0f79c22627 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix potential memory leak in XPath evaluation results
2024-03-14 21:11:19 +01:00
Niels Dossche
30c58aba0c Fix potential memory leak in XPath evaluation results 2024-03-14 21:08:25 +01:00
Tim Düsterhus
0d0375ab91
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  random: Initialize the `mode` field when seeding in `php_random_default_status()` (#13690)
2024-03-13 20:14:42 +01:00
Tim Düsterhus
f34721cabd
random: Initialize the mode field when seeding in php_random_default_status() (#13690)
This is not just an issue due to missing initialization since moving the state
struct directly into the module globals. In earlier versions changing the mode
to `MT_RAND_PHP` within a single request would also affect the mode for
subsequent requests.

Original commit message follows:

This is a follow-up fix for GH-13579. The issue was detected in the nightly
MSAN build.

(cherry picked from commit bf0abd1629)
2024-03-13 20:13:48 +01:00
Niels Dossche
b58dc6fd1a Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-13680: Segfault with session_decode and compilation error
2024-03-13 17:49:31 +01:00
Niels Dossche
6985aff7c3 Fix GH-13680: Segfault with session_decode and compilation error
It's illegal to return from a bailout because that doesn't restore the
original bailout data. Return outside of it.

Test by YuanchengJiang

Closes GH-13689.
2024-03-13 17:47:25 +01:00
Arnaud Le Blanc
1b5d9f657b [ci skip] NEWS 2024-03-11 15:14:28 +01:00
Arnaud Le Blanc
809446d3d1 [ci skip] NEWS 2024-03-11 15:13:03 +01:00
Niels Dossche
134464e451 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Add ZPP checks in DOMNode::{__sleep,__wakeup}
2024-03-09 23:20:16 +01:00
Niels Dossche
e3711af8ce Add ZPP checks in DOMNode::{__sleep,__wakeup}
Closes GH-13651.
2024-03-09 23:19:49 +01:00
Jakub Zelenka
4612bb77fb
Merge branch 'PHP-8.2' into PHP-8.3 2024-03-09 19:59:06 +00:00
divinity76
2343791aff
Fix GH-13203: file_put_contents fail on strings over 4GB on Windows
Closes GH-13205
2024-03-09 19:58:28 +00:00
Jakub Zelenka
a19267d488
Fix GH-11086: FPM: config test runs twice in daemonised mode
The previous check for STDERR did not work so this fixes it.

Closes GH-13357
2024-03-09 09:41:59 +00:00
Niels Dossche
3fba242124 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  [ci skip] NEWS
  Fix GH-13612: Corrupted memory in destructor with weak references
2024-03-08 18:27:10 +01:00
Niels Dossche
608ef99a65 [ci skip] NEWS 2024-03-08 18:26:36 +01:00
Niels Dossche
39b8d5c871 Fix GH-13612: Corrupted memory in destructor with weak references
Inside `zend_object_std_dtor` the weakrefs are notified after the destruction
of properties already took place. In this test case, the destructor of an anon
class will be invoked due to the property destruction. That class has a
weak reference to its parent. This means that the destructor can access
parent properties that already have been destroyed, resulting in a UAF.
Fix this by notifying the weakrefs at the start of the object's
destruction.

Closes GH-13613.
2024-03-08 18:26:17 +01:00
David Carlier
e3f0d03452 Fix GH-13603 ext/sockets: properly initialised address info data.
Led to random characters visible on socket id on macOs.

Close GH-13606
2024-03-06 11:37:48 +00:00
Arnaud Le Blanc
e220e84b36 [ci skip] 2024-03-05 12:19:59 +01:00
David Carlier
eef44d2291 Merge branch 'PHP-8.2' into PHP-8.3 2024-03-04 15:35:21 +00:00
David Carlier
9999a0cb75 ext/gettext: dcgettext/dcngettext sigabrt on macOs.
the man page states `the locale facet is determined by the category argument,  which  should  be
 one of the LC_xxx constants defined in the <locale.h> header, excluding LC_ALL`,
since the 0.22.5 release, sanity checks had been strenghtened leading to
an abort with the Zend/tests/arginfo_zpp_mismatch.phpt test setting the
category to 0 which is LC_ALL on macOs.

close GH-13555
2024-03-04 15:34:59 +00:00
Saki Takamachi
72779e6d64
NEWS 2024-03-04 21:53:48 +09:00
Saki Takamachi
29a39eb782
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:51:02 +09:00
Saki Takamachi
6bcce681ef
[skip ci] Fixed NEWS 2024-03-04 21:50:37 +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
abfe5ffded
[ci skip] Fix version for GH-13544 in NEWS
Apparently PHP 8.2.17 was branched off after creating the PR and before merging
it, placing the NEWS in the wrong location.
2024-02-29 18:21:03 +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
Jakub Zelenka
47dca339a4
PHP-8.3 is now for PHP-8.3.5-dev 2024-02-28 11:46:49 +00: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
Sergey Panteleev
e1a8ebd61b
PHP-8.2 is now for PHP 8.2.18-dev 2024-02-27 17:26:44 +03: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