Commit graph

19982 commits

Author SHA1 Message Date
Gina Peter Banyard
cab46b27b9
ext/standard: Deprecate passing integers outside the interval [0, 255] to chr() (#19441)
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_passing_integers_outside_the_interval_0_255_to_chr
2025-08-14 20:48:48 +01:00
Alexandre Daubois
6009b8a100
Fix GH-19476: pipe operator fails to correctly handle returning by reference (GH-19478)
Some checks are pending
Push / MACOS_ARM64_DEBUG_NTS (push) Waiting to run
Push / WINDOWS_X64_ZTS (push) Waiting to run
Push / LINUX_X64_DEBUG_ZTS_ASAN (push) Has been skipped
Push / BENCHMARKING (push) Has been skipped
Push / FREEBSD (push) Has been skipped
Push / LINUX_X64_RELEASE_NTS (push) Has been skipped
Push / LINUX_X32_DEBUG_ZTS (push) Has been skipped
2025-08-14 16:34:21 +02:00
Gina Peter Banyard
fb87b14b6c
ext/spl: Deprecate ArrayObject and ArrayIterator with objects (#19420)
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_arrayobject_and_arrayiterator_with_objects

This also moves tests into a subfolder.
2025-08-14 12:38:57 +01:00
Ilija Tovilo
9c754baa99
Merge branch 'PHP-8.4'
Some checks are pending
Push / LINUX_X32_DEBUG_ZTS (push) Has been skipped
Push / MACOS_ARM64_DEBUG_NTS (push) Waiting to run
Push / WINDOWS_X64_ZTS (push) Waiting to run
Push / LINUX_X64_RELEASE_NTS (push) Has been skipped
Push / LINUX_X64_DEBUG_ZTS_ASAN (push) Has been skipped
Push / BENCHMARKING (push) Has been skipped
Push / FREEBSD (push) Has been skipped
* PHP-8.4:
  Fix "Constant already defined" warning with repeated inclusion of file with __halt_compiler()
2025-08-14 12:16:16 +02:00
Ilija Tovilo
708d8e9cfd
Merge branch 'PHP-8.3' into PHP-8.4
Some checks are pending
Push / LINUX_X32_DEBUG_ZTS (push) Has been skipped
Push / MACOS_ARM64_DEBUG_NTS (push) Waiting to run
Push / WINDOWS_X64_ZTS (push) Waiting to run
Push / LINUX_X64_RELEASE_NTS (push) Has been skipped
Push / LINUX_X64_DEBUG_ZTS_ASAN (push) Has been skipped
Push / BENCHMARKING (push) Has been skipped
Push / FREEBSD (push) Has been skipped
* PHP-8.3:
  Fix "Constant already defined" warning with repeated inclusion of file with __halt_compiler()
2025-08-14 12:15:00 +02:00
Ilija Tovilo
a3de2ce9ba
Fix "Constant already defined" warning with repeated inclusion of file with __halt_compiler()
Some checks are pending
Push / LINUX_X64_DEBUG_ZTS_ASAN (push) Has been skipped
Push / FREEBSD (push) Has been skipped
Push / MACOS_DEBUG_NTS (push) Waiting to run
Push / WINDOWS_X64_ZTS (push) Waiting to run
Push / LINUX_X64_RELEASE_NTS (push) Has been skipped
Push / LINUX_X32_DEBUG_ZTS (push) Has been skipped
Push / BENCHMARKING (push) Has been skipped
Fixes GH-18850
Closes GH-19471
2025-08-14 12:13:50 +02:00
Alexandre Daubois
bf64dfcd99
Add an enum for HASH_KEY_IS_* constants (GH-19376) 2025-08-13 13:59:01 +02:00
Eric Mann
a0bd2c9fcf
PHP-8.3 is now for PHP 8.3.26-dev 2025-08-12 08:15:40 -07:00
Saki Takamachi
b7c26eb16c
PHP-8.4 is now for PHP 8.4.13-dev 2025-08-12 23:46:26 +09:00
Jiří Pudil
38beb44176
[RFC] Extend #[\Override] to target properties (#19061)
RFC: https://wiki.php.net/rfc/override_properties

Co-authored-by: Tim Düsterhus <tim@bastelstu.be>
2025-08-12 15:18:50 +02:00
Daniel Scherzer
57a88b216c
[RFC] Deprecate ReflectionProperty::getDefaultValue() without default (#19457)
https://wiki.php.net/rfc/deprecations_php_8_5
2025-08-12 05:50:27 -07:00
Daniel Scherzer
4de2ec3895
[RFC] Deprecate xml_parser_free() (#19449)
https://wiki.php.net/rfc/deprecations_php_8_5
2025-08-12 05:44:32 -07:00
Alexandre Daubois
dfa1307a64
Various return types and values consolidation (#19418) 2025-08-12 11:28:41 +01:00
Daniel Scherzer
3dc962b9f7
[RFC] Deprecate returning null from __debugInfo() (#19455)
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_debuginfo_returning_null
2025-08-12 11:15:18 +01:00
Tim Düsterhus
3d9d68e1ca
zend_compile: Deprecate backticks as an alias for shell_exec() (#19443)
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_backticks_as_an_alias_for_shell_exec
2025-08-12 12:02:13 +02:00
Derick Rethans
4d6dde595c
Emit EXT_STMT after each pipe stage, and attach the TMP var that holds the intermediary result (#19377)
* Emit EXT_STMT after each pipe stage, and attach the TMP var that holds the intermediary result
* Add ZEND_EXT_STMT to keeps_op1_alive as per review
* Fix leak with EXT_STMT when pipe result is unused

Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com>
2025-08-12 10:26:06 +01:00
Niels Dossche
4d74dd0395
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-19065: Long match statement can segfault compiler during recursive SSA renaming
2025-08-11 23:05:56 +02:00
Niels Dossche
8b5231388c
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-19065: Long match statement can segfault compiler during recursive SSA renaming
2025-08-11 23:05:50 +02:00
Niels Dossche
9b86533ce4
Fix GH-19065: Long match statement can segfault compiler during recursive SSA renaming
On some systems, like Alpine, the thread stack size is small by default.
The last step of SSA construction involves variable renaming that is
recursive, and also makes copies of their version of the renamed
variables on the stack. This combination causes a stack overflow during
compilation on Alpine. Triggerable for example with very long match
statements.

A stop-gap solution would be to use heap allocated arrays for the
renamed variable list, but that would only delay the error as increasing
the number of match arms increases the depth of the dominator tree, and
will eventually run into the same issue.

This patch transforms the algorithm into an iterative one.
There are two states stored in a worklist stack: positive numbers
indicate that the block still needs to undergo variable renaming.
Negative numbers indicate that the block and its dominated children are
already renamed. Because 0 is also a valid block number, we bias the
block numbers by adding 1.
To restore to the right variant when backtracking the "recursive" step,
we index into an array pointing to the different variable renaming
variants.

Closes GH-19083.
2025-08-11 23:05:21 +02:00
Daniel Scherzer
c416191a00
GH-19153: Validate #[\Attribute] targets (#19154)
Do not allow #[\Attribute] on traits, interfaces, enums, or abstract classes.
2025-08-11 09:05:57 -07:00
Theodore Brown
5f8d648af6
Deprecate terminating case statements with a semicolon (#19215)
Part of https://wiki.php.net/rfc/deprecations_php_8_5

Closes GH-15258
2025-08-11 14:18:06 +02:00
Nikita Popov
bc475ada13 Fix non-canonical casts
They may be deprecated, but they should still produce the correct
type...
2025-08-09 21:40:13 +02:00
Gina Peter Banyard
16872310d5
ext/spl: Deprecate SplObjectStorage::contains(), SplObjectStorage::attach(), and SplObjectStorage::detach() (#19424)
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_splobjectstoragecontains_splobjectstorageattach_and_splobjectstoragedetach
2025-08-09 11:36:14 +01:00
Gina Peter Banyard
94a15cc92f
Deprecate the parameter of get_defined_functions() (#19425)
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_the_exclude_disabled_parameter_of_get_defined_functions
2025-08-09 11:22:43 +01:00
Peter Kokot
f64c6248b5
Autotools: Update ax_check_compile_flag.m4 to serial 11 (#19127)
```sh
wget -O build/ax_check_compile_flag.m4 \
  https://cgit.git.savannah.gnu.org/cgit/autoconf-archive.git/plain/m4/ax_check_compile_flag.m4
```

New version of AX_CHECK_COMPILE_FLAG macro now adds the -Werror flag
automatically, if GNU-compatible compiler is detected.
2025-08-09 02:03:37 +02:00
Gina Peter Banyard
3bf21a0d43
Zend: Deprecate non-canonical cast names (#19372)
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_non-standard_cast_names
2025-08-08 21:22:49 +01:00
Gina Peter Banyard
c5143c0b22
tree: remove some usages of the report_memleaks INI setting (#19407) 2025-08-07 22:17:24 +01:00
David Carlier
bd2766ce79
zend call stack fixing stack limit for macOs arm64.
8MB sounded a prudent size for older 10.9 macOs release, however
with newer mac with arm64, it triggers a stack overflow.

Cherry picks b320aabc5e (GH-13319) from PHP-8.4.
Closes GH-19390.
2025-08-07 08:38:40 +02:00
Gina Peter Banyard
1e0c8baf05
tree: drop non canonical casts and ZPP tests 2025-08-06 13:20:28 +01:00
Gina Peter Banyard
d0274e74f8 Zend/zend_ast: Use uint32_t type instead of int type 2025-08-05 12:43:18 +01:00
Gina Peter Banyard
8512514a0f Zend/zend_ast: Use zend_ast_get_list() instead of cast 2025-08-05 12:43:18 +01:00
Gina Peter Banyard
36ec3370fb Zend/zend_ast: Add const qualifier 2025-08-05 12:43:18 +01:00
Ilija Tovilo
cd80ed6f7b
Implement changes to GH-17951 according to ML discussion 2025-08-04 16:04:25 +02:00
Daniel Scherzer
63f9e4945d
GH-17927: Indicate virtual properties and hooks in reflection output (#19297) 2025-07-31 17:32:09 -07:00
Gina Peter Banyard
105c1e9896
tree: use zend_str_has_nul_byte() API (#19336) 2025-07-31 23:57:27 +01:00
Ilija Tovilo
a262419398
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix circumvented type check with return by ref + finally
2025-08-01 00:36:38 +02:00
Ilija Tovilo
b3f4863373
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix circumvented type check with return by ref + finally
2025-08-01 00:36:28 +02:00
Ilija Tovilo
d0fad34230
Fix circumvented type check with return by ref + finally
Fixes GH-18736
Closes GH-19172
2025-08-01 00:35:48 +02:00
Niels Dossche
15990de89e
Refactor op array loops in JIT (#19335)
Reuse the helper zend_foreach_op_array() that we move to the
zend_optimizer.h header to be usable in opcache.
Note that applying this to other op_array loops is not easy because they either:
- start from EG(persistent_classes_count)
- or only apply to classes
2025-07-31 22:10:06 +02:00
Ilija Tovilo
0afa04a474
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix stale nInternalPosition on rehashing
2025-07-31 21:56:00 +02:00
Ilija Tovilo
5d40592fe2
Fix stale nInternalPosition on rehashing
Since GH-13188 we're no longer immediately updating iterator positions when
deleting array elements. zend_hash_rehash() needs to adapt accordingly by
adjusting nInternalPosition for IS_UNDEF elements. This is already the case for
array iterators.

Fixes GH-19280
Closes GH-19323
2025-07-31 21:55:08 +02:00
Alexandre Daubois
e43074a1d8
Rename poorly named tests in Zend/tests (#19332)
And move some into their relevant folders
2025-07-31 19:58:01 +01:00
Arnaud Le Blanc
659f55a617
Merge branch 'PHP-8.4'
* PHP-8.4:
  Prevent throwing in running generator
2025-07-31 14:29:25 +02:00
Arnaud Le Blanc
781d77ac54
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Prevent throwing in running generator
2025-07-31 14:29:01 +02:00
Arnaud Le Blanc
6fa8a25a40
Prevent throwing in running generator
Generator::throw() on a running generator is not allowed. It throws "Cannot
resume an already running generator" when trying to resume the generator to
handle the provided exception.

However, when calling Generator::throw() on a generator with a non-Generator
delegate, we release the delegate regardless. If a Fiber was suspended in
the delegate, this causes use after frees when the Fiber is resumed.

Fix this by throwing "Cannot resume an already running generator" earlier.

Fixes GH-19326
Closes GH-19327
2025-07-31 14:26:41 +02:00
Ilija Tovilo
049651dccc
Fix incorrect anonymous class type name assertion (#19316)
Since GH-17755 self and parent are compile-time resolved. We may now also
encounter this type error at runtime outside of the class itself.

Fixes GH-19304
2025-07-31 13:27:28 +02:00
Arnaud Le Blanc
37a59e55e8
Merge branch 'PHP-8.4'
* PHP-8.4:
  Prevent resumption of generator suspended in yield from
2025-07-31 08:47:37 +02:00
Arnaud Le Blanc
a430ee2dd2
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Prevent resumption of generator suspended in yield from
2025-07-31 08:46:06 +02:00
Arnaud Le Blanc
0406a55c92
Prevent resumption of generator suspended in yield from
Normally we prevent generators from being resumed while they are already
running, but we failed to do so for generators delegating to non-Generators. As
a result such generator can be resumed, terminated, which causes unexpected
results (crashes) later.

In gh19306.phpt in particular, the generator delegate It::getIterator() suspends
while being called by generator g(). We then resume g(), which throws while
trying to resume It::getIterator(). This causes g() and It::getIterator()
to be released. We then UAF when resuming the Fiber in It::getIterator().

Fix this by ensuring that generators are marked as running while they fetch
the next value from the delegate.

Fixes GH-19306
Closes GH-19315
2025-07-31 08:45:19 +02:00
Daniel Scherzer
0fc62310b1
AllowDynamicProperties: use fully qualified name in validation errors (#19296) 2025-07-30 14:50:40 -07:00