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

71623 Commits

Author SHA1 Message Date
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
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
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
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
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
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
cdeb0694f4 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Upgrade timelib to 2022.16
2026-01-14 14:12:15 +00:00
Derick Rethans
9d4a1f0c7e Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Upgrade timelib to 2022.16
2026-01-14 14:11:29 +00:00
Derick Rethans
e208cd86b4 Upgrade timelib to 2022.16 2026-01-14 14:10:44 +00:00
Derick Rethans
771dbda6fb Updated to version 2025.3 (2025c) 2026-01-14 13:55:17 +00:00
Derick Rethans
65e316e89c Updated to version 2025.3 (2025c) 2026-01-14 13:55:15 +00:00
Derick Rethans
2670c8646d Updated to version 2025.3 (2025c) 2026-01-14 13:55:08 +00:00
Máté Kocsis
48344c9f86 Reorganize ext/uri tests - equivalence (#20391) 2026-01-13 22:45:58 +01:00
Tim Düsterhus
11ae6ad0be zend_language_parser: Backup / restore doc comment when parsing attributes (#20896)
Attributes may themselves contain elements which can have a doc comment on
their own (namely Closures). A doc comment before the attribute list is
generally understood as belonging to the symbol having the attributes.

Fixes php/php-src#20895.
2026-01-13 16:07:50 +01:00
Arnaud Le Blanc
cc21f5e095 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  NEWS
  Set default_object_handlers when registering internal enums
2026-01-13 12:36:31 +01:00
Arnaud Le Blanc
075b6b85f6 Set default_object_handlers when registering internal enums
Internal enums can be cloned and compared, unlike user enums, because we didn't set default_object_handlers when registering internal enums.

Fix by setting default_object_handlers when registering internal enums.

Fixes GH-20914
Closes GH-20915
2026-01-13 12:32:52 +01:00
Niels Dossche
c80ac797d4 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Add test for GH-20880 (#20919)
2026-01-12 22:45:43 +01:00
Niels Dossche
1052270001 Add test for GH-20880 (#20919)
Closes GH-20880.
2026-01-12 22:45:24 +01:00
Dmitry Stogov
f7f0d228c2 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Update IR (#20916)
2026-01-12 21:23:52 +03:00
Dmitry Stogov
098b1f89bd Update IR (#20916)
IR commit: 40cd6ad28c376cf006c360f39d8aeff6d6e7bf78
2026-01-12 21:23:38 +03:00
Niels Dossche
acad49cace Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix bug52820 test for new libcurl release
2026-01-12 18:47:57 +01:00
Niels Dossche
290ebf13e1 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix bug52820 test for new libcurl release
2026-01-12 18:47:51 +01:00
Niels Dossche
39da78f422 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix bug52820 test for new libcurl release
2026-01-12 18:47:45 +01:00
Niels Dossche
636f84adcf Fix bug52820 test for new libcurl release
Reference: GH-20910.
2026-01-12 18:47:33 +01:00
Niels Dossche
a82a93d64e Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-20856: heap-use-after-free in SplDoublyLinkedList iterator when modifying during iteration
2026-01-11 20:43:12 +01:00
Niels Dossche
2a2e0e8128 Fix GH-20856: heap-use-after-free in SplDoublyLinkedList iterator when modifying during iteration
The element may be still in use in other places, so the linking pointers
should be kept consistent. If not consistent, the "move forward" code in
the sample test will read a stale, dangling pointer.

Closes GH-20885.
2026-01-11 20:42:25 +01:00
Ilija Tovilo
918dc2355e Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix block_pass JMP[N]Z optimization
2026-01-11 14:56:05 +01:00