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

140791 Commits

Author SHA1 Message Date
Saki Takamachi
c8f4422ecb Update versions for PHP 8.4.18 php-8.4.18 2026-02-11 02:48:03 +09: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
Alexander Borisov
56e5a80c44 Fix GH-21041: Dom\HTMLDocument corrupts closing tags within scripts 2026-01-26 19:20:10 +01: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
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
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
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
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
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
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
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
6a21a41b4a [skip ci] Fix missing test attribution 2026-01-20 18:00:58 +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
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
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
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
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
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
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
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
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
c929f2aa87 Update generated parser file 2026-01-14 14:21:29 +00:00
Derick Rethans
151e001109 Merge branch 'PHP-8.3' into PHP-8.4 2026-01-14 14:18:36 +00:00
Derick Rethans
ba1f3d9a87 Revert "Updated to version 2025.3 (2025c)"
This reverts commit 2670c8646d.
2026-01-14 14:16:47 +00:00
Derick Rethans
cfbfc1b6f6 Revert "Upgrade timelib to 2022.16"
This reverts commit e208cd86b4.
2026-01-14 14:16:40 +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
65e316e89c Updated to version 2025.3 (2025c) 2026-01-14 13:55:15 +00:00
Derick Rethans
c42eedc088 Empty merge
* PHP-8.3:
  Updated to version 2025.3 (2025c)
2026-01-14 13:55:14 +00:00
Derick Rethans
2670c8646d Updated to version 2025.3 (2025c) 2026-01-14 13:55:08 +00:00
Ilija Tovilo
688d4e7072 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [skip ci] Upgrade to Ubuntu 24.04 for PECL and coverage builds
2026-01-13 16:10:53 +01:00
Ilija Tovilo
c145f83f34 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  [skip ci] Upgrade to Ubuntu 24.04 for PECL and coverage builds
2026-01-13 16:10:47 +01:00
Ilija Tovilo
648ad5be31 [skip ci] Upgrade to Ubuntu 24.04 for PECL and coverage builds 2026-01-13 16:10:35 +01:00
Ilija Tovilo
4bfaf549f6 Fix leaked parent property default value
Fixes OSS-Fuzz #474613951
Closes GH-20911
2026-01-13 13:08:39 +01:00
Arnaud Le Blanc
b273fc7aca NEWS 2026-01-13 12:34:03 +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
1052270001 Add test for GH-20880 (#20919)
Closes GH-20880.
2026-01-12 22:45:24 +01:00
Dmitry Stogov
098b1f89bd Update IR (#20916)
IR commit: 40cd6ad28c376cf006c360f39d8aeff6d6e7bf78
2026-01-12 21:23:38 +03: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
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
f61b1fc036 Fix block_pass JMP[N]Z optimization
In the following optimization:

JMPZ(X,L1) JMP(L2) L1: -> JMPNZ(X,L2) NOP

L1 must not be followed by another block, so that it may safely be followed by
the block containing the JMPNZ. get_next_block() is used to verify L1 is the
direct follower. This function also skips empty blocks, including live, empty
target blocks, which will then implicitly follow the new follow block. This will
result in L1 being followed by two separate blocks, which is not possible.

Resolve this by get_next_block() stopping at target blocks.

Fixes OSS-Fuzz #472563272
Closes GH-20850
2026-01-11 14:55:23 +01:00
Ilija Tovilo
6f6c9e35e8 Fix infinite loop in GC destructor fiber
zend_object_release(&fiber->std) may restart the fiber due to finally. Any
thrown exception must be remembered and unset so that the next fiber may
successfully start.

Fixes OSS-Fuzz #471533782
Closes GH-20884
2026-01-11 01:20:32 +01:00
Niels Dossche
a6e0d8e359 Fix GH-20882: phar buildFromIterator breaks with missing base directory
Broke in f57526a07a because of changing a char*+size_t pair to
zend_string* (which can't handle NULL pointers in its macros).

Closes GH-20888.
2026-01-10 15:09:36 +01:00
Tim Düsterhus
b5d6377ada output: Fail starting to output buffer when the output layer is deactivated (#20846)
Fixes php/php-src#20837.
2026-01-10 14:37:52 +01:00
Niels Dossche
60b1f59081 fastcgi: Fix compile warning wrt safe_read() (#20887)
This shouldn't be const. Fixes the following warning:
```
warning: variable 'hdr' is uninitialized when passed as a const pointer argument here
      [-Wuninitialized-const-pointer]
 1054 |         if (safe_read(req, &hdr, sizeof(fcgi_header)) != sizeof(fcgi_header) ||
      |                             ^~~
```
2026-01-10 10:49:37 +01:00