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

144907 Commits

Author SHA1 Message Date
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
Gina Peter Banyard
b56f068756 ext/session: use RETURN_BOOL() when possible 2026-02-05 13:01:38 +00:00
Gina Peter Banyard
713fbeda97 ext/session: no need to free a known zend_string 2026-02-05 13:01:38 +00:00
Gina Peter Banyard
f4b38fc9c6 ext/session: use true/false rather than 1/0 2026-02-05 13:01:38 +00:00
Gina Peter Banyard
b68122e15b ext/session: use bool type instead of int 2026-02-05 13:01:38 +00:00
Peter Kokot
06dac62747 Remove unused PHP_DL_TEST_EXPORTS and PHP_ZEND_TEST_EXPORTS (#21109)
In current code these aren't used on Windows build. The
PHP_ZEND_TEST_EXPORTS was intended to fix MSVC level 1 (severe) warnings
via 5a04796f76 but __declspec(dllexport)
is now implemented unconditionally.
2026-02-05 00:25:13 +01:00
Djim Schaap
81ef9770be Fix typo in writing-tests.rst (GH-21133) 2026-02-04 23:03:29 +01:00
ndossche
b860837b78 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix GH-20936: DatePeriod::__set_state() cannot handle null start
2026-02-04 18:36:17 +01:00
ndossche
34a341e59f Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-20936: DatePeriod::__set_state() cannot handle null start
2026-02-04 18:35:29 +01:00
Niels Dossche
7445b0f6d9 Fix GH-20936: DatePeriod::__set_state() cannot handle null start
The "current" and "end" field also rely on start_ce, which is set by
"start". Therefore, if "current" or "end" are provided, so must "start"
be provided.

Closes GH-20939.
2026-02-04 18:34:38 +01:00
Peter Kokot
345bf38480 Install missing headers (#21125)
These are included in public headers and should therefore be also
installed.

Follow-up of d16e6f52a4
2026-02-04 17:10:53 +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
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