1
0
mirror of https://github.com/php/php-src.git synced 2026-04-29 03:03:26 +02:00
Commit Graph

20202 Commits

Author SHA1 Message Date
Daniel Scherzer e5e09d06c1 Update versions for PHP 8.5.4 2026-03-10 16:15:23 -07:00
Ilija Tovilo 1da4480852 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix borked SCCP of array containing partial object
2026-02-17 18:12:09 +01:00
Ilija Tovilo 1931472f22 Fix borked SCCP of array containing partial object
In SCCP, arrays containing partial objects must be marked as partial so that
their values are not accidentally propagated.

Fixes GH-21227
Closes GH-21232
2026-02-17 18:11:28 +01:00
Ilija Tovilo ba6df41144 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix OSS-Fuzz #478009707 for JIT
2026-02-08 16:46:52 +01:00
Ilija Tovilo bbde9c8178 Fix OSS-Fuzz #478009707 for JIT
This issue was already fixed in GH-21124, but some JIT paths were missing.

Closes GH-21151
2026-02-08 16:46:08 +01:00
Ilija Tovilo f9df448bab Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix assign-op/inc/dec on untyped hooked property backing value
2026-02-05 14:48:15 +01:00
Ilija Tovilo 3cb85cc681 Fix assign-op/inc/dec on untyped hooked property backing value
Fixes OSS-Fuzz #478009707
Closes GH-21124
2026-02-05 14:46:06 +01:00
Arnaud Le Blanc 83056c806c Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Real instance of lazy proxy may have less magic methods
2026-02-03 12:05:11 +01:00
Arnaud Le Blanc de26827275 Real instance of lazy proxy may have less magic methods
In GH-18039 we guard the underlying property before forwarding access
to the real instance of a lazy proxy. When the real instance lacks magic
methods, the assertion zobj->ce->ce_flags & ZEND_ACC_USE_GUARDS fails in
zend_get_property_guard().

Fix by checking that the real instance uses guards.

Fixes GH-20504
Closes GH-21093
2026-02-03 12:04:35 +01:00
Arnaud Le Blanc 1e81a9efc7 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Mark object non-lazy before deleting info in zend_lazy_object_realize()
2026-02-03 11:50:32 +01:00
Arnaud Le Blanc 6d6d013d79 Mark object non-lazy before deleting info in zend_lazy_object_realize()
A lazy object is marked non-lazy when all its properties are
initialized. Before doing so we delete the object info, resulting in a
temporarily invalid state. In GH-20657 the GC is triggered at this moment.

Fix by deleting the object info _after_ marking it non lazy.

Fixes GH-20657
Closes GH-21094
2026-02-03 11:48:36 +01:00
Alexandre Daubois 4a6e6077ef Core: fix missing deprecation when accessing null array key with JIT (#20883) 2026-01-30 16:18:33 +01:00
arshidkv12 e9ae040629 Fix crash on (unset) cast in constant expression
Fixes GH-21072
Closes GH-21073
2026-01-29 17:00:06 +01:00
Ilija Tovilo 2f2b421a48 Fix segfault when preloading constant AST closure
Fixes GH-21059
Closes GH-21071
2026-01-29 13:30:41 +01:00
Tim Düsterhus 59433f8d3e Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Zend/zend_call_stack.h: fix missing include on Windows (clang compat) (#20847)
2026-01-29 10:38:52 +01:00
Kévin Dunglas 371422b9b9 Zend/zend_call_stack.h: fix missing include on Windows (clang compat) (#20847)
Co-authored-by: Tim Düsterhus <tim@tideways-gmbh.com>
2026-01-29 10:38:10 +01:00
Arnaud Le Blanc 00dd02cde1 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Add missing clobbered registers
2026-01-28 18:20:48 +01:00
Arnaud Le Blanc 93d32eae27 Add missing clobbered registers
Inline assembly in zend_safe_address() clobbers flags register. Add missing
register in clobber list for aarch64 and powerpc64. Other archs were already
correct.

Fixes GH-21029
2026-01-28 18:20:07 +01:00
Volker Dusch b5d3d8647f PHP-8.5 is now for PHP 8.5.4-dev 2026-01-27 17:37:51 +01:00
Saki Takamachi e6beffb6ed PHP-8.4 is now for PHP 8.4.19-dev 2026-01-27 22:21:42 +09: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 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 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
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
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
Ilija Tovilo c35e391b2d Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix leaked parent property default value
2026-01-13 13:09:23 +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 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
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
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 99aec78209 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix infinite loop in GC destructor fiber
2026-01-11 01:21:22 +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
henderkes 7b70ee5a9d Remove duplicate no/yes print for preserve_none
Closes GH-20827
2026-01-04 01:24:35 +01:00
Jakub Zelenka bddd6b0cd3 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Update NEWS with fix for bug #74357
  Fix bug #74357: lchown fails to change ownership of symlink with ZTS
2026-01-03 14:50:27 +01:00
Jakub Zelenka 91ac825278 Fix bug #74357: lchown fails to change ownership of symlink with ZTS 2026-01-03 14:41:57 +01:00
David Carlier 95a83956a4 Fix GH-20767: build failure with preserve_none attribute enabled on mac.
Established that build < 1700.4.4.1 tends to fail thus we disable the
preserve_none attribute feature for these cases.

close GH-20777
2025-12-31 11:14:18 +00:00
henderkes 02a6fecb97 Make preserve_none check lto compatible
Fixes GH-20806
Closes GH-20810
2025-12-31 11:38:21 +01:00
Daniel Scherzer daf4d54610 PHP-8.5 is now for PHP 8.5.3-dev 2025-12-30 14:27:29 -08:00
Calvin Buckley 5726e53b39 PHP 8.4 is now for PHP 8.4.18-dev 2025-12-30 13:07:11 -04:00
Bob Weinand f754ffa8b2 Fixed bug GH-20745 ("Casting out of range floats to int" applies to strings) (#20746)
This reverts the warning for float-strings, to whose it never should have been applied in the first place.
2025-12-29 21:29:08 +01:00