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

143925 Commits

Author SHA1 Message Date
Volker Dusch
f665c20219 Update versions for PHP 8.5.3 php-8.5.3 2026-02-10 19:25:51 +01:00
Daniel Scherzer
9338ac0743 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  GitHub actions: drop more 8.1 CI configuration (#20763)
2026-01-27 02:06:54 -08:00
Daniel Scherzer
eb102557cc Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  GitHub actions: drop more 8.1 CI configuration (#20763)
2026-01-27 02:06:20 -08:00
Daniel Scherzer
3aef16abbd Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  GitHub actions: drop more 8.1 CI configuration (#20763)
2026-01-27 02:05:28 -08:00
Daniel Scherzer
2b49403378 GitHub actions: drop more 8.1 CI configuration (#20763)
* remove `libmysqlclient_with_mysqli` support from nightly workflow
* remove `libmysqlclient_with_mysqli` support from root workflow
* remove `withMysqli` support from `build-libmysqlclient` action
* remove `withMysqli` support from `test-libmysqlclient` action
* in root workflow, drop code checking for PHP 8.1

[skip ci]
2026-01-27 02:04:47 -08:00
Niels Dossche
d2cd73a4b4 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-21041: Dom\HTMLDocument corrupts closing tags within scripts
2026-01-26 19:20:42 +01:00
Alexander Borisov
56e5a80c44 Fix GH-21041: Dom\HTMLDocument corrupts closing tags within scripts 2026-01-26 19:20:10 +01:00
Daniel Scherzer
d9ccf782a8 [8.5] NEWS: add some missing RFC entries (#20693) 2026-01-26 00:33:04 -08:00
Gina Peter Banyard
964d087227 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  ext/dba/tests/dba_db4_018.phpt: fix typo (#20938)
2026-01-24 11:39:06 +00:00
Michael Orlitzky
3053a039ff ext/dba/tests/dba_db4_018.phpt: fix typo (#20938)
We expect "objects" but print "object".

Gentoo-bug: https://bugs.gentoo.org/968656
2026-01-24 11:38:45 +00:00
Niels Dossche
2c08d9a627 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix crash in openssl_x509_parse() when X509_NAME_oneline() fails
  Fix crash when in openssl_x509_parse() when i2s_ASN1_INTEGER() fails
2026-01-23 14:59:35 +01:00
Niels Dossche
62afc7a2fa Fix crash in openssl_x509_parse() when X509_NAME_oneline() fails
The X509_NAME_oneline() function can return NULL, which will cause a
crash when the string length is computed via add_assoc_string().

Closes GH-21010.
2026-01-23 14:59:08 +01:00
Niels Dossche
c2eadb4922 Fix crash when in openssl_x509_parse() when i2s_ASN1_INTEGER() fails
The X509_NAME_oneline() function can return NULL,
which will cause a crash when the string length is computed via add_assoc_string().

Closes GH-21011.
2026-01-23 14:58:39 +01:00
Niels Dossche
7d4e430435 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix memory leaks when sk_X509_new_null() fails
2026-01-22 22:47:35 +01:00
Niels Dossche
7754eafb1f Fix memory leaks when sk_X509_new_null() fails
In a lot of places the return value is not checked, and when the
function fails the code continues execution. However, this means that
operations on the stack fail and will cause memory leaks on the objects
that weren't pushed.

We also notice an inconsistency in how these failures are handled.
For example, in one place we explicitly have a fatal error
`php_error_docref(NULL, E_ERROR, "Memory allocation failure");`
but this is the only place to do so.

Closes GH-20957.
2026-01-22 22:37:14 +01:00
Ilija Tovilo
6d02e51acb Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix hooked object properties overflow
2026-01-21 18:54:29 +01:00
Niels Dossche
d9cbc3117c Fix hooked object properties overflow
The computed number of properties using zend_hash_num_elements(zobj->properties)
is incorrect when the object contains virtual properties. We don't have a
trivial way to find the number of properties virtual properties that need to be
added to this number, so just append with zend_hash_add_new() instead.

Fixes GH-20479
Closes GH-20988
2026-01-21 18:53:41 +01:00
Ilija Tovilo
6c57b4b49a Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  [skip ci] Reduce zend.max_allowed_stack_size in gh20840.phpt
2026-01-21 17:35:49 +01:00
Ilija Tovilo
4367315183 [skip ci] Reduce zend.max_allowed_stack_size in gh20840.phpt
This test still fails on i386 Windows with "Allowed memory size of %d bytes
exhausted" because the output buffer grows too big. My first intuition was to
add a chunk_size to ob_start, but this won't work if the output buffer is
flushed deep into the call stack, causing a premature or just a second stack
limit error. So, reduce the stack size in an attempt to produce less output.
2026-01-21 17:32:01 +01:00
Ilija Tovilo
2352cc1225 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix segfault in Tracing JIT with object reference (GH-20818)
2026-01-21 00:27:15 +01:00
Chris Hasiński
1db1c7f5c1 Fix segfault in Tracing JIT with object reference (GH-20818)
When FE_RESET_RW executes, it converts the CV to a reference before
checking if the array/object is empty. However, when the JIT creates
exit points for FE_RESET_RW in zend_jit_trace_handler(), it wasn't
updating the stack type for op1 to reflect this change.

This caused side traces compiled from these exit points to have
incorrect type information. The side trace's CV cleanup code would
see IS_OBJECT and generate a direct call to zend_objects_store_del(),
but the actual value was a zend_reference*, causing a segfault.

The fix adds ZEND_FE_RESET_RW to the list of opcodes that temporarily
set their op1 stack type to IS_UNKNOWN before creating exit points.
This follows the same pattern used for ZEND_BIND_INIT_STATIC_OR_JMP.
When IS_UNKNOWN, the JIT falls back to SSA type info which correctly
includes MAY_BE_REF for FE_RESET_RW's op1_def.

Fixes GH-20818
Closes GH-20948
2026-01-21 00:24:14 +01:00
Niels Dossche
fd5e45116b Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Revert "Fix GH-20890: Segfault in zval_undefined_cv with non-simple property hook with minimal tracing JIT"
2026-01-20 21:05:50 +01:00
Niels Dossche
32c0245531 Revert "Fix GH-20890: Segfault in zval_undefined_cv with non-simple property hook with minimal tracing JIT"
This reverts commit 57c62eb2b3.
2026-01-20 21:05:26 +01:00
Niels Dossche
77c9c8c6c0 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-20890: Segfault in zval_undefined_cv with non-simple property hook with minimal tracing JIT
2026-01-20 18:55:39 +01:00
Niels Dossche
57c62eb2b3 Fix GH-20890: Segfault in zval_undefined_cv with non-simple property hook with minimal tracing JIT
This is similar to f6c2e40a11 but for minimal JIT + tracing JIT.
Most of the times the tracing JIT shouldn't rely on going to the VM, but
in some cases, like in minimal JIT, it can and then it hits the same
bug.

Closes GH-20897.
2026-01-20 18:55:08 +01:00
Ilija Tovilo
0e003a1d19 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  [skip ci] Fix missing test attribution
2026-01-20 18:01:10 +01:00
Ilija Tovilo
6a21a41b4a [skip ci] Fix missing test attribution 2026-01-20 18:00:58 +01:00
Ilija Tovilo
005242f8bd Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix lazy proxy bailing __clone assertion
2026-01-20 17:59:23 +01:00
Ilija Tovilo
f38f74521b Fix lazy proxy bailing __clone assertion
When __clone of the underlying object fails with a bailout, ZEND_ASSERT(res ==
SUCCESS) in zend_lazy_object_del_info() will fail because the info has not been
registered yet.

Only copy OBJ_EXTRA_FLAGS once the info has been successfully registered.

Fixes GH-20905
Closes GH-20975
2026-01-20 17:58:56 +01:00
Ilija Tovilo
ca9305eb2c Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix run-tests.php -s flag
2026-01-19 14:39:13 +01:00
Ilija Tovilo
ee5fc4a030 Fix run-tests.php -s flag
- Remove unnedded putenv('NO_INTERACTION=1') when executing individual tests.
- Fix undefined variable errors when executing individual tests.
- Fix -s when NO_INTERACTION=1 is set, given we don't need to prompt anyway.

Fixes GH-20961
Closes GH-20970
2026-01-19 14:38:53 +01:00
David Carlier
709c2f73aa Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  exp/pgsql: insert/update query string build possible UB fix.
2026-01-19 06:17:40 +00:00
David Carlier
5785ff7728 exp/pgsql: insert/update query string build possible UB fix.
From PQescapeIdentifier() docs

```
A terminating zero byte is not required, and should not be counted in
length
```
2026-01-19 06:17:23 +00:00
Peter Kokot
8eb63a23fc Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Use PHP 8+ square brackets for array elements
2026-01-18 17:58:54 +01:00
Peter Kokot
c4084bb8f3 Use PHP 8+ square brackets for array elements
The curly braces syntax for array elements has been removed in PHP 8.0.
2026-01-18 17:58:00 +01:00
Ilija Tovilo
ac0dc9859a Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix uaf for nested finally with repeated return type check
2026-01-16 18:38:53 +01:00
Ilija Tovilo
19b30032c9 Fix uaf for nested finally with repeated return type check
Fixes OSS-Fuzz #438780145
Closes GH-19488
2026-01-16 18:38:24 +01:00
Ilija Tovilo
da6f1230c2 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix by-ref assignment to uninitialized hooked backing value
2026-01-16 14:48:51 +01:00
Ilija Tovilo
0efecbc432 Fix by-ref assignment to uninitialized hooked backing value
Within hooks, the backing value can directly be accessed as if no hooks were
present. This was previously handled only in read_property().

zend_fetch_property_address(), which is used for by-ref assignment, will first
call get_property_ptr_ptr() and then try read_property(). However, when called
on uninitialized backing values, read_property() will return
&EG(uninitialized_zval) with an uninitialized property warning. This is
problematic for zend_fetch_property_address() because it write to the result of
read_property() unless there's an exception.

For untyped properties, this can result in writes to &EG(uninitialized_zval)
(see oss-fuzz-471486164-001.phpt). For types properties, it will result in an
unexpected "Typed property C::$prop must not be accessed before initialization"
exception.

Fixes OSS-Fuzz #471486164
Closes GH-20943
2026-01-16 14:48:05 +01:00
Ilija Tovilo
5fb8165e4e Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Avoid huge output in gh20840.phpt
2026-01-16 13:04:18 +01:00
Ilija Tovilo
462fcad419 Avoid huge output in gh20840.phpt
This can trigger the memory limit in run-tests.php, which buffers the tests
output. Instead, only output "nesting level too deep" and discard the rest.

Closes GH-20946
2026-01-16 13:03:53 +01:00
Bob Weinand
82e2055300 Regenerate VM after merge
Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
2026-01-15 17:45:26 +01:00
Bob Weinand
c878380065 Merge branch 'PHP-8.4' of github.com:php/php-src into PHP-8.5
* 'PHP-8.4' of github.com:php/php-src:
  Split the live-ranges of loop variables again (#20865)
2026-01-15 16:15:29 +01:00
Bob Weinand
27ed48c0be Split the live-ranges of loop variables again (#20865)
* Fix use-after-free in FE_FREE with GC interaction

When FE_FREE with ZEND_FREE_ON_RETURN frees the loop variable during
an early return from a foreach loop, the live range for the loop
variable was incorrectly extending past the FE_FREE to the normal
loop end. This caused GC to access the already-freed loop variable
when it ran after the RETURN opcode, resulting in use-after-free.

Fix by splitting the ZEND_LIVE_LOOP range when an FE_FREE with
ZEND_FREE_ON_RETURN is encountered:
- One range covers the early return path up to the FE_FREE
- A separate range covers the normal loop end FE_FREE
- Multiple early returns create multiple separate ranges

* Split the live-ranges of loop variables again

b0af9ac733 removed the live-range splitting of foreach variables, however it only added handling to ZEND_HANDLE_EXCEPTION.
This was sort-of elegant, until it was realized in 8258b7731b that it would leak the return variable, requiring some more special handling.
At some point we added live tmpvar rooting in 52cf7ab8a2, but this did not take into account already freed loop variables, which also might happen during ZEND_RETURN, which cannot be trivially accounted for, without even more complicated handling in zend_gc_*_tmpvars() functions.

This commit also proposes a simpler way of tracking the loop end in loopvar freeing ops: handle it directly during live range computation rather than during compilation, eliminating the need for opcache to handle it specifically.
Further, opcache was using live_ranges in its basic block computation in the past, which it no longer does. Thus this complication is no longer necessary and this approach should be actually simpler now.

Closes #20766.

Signed-off-by: Bob Weinand <bobwei9@hotmail.com>

---------

Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
Co-authored-by: Gustavo Lopes <mail@geleia.net>
2026-01-15 16:13:43 +01:00
Alexandre Daubois
32803687fe Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-20836: Stack overflow in mb_convert_variables with recursive array references (#20839)
2026-01-14 20:10:30 +01:00
Alexandre Daubois
2c112e3696 Fix GH-20836: Stack overflow in mb_convert_variables with recursive array references (#20839) 2026-01-14 20:07:11 +01:00
Derick Rethans
695df88fbf Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Update generated parser file
2026-01-14 14:22:06 +00:00
Derick Rethans
c929f2aa87 Update generated parser file 2026-01-14 14:21:29 +00:00
Derick Rethans
128530455b Merge branch 'PHP-8.4' into PHP-8.5 2026-01-14 14:18:56 +00:00
Derick Rethans
151e001109 Merge branch 'PHP-8.3' into PHP-8.4 2026-01-14 14:18:36 +00:00