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

144895 Commits

Author SHA1 Message Date
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
Arshid
a5a0ff6448 ext/mysqli: raise ValueError for invalid option in mysqli_options() (#20971)
Closes GH-20968

Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com>
Co-authored-by: Kamil Tekiela <tekiela246@gmail.com>
Co-authored-by: Gina Peter Banyard <girgias@php.net>
2026-02-03 18:27:10 +00:00
Niels Dossche
f0f28b763c Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix GH-21097: Accessing Dom\Node properties can can throw TypeError(s)
2026-02-03 18:41:13 +01:00
Niels Dossche
52eb174ba6 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-21097: Accessing Dom\Node properties can can throw TypeError(s)
2026-02-03 18:40:54 +01:00
Niels Dossche
b8fc6bd1c8 Fix GH-21097: Accessing Dom\Node properties can can throw TypeError(s)
Split the handler again, or defer to instanceof when performance doesn't
matter.

Closes GH-21108.
2026-02-03 18:36:28 +01:00
Ilija Tovilo
5873627bac Merge branch 'PHP-8.5'
* PHP-8.5:
  Make brew verbose, limit to 10 minutes
2026-02-03 14:50:19 +01:00
Ilija Tovilo
13f0fd9392 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Make brew verbose, limit to 10 minutes
2026-02-03 14:50:14 +01:00
Ilija Tovilo
1dfc8028d8 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Make brew verbose, limit to 10 minutes
2026-02-03 14:49:06 +01:00
Ilija Tovilo
47fbacad43 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Make brew verbose, limit to 10 minutes
2026-02-03 14:48:20 +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
Ilija Tovilo
8b47ae8342 Make brew verbose, limit to 10 minutes
This step regularly locks up. Maybe --verbose will provide some insight. Also
limit the step to 10 minutes to avoid holding up resources.
2026-02-03 13:40:41 +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
Ilija Tovilo
cb51737f41 Merge branch 'PHP-8.5'
* PHP-8.5:
  Tweak zend.max_allowed_stack_size for gh20836_stack_limit.phpt
2026-02-03 00:55:05 +01:00
Ilija Tovilo
9e96c5ff39 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Tweak zend.max_allowed_stack_size for gh20836_stack_limit.phpt
2026-02-03 00:54:56 +01:00
Ilija Tovilo
1f57d04648 Tweak zend.max_allowed_stack_size for gh20836_stack_limit.phpt
Fixes GH-21086
2026-02-03 00:54:25 +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
Peter Kokot
c774be97f4 Autotools: Update config.{guess,sub} to 2025-07-10 (#19129)
```
wget -O build/config.guess https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
wget -O build/config.sub https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
```
2026-02-02 10:47:40 +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
Ayesh Karunaratne
6419618f54 ext/standard: update array_filter $mode param default value to ARRAY_FILTER_USE_VALUE
In GH-15647, the `array_filter` function was changed to throw a
`ValueError` exception when the `$mode` parameter receives an
invalid.

Additionally, it declares a new `ARRAY_FILTER_USE_VALUE`, assigned
(`int 1`) to it.

This changes the default value of the `array_filter` function's
`$mode` parameter to use the new constant, changing it from
`int $mode = 0` to `int $mode = ARRAY_FILTER_USE_KEY)`.

Closes GH-21100.
2026-02-01 10:35:32 +07:00
Ayesh Karunaratne
9dab2c99f9 ext/standard: add ARRAY_FILTER_USE_VALUE to UPGRADING
Closes GH-21100.
2026-02-01 10:35:15 +07: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
Niels Dossche
0f4f73a254 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix GH-21077: Accessing Dom\Node::baseURI can throw TypeError
2026-01-30 18:14:24 +01:00
Niels Dossche
d54e5106b0 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-21077: Accessing Dom\Node::baseURI can throw TypeError
2026-01-30 18:14:19 +01:00
Niels Dossche
d73b2f782e Fix GH-21077: Accessing Dom\Node::baseURI can throw TypeError
Prior to this patch there was a common read handler, and it relied on
the dom class set in the intern document. However, Dom\Implementation
allows creating DTDs unassociated with a document, so we can't rely on
an intern document and the check fails. This causes the ZVAL_NULL() path
to be taken.
To solve this, just split the handler.

Closes GH-21082.
2026-01-30 18:13:55 +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
cui
7fed075ba6 [skip ci] typo: sucess* to success* (GH-21092) 2026-01-30 14:28:48 +01:00
Arshid
3bff1dc875 Remove unused arg from zend_property_is_virtual() (GH-21084) 2026-01-30 14:21:11 +01:00
David Carlier
4876148bbe Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix GH-21023: CURLOPT_XFERINFOFUNCTION with invalid callback crash.
2026-01-30 13:10:35 +00:00
David Carlier
2b89919a5d Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-21023: CURLOPT_XFERINFOFUNCTION with invalid callback crash.
2026-01-30 13:10:27 +00:00
David Carlier
b156471a30 Fix GH-21023: CURLOPT_XFERINFOFUNCTION with invalid callback crash.
we check the FCC is properly initialised beforehand in its handler.

close GH-21025
2026-01-30 13:09:44 +00: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
Arshid
9580d47898 ext/ftp: Use STANDARD_MODULE_HEADER instead of STANDARD_MODULE_HEADER_EX (#21088) 2026-01-30 09:05:43 +00:00
Máté Kocsis
df1a90eadc Update config options for real-time benchmark
Valgrind based instruction count is no longer available, but two debugging related options were recently added.
2026-01-29 22:21:37 +01:00
David CARLIER
ce798afac3 Fix GH-21058: error_log() crash on null destination argument. (#21064)
we preserve the lower branches behavior by letting php_stream_open_wrapper_ex
handling the null path and propagating the exception.

close GH-21064
2026-01-29 19:49:45 +00:00
Arshid
5ce36453d6 [skip ci] Use STANDARD_MODULE_HEADER for ext-date (GH-21080) 2026-01-29 17:19:14 +01:00