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

20453 Commits

Author SHA1 Message Date
Tim Düsterhus
9c900b6e34 zend_compile: Bundle function type constants into an zend_function_type enum (#21208)
* zend_compile: Bundle function type constants into an `zend_function_type` enum

This clarifies the relationship between these constants and improves type
safety a little.

* Add C23_ENUM() helper macro

* zend_portability: Rename `size` to `underlying_type` in `C23_ENUM()`

* zend_portability: Include the leading `enum` in the `C23_ENUM` macro

* Fix comment for C23_ENUM()
2026-02-16 14:19:29 +01:00
Tim Düsterhus
7134e69ab2 zend_globals: Embed in_autoload into zend_executor_globals (#21202)
* zend_globals: Embed `in_autoload` into `zend_executor_globals`

Nowadays virtually any PHP application is making use of autoloading, making the
lazy allocation of the `HashTable` struct a needless pointer indirection.

* zend_globals: Rename `in_autoload` to `autoload_current_classnames`

The old name `in_autoload` was somewhat misleading by implying a `bool`ean
value rather than a `HashTable`. Since the previous change to embed the
`HashTable` is breaking anyway, we can also rename it.

* UPGRADING.INTERNALS
2026-02-11 22:53:31 +01:00
Arshid
95fb174730 [skip ci] Remove dead code in Zend/zend_multiply.h after zend_error_noreturn() (GH-21153) 2026-02-09 15:13:58 +01:00
Ilija Tovilo
fcff846a73 Fix borked FETCH_W+ZEND_FETCH_GLOBAL_LOCK optimization (GH-21121)
Fixes OSS-Fuzz #481014628
Introduced in GH-20628

Co-authored-by: Arnaud Le Blanc <365207+arnaud-lb@users.noreply.github.com>
2026-02-09 13:22:35 +01:00
Ilija Tovilo
fcb50e4d62 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix OSS-Fuzz #478009707 for JIT
2026-02-08 16:47:06 +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
984f95ffc1 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix assign-op/inc/dec on untyped hooked property backing value
2026-02-05 14:48:21 +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
68a10628a2 Fix -Wdefault-const-init-field-unsafe with clang 21 (#21135)
Fixes the following warning:

Zend/zend_alloc.c:3469:18: error: default initialization of an object of type 'zend_mm_storage' (aka 'struct _zend_mm_storage') with const member leaves the object uninitialized [-Werror,-Wdefault-const-init-field-unsafe]
 3469 |         zend_mm_storage tmp_storage, *storage;
      |                         ^
Zend/zend_alloc.h:313:25: note: member 'handlers' declared 'const' here
  313 |         const zend_mm_handlers handlers;
      |                                ^
2026-02-05 14:30:58 +01:00
Nurzhan Bazhirov
b843e03c83 Zend: Remove unused parameter from zend_dval_to_lval_cap()
The `zend_string *s` parameter became unused after commit f754ffa8b2
(GH-20746) removed the `zend_oob_string_to_long_error()` calls.

This fixes an unused-parameter compiler warning and updates a stale
comment in zend_operators.c that incorrectly stated this function
can emit warnings.

Closes GH-21112
2026-02-04 15:25:42 +01:00
Tim Düsterhus
a15ba7672c zend_ini: Make ZEND_INI_GET_ADDR() return a void* pointer (#21119)
* zend_ini: Make `ZEND_INI_GET_ADDR()` return a `void*` pointer

Since the actual type of the storage location is not known, a `void*` is more
appropriate and avoids explicit casts that are no more safe than the implicit
cast from `void*`.

* tree-wide: Remove explicit casts of `ZEND_INI_GET_ADDR()`

* UPGRADING.INTERNALS
2026-02-04 11:11:11 +01:00
Ilija Tovilo
27d28eef1e Fix mistakenly allowed assignment to assignment through list operator (GH-21123)
Fixes OSS-Fuzz #480111866
Introduced in GH-20628
2026-02-04 01:47:01 +01:00
Arshid
b5abd77bdf [skip ci] Remove unreachable code after zend_error_noreturn calls (GH-21122) 2026-02-03 22:02:43 +01:00
Ilija Tovilo
4188c3ee2c Fix missing deref in zend_fe_fetch_object_helper (GH-21116)
Fixes OSS-Fuzz #481017027
Introduced in GH-20628
2026-02-03 13:55:49 +01:00
Arnaud Le Blanc
d16e6f52a4 Generate C enums from internal enums, introduce Z_PARAM_ENUM() (#20917)
Update gen_stubs.php to generate C enums from internal enums, when the stub is annotated with @generate-c-enums. Enum values can be compared to the result of zend_enum_fetch_case_id(zend_object*).

The generated enums are added to separate files named {$extensionName}_decl.h, so that it's possible to include these from anywhere. _arginfo.h files would generate warnings if we tried to include them in a compilation unit that doesn't call the register_{$class} functions, for instance.

Introduce Z_PARAM_ENUM().

* Make ZEND_AST_CONST_ENUM_INIT a 4-children node

* Store enum case id in ZEND_AST_CONST_ENUM_INIT

* Store enum case id in instance

* Expose enum case_id internally

* Generate C enum for internal enums

* Introduce Z_PARAM_ENUM()

* Port extensions
2026-02-03 12:38:04 +01:00
Arnaud Le Blanc
4a1cca7ddc Revert lazy proxy state after failed initialization
We don't expect the lazy proxy to be modified during initialization, but
this is allowed. The modification may set a property, still marked LAZY,
without removing the LAZY flag. This causes an assertion failure in GH-20174.

Both the RFC and the documentation specify that after an initialization
failure, the state of the object is reset to its pre-initialization state:

    If the initializer throws an exception, the object state is reverted to
    its pre-initialization state and the object is marked as lazy again. In
    other words, all effects on the object itself are reverted. Other side
    effects, such as effects on other objects, are not reverted. This prevents
    exposing a partially initialized instance in case of failure.

This behavior would have prevented this issue, but it was not implemented
for lazy proxies (only for ghosts).

Fix by implementing the missing behavior.

Fixes GH-20174
Closes GH-20181
2026-02-03 12:12:03 +01:00
Arnaud Le Blanc
39f5ed943d Merge branch 'PHP-8.5'
* PHP-8.5:
  Real instance of lazy proxy may have less magic methods
2026-02-03 12:05:22 +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
4810af9aac Merge branch 'PHP-8.5'
* PHP-8.5:
  Mark object non-lazy before deleting info in zend_lazy_object_realize()
2026-02-03 11:52:53 +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
Khaled Alam
32bd33983d Remove unreachable code after zend_error_noreturn calls (GH-20983) 2026-02-02 14:14:15 +01:00
Arshid
ad0baf0bb2 [skip ci] Drop end argument from gc_call_destructors_in_fiber() (GH-21099) 2026-02-02 14:05:42 +01:00
Ilija Tovilo
a01a8e72ac Fix failed assertion for assignment in expression context
This code path is reachable for all assignments expressions, not just true
variable expressions.

Really surprising we have no tests that caught this.
2026-02-01 14:14:08 +01:00
Ilija Tovilo
6173a9a109 VAR|TMP overhaul (GH-20628)
The aim of this PR is twofold:

- Reduce the number of highly similar TMP|VAR handlers
- Avoid ZVAL_DEREF in most of these cases

This is achieved by guaranteeing that all zend_compile_expr() calls, as well as
all other compile calls with BP_VAR_{R,IS}, will result in a TMP variable. This
implies that the result will not contain an IS_INDIRECT or IS_REFERENCE value,
which was mostly already the case, with two exceptions:

- Calls to return-by-reference functions. Because return-by-reference functions
  are quite rare, this is solved by delegating the DEREF to the RETURN_BY_REF
  handler, which will examine the stack to check whether the caller expects a
  VAR or TMP to understand whether the DEREF is needed. Internal functions will
  also need to adjust by calling the zend_return_unwrap_ref() function.

- By-reference assignments, including both $a = &$b, as well as $a = [&$b]. When
  the result of these expressions is used in a BP_VAR_R context, the reference
  is unwrapped via a ZEND_QM_ASSIGN opcode beforehand. This is exceptionally
  rare.

Closes GH-20628
2026-01-31 19:44:56 +01:00
Arshid
927b9eecb6 Drop unused error_type argument from zend_check_magic_method_public() (GH-21095) 2026-01-30 21:46:26 +01:00
Arshid
6a0871853b Drop unused priority argument from zend_ast_export_var() (GH-21096) 2026-01-30 21:44:16 +01:00
Arshid
d1c1a9fa82 [skip ci] Remove unused arg from zend_throw_incdec_ref_error() (GH-21081) 2026-01-30 18:58:25 +01:00
Khaled Alam
d03d69a88a Remove duplicate #include statements (#21085)
* Remove duplicate #include statements across the codebase.

* feat: Restore conditional/unconditional include pairs in lscriu.c
2026-01-30 16:37:13 +01:00
Alexandre Daubois
e4935cf601 Merge branch 'PHP-8.5'
* PHP-8.5:
  Core: fix missing deprecation when accessing null array key with JIT (#20883)
2026-01-30 16:19:57 +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
Arshid
3bff1dc875 Remove unused arg from zend_property_is_virtual() (GH-21084) 2026-01-30 14:21:11 +01:00
Gina Peter Banyard
5dd9d2a348 Zend/zend_autoload.c: fix indentation
For some reason my IDE decided 3 spaces was a good indentation and nobody else noticed.
2026-01-30 12:57:07 +01:00
Ilija Tovilo
0dd1bdc3e5 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix crash on (unset) cast in constant expression
2026-01-29 17:00:43 +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
db24ca5926 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix segfault when preloading constant AST closure
2026-01-29 13:31:38 +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
cd1e19a385 Merge branch 'PHP-8.5'
* PHP-8.5:
  Zend/zend_call_stack.h: fix missing include on Windows (clang compat) (#20847)
2026-01-29 10:39:01 +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
c60c49a08b Merge branch 'PHP-8.5'
* PHP-8.5:
  Add missing clobbered registers
2026-01-28 18:20:55 +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
Peter Kokot
65fd4d83bc Remove ext/spl dependency from ext/session (#21060)
This is a follow-up of 668606816f
(GH-21001).

The SPL extension is no longer needed to be listed among dependencies.
The https://bugs.php.net/53141 is tested in
ext/session/tests/bug53141.phpt.

Additionally:
- Added missing inclusion guards to Zend/zend_autoload.h
2026-01-28 16:25:40 +00:00
Gina Peter Banyard
668606816f Zend: move class autoloading from SPL to Zend (#21001)
The primary motivation for this change is that this sort of functionality should reside in core and not in an extension.
The reason being is that this causes issues in regard to extension dependencies and resolution,
something that prevents GH-14544.
2026-01-28 01:57:30 +00: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