Compare commits

...

500 commits

Author SHA1 Message Date
Gina Peter Banyard
4d3ccc21d0 main: drop unnecessary zend_{try|catch} in user stream open wrapper
Some checks are pending
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 / LINUX_X32_DEBUG_ZTS (push) Has been skipped
Push / BENCHMARKING (push) Has been skipped
Push / FREEBSD (push) Has been skipped
This was initially introduced with 9f86cdaf7f

However, this should also have been done for the opendir call.
This omission was found via OSS-Fuzz 51047 [1]
and fixed in a more general way in d0b3096ff0
by resetting `FG(user_stream_current_filename)` at the end of the request during shutdown.

As such this zend_try/zend_catch block is now unnecessary.

[1]: https://issues.oss-fuzz.com/issues/42515581
2025-08-15 18:41:17 +02:00
Gina Peter Banyard
1c67b060c4 main: Add bailout tests for dir opening on user stream 2025-08-15 18:41:17 +02:00
Gina Peter Banyard
0992265611 main: refactor userstream method calling
Closes GH-19312
2025-08-15 18:41:17 +02:00
Alexandre Daubois
e5f81bd74c
spl: Use size_t to store spl_heap’s count (#19482)
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 / LINUX_X32_DEBUG_ZTS (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
2025-08-15 09:50:49 +02:00
David Carlier
b73d8b373a
Merge branch 'PHP-8.4' 2025-08-15 08:08:16 +01:00
David Carlier
fd4db3e178
Merge branch 'PHP-8.3' into PHP-8.4
Some checks are pending
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 / LINUX_X32_DEBUG_ZTS (push) Has been skipped
Push / BENCHMARKING (push) Has been skipped
Push / FREEBSD (push) Has been skipped
2025-08-15 08:05:14 +01:00
Mark Karpeles
987a3a5c8e
Fix GH-19484 i: potential use after free when using persistent pgsql connections.
Some checks are pending
Push / MACOS_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 / LINUX_X32_DEBUG_ZTS (push) Has been skipped
Push / BENCHMARKING (push) Has been skipped
Push / LINUX_X64_RELEASE_NTS (push) Has been skipped
Push / FREEBSD (push) Has been skipped
By setting the notice processor to a no-op when a persistent connection is cleaned for future use.

Close GH-19485
2025-08-15 08:04:14 +01:00
Niels Dossche
dcd3ef33b3
Realign entries 2025-08-15 08:41:56 +02:00
Niels Dossche
1bba07ecc0
partitioned option for setcookie/setrawcookie and sessions
RFC: https://wiki.php.net/rfc/CHIPS

Closes GH-12646.
Closes GH-12652.
2025-08-15 08:41:24 +02:00
Gina Peter Banyard
f9d95c649e Update NEWS and UPGRADING for chr() deprecation
Some checks are pending
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 / LINUX_X32_DEBUG_ZTS (push) Has been skipped
Push / BENCHMARKING (push) Has been skipped
Push / FREEBSD (push) Has been skipped
2025-08-14 20:51:30 +01:00
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
Tim Düsterhus
359f4420a4
Merge branch 'PHP-8.4'
Some checks are pending
Push / LINUX_X64_RELEASE_NTS (push) Has been skipped
Push / LINUX_X64_DEBUG_ZTS_ASAN (push) Has been skipped
Push / FREEBSD (push) Has been skipped
Push / MACOS_ARM64_DEBUG_NTS (push) Waiting to run
Push / WINDOWS_X64_ZTS (push) Waiting to run
Push / LINUX_X32_DEBUG_ZTS (push) Has been skipped
Push / BENCHMARKING (push) Has been skipped
* PHP-8.4:
  Update GitHub Action workflows to `actions/checkout@v5`
2025-08-13 19:10:23 +02:00
Tim Düsterhus
391d8132b6
Merge branch 'PHP-8.3' into PHP-8.4
Some checks are pending
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 / LINUX_X32_DEBUG_ZTS (push) Has been skipped
Push / BENCHMARKING (push) Has been skipped
Push / FREEBSD (push) Has been skipped
* PHP-8.3:
  Update GitHub Action workflows to `actions/checkout@v5`
2025-08-13 19:09:20 +02:00
Tim Düsterhus
fdd27472de
Merge branch 'PHP-8.2' into PHP-8.3
Some checks are pending
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_X64_DEBUG_ZTS_ASAN (push) Has been skipped
Push / LINUX_X32_DEBUG_ZTS (push) Has been skipped
Push / BENCHMARKING (push) Has been skipped
Push / FREEBSD (push) Has been skipped
* PHP-8.2:
  Update GitHub Action workflows to `actions/checkout@v5`
2025-08-13 19:08:30 +02:00
Tim Düsterhus
aa992f36d3
Merge branch 'PHP-8.1' into PHP-8.2
Some checks failed
Push / LINUX_X64_RELEASE_ZTS (push) Has been skipped
Push / LINUX_X32_DEBUG_ZTS (push) Failing after 1m16s
Push / LINUX_X64_DEBUG_NTS (push) Has been skipped
Push / FREEBSD (push) Has been skipped
Push / MACOS_DEBUG_NTS (push) Has been cancelled
Push / WINDOWS_X64_ZTS (push) Has been cancelled
* PHP-8.1:
  Update GitHub Action workflows to `actions/checkout@v5`
2025-08-13 19:08:06 +02:00
Tim Düsterhus
2650248a92
Update GitHub Action workflows to actions/checkout@v5
Some checks failed
Push / LINUX_X64_RELEASE_ZTS (push) Has been skipped
Push / LINUX_X64_DEBUG_NTS (push) Has been skipped
Push / FREEBSD (push) Has been skipped
Push / MACOS_DEBUG_NTS (push) Has been cancelled
Push / WINDOWS_X64_ZTS (push) Has been cancelled
Keep this up to date in all non-security-only branches, because the node.js
runtime for older versions might get deprecated in the future and fixing this
for all branches at once is easier.

see 45e60e585e
2025-08-13 19:06:09 +02:00
Dmitry Stogov
222f7517a1
Merge branch 'PHP-8.4'
* PHP-8.4:
  Added test for PR #19458
2025-08-13 15:59:57 +03:00
Dmitry Stogov
cbb9ee8f5b
Added test for PR #19458
Thanks to @DanielEScherzer
2025-08-13 15:58:04 +03:00
Ilija Tovilo
fd8dfe1bfd
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16649: Avoid UAF when using array_splice
2025-08-13 14:16:50 +02:00
Ilija Tovilo
7e01cf59bb
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16649: Avoid UAF when using array_splice
2025-08-13 14:16:12 +02:00
Alexandre Daubois
c8774f9e61
Fix GH-16649: Avoid UAF when using array_splice
Closes GH-19399
2025-08-13 14:15:34 +02:00
Alexandre Daubois
bf64dfcd99
Add an enum for HASH_KEY_IS_* constants (GH-19376) 2025-08-13 13:59:01 +02:00
Dmitry Stogov
290c9aef56
Eliminate useless spill stores (#19467) 2025-08-13 13:46:14 +03:00
Calvin Buckley
60047025db
Remove references to ODBCVER and assume ODBC 3.x (#19453)
* Remove references to ODBCVER and assume ODBC 3.x

See https://wiki.php.net/rfc/deprecations_php_8_5#remove_support_for_older_odbc_versions

* Avoid calling deprecated ODBC functions

`SQLGetConnectOption`, `SQLSetConnectOption` and `SQLSetStmtOption` are
deprecated, so if ODBC 3 is available, we use `SQLSetConnectAttr`,
`SQLGetConnectAttr`, and `SQLSetStmtAttr` instead.

(This is based on GH-17556, but just assumes ODBC 3.x.)

* Remove wrappers for SQLColAttribute

We don't need to support the old way of doing it.

* Just call SQLAllocHandle directly

Again, no need for the version specific wrapper

* Update NEWS for ODBCVER in beta2

* [skip ci] UPGRADING for ODBCVER changes

---------

Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>
2025-08-12 18:05:43 -03:00
Niels Dossche
77dace78c3
[ci skip] Fix UPGRADING formatting 2025-08-12 22:35:47 +02:00
Niels Dossche
841f0b1515
Remove dead error checks for php_stream_filter_alloc() (#19194)
php_stream_filter_alloc() can't fail, so simplify the code.
2025-08-12 22:18:39 +02:00
Jakub Zelenka
ba97d8636a
Merge branch 'PHP-8.4'
Some checks are pending
Push / WINDOWS_X64_ZTS (push) Waiting to run
Push / MACOS_ARM64_DEBUG_NTS (push) Waiting to run
Push / BENCHMARKING (push) Has been skipped
Push / FREEBSD (push) Has been skipped
Push / LINUX_X64_RELEASE_NTS (push) Has been skipped
Push / LINUX_X64_DEBUG_ZTS_ASAN (push) Has been skipped
Push / LINUX_X32_DEBUG_ZTS (push) Has been skipped
2025-08-12 17:30:07 +02:00
Jakub Zelenka
c8a4207400
Merge branch 'PHP-8.3' into PHP-8.4
Some checks are pending
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 / LINUX_X32_DEBUG_ZTS (push) Has been skipped
Push / BENCHMARKING (push) Has been skipped
Push / FREEBSD (push) Has been skipped
2025-08-12 17:29:18 +02:00
Jakub Zelenka
2b415e416e
Fix GH-19245: Success error message on TLS stream accept failure
Some checks are pending
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_X64_DEBUG_ZTS_ASAN (push) Has been skipped
Push / LINUX_X32_DEBUG_ZTS (push) Has been skipped
Push / BENCHMARKING (push) Has been skipped
Push / FREEBSD (push) Has been skipped
This overwrites the previous message from the successful accept call.

Closes GH-19246
2025-08-12 17:28:33 +02:00
Eric Mann
b9ae9845ad
Merge branch 'PHP-8.4'
* PHP-8.4:
  PHP-8.3 is now for PHP 8.3.26-dev
2025-08-12 08:19:01 -07:00
Eric Mann
4aa43e2cd3
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  PHP-8.3 is now for PHP 8.3.26-dev
2025-08-12 08:17:38 -07: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
2f9e1adbdd
Merge branch 'PHP-8.4'
* PHP-8.4:
  PHP-8.4 is now for PHP 8.4.13-dev
2025-08-12 23:49:46 +09:00
Saki Takamachi
b7c26eb16c
PHP-8.4 is now for PHP 8.4.13-dev 2025-08-12 23:46:26 +09:00
Volker Dusch
fb7db498fb
[ci skip] Update NEWS for PHP 8.5.0 beta1 2025-08-12 16:31:18 +02:00
Jakub Zelenka
20c8c12d9e
Fix #81724: openssl_cms_encrypt only allows specific ciphers
The allows cipher_algo to be specified as a string. It means the not
only predefined ID ciphers are available which means that also auth
enveloped data can be created using AES GCM.

Closes GH-19459
2025-08-12 15:52:09 +02: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
c3bee21256
NEWS/UPGRADING for recent deprecations 2025-08-12 06:05:09 -07: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
ffdc1044c9
[RFC] Deprecate ReflectionClass::getConstant() for missing constants (#19456)
https://wiki.php.net/rfc/deprecations_php_8_5
2025-08-12 05:50:20 -07:00
Daniel Scherzer
a68f3d6374
[RFC] Deprecate imagedestroy() (#19454)
https://wiki.php.net/rfc/deprecations_php_8_5
2025-08-12 05:50:09 -07:00
Daniel Scherzer
699e5632b1
[RFC] Deprecate curl_share_close() (#19452)
https://wiki.php.net/rfc/deprecations_php_8_5
2025-08-12 05:49:52 -07:00
Daniel Scherzer
9b13bb1ae4
[RFC] Deprecate curl_close() (#19451)
https://wiki.php.net/rfc/deprecations_php_8_5
2025-08-12 05:44:41 -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
Ilija Tovilo
65c961436d
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Add timeout for FreeBSD
2025-08-12 14:19:11 +02:00
Ilija Tovilo
571bded46e
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [skip ci] Add timeout for FreeBSD
2025-08-12 14:19:04 +02:00
Ilija Tovilo
347723af05
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  [skip ci] Add timeout for FreeBSD
2025-08-12 14:18:53 +02:00
Ilija Tovilo
0c044b35b7
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  [skip ci] Add timeout for FreeBSD
2025-08-12 14:18:44 +02:00
Ilija Tovilo
abb7f2879e
[skip ci] Add timeout for FreeBSD
Unfortunately, these jobs routinely fail to boot correctly. In this case,
they'll stall and block CI for 6 hours until they finally fail. Add a limit to
make them fail earlier.
2025-08-12 14:17:33 +02:00
Gina Peter Banyard
2b5d978a85
Update NEWS and UPGRADING 2025-08-12 11:53:37 +01:00
Jorg Adam Sowa
25cbc15719
RFC: Deprecate date constant RFC7231 (#12989)
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_date_rfc7231_and_datetimeinterfacerfc7231
2025-08-12 11:33:38 +01: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
Dmitry Stogov
07a9c25c71
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix Nightly workflow Symfony assertion (ir_ra.c:326: ir_fix_live_range: Assertion `ival && p->start == old_start' failed) (#19458)
2025-08-12 11:59:26 +03:00
Dmitry Stogov
47f9f3a3f6
Fix Nightly workflow Symfony assertion (ir_ra.c:326: ir_fix_live_range: Assertion `ival && p->start == old_start' failed) (#19458) 2025-08-12 11:59:08 +03: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
Jakub Zelenka
10834d1572
Fix #47728: Add missing openssl constants
This adds PKCS7_NOSMIMECAP, PKCS7_CRLFEOL, PKCS7_NOCRL and
PKCS7_NO_DUAL_CONTENT constants. They might be potentially useful
in some scenarious.

Test is not added as it is not clear if there is much need for those and
it would require much bigger effort just to test OpenSSL functionality.

Closes GH-19450
2025-08-11 20:46:14 +02:00
Jakub Zelenka
c5f79b8cf9
Use OpenSSL libctx for various BIO readers (#19448)
This converts mostly PEM readers but also DER for CMS
2025-08-11 18:21:38 +02:00
Daniel Scherzer
6280dfc025
UPGRADING: document #[\Attribute] validation from GH-19154
[skip ci]
2025-08-11 09:17:06 -07: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
Tim Düsterhus
d01aa02ef5
UPGRADING: Fix formatting 2025-08-11 13:42:52 +02:00
Jakub Zelenka
702d18de99
Implement #80495: Enable to set padding in openssl_(sign|verify)
This adds support for RSA PSS padding.

Closes GH-19432
2025-08-11 13:11:10 +02:00
Niels Dossche
8f1a627e79
Merge branch 'PHP-8.4'
* PHP-8.4:
  Backport Lexbor changes to 8.4
2025-08-10 14:21:47 +02:00
Niels Dossche
91665eaa63
Backport Lexbor changes to 8.4 2025-08-10 14:17:19 +02:00
Niels Dossche
33d38d059e
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-19383: php-8.3.24: Missing type in function definition: fpm_event_kqueue_clean
2025-08-10 13:25:47 +02:00
Niels Dossche
19ffe572bb
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-19383: php-8.3.24: Missing type in function definition: fpm_event_kqueue_clean
2025-08-10 13:25:42 +02:00
Niels Dossche
b57578f3b1
Fix GH-19383: php-8.3.24: Missing type in function definition: fpm_event_kqueue_clean
This is just a clean backport.
2025-08-10 13:25:24 +02:00
Niels Dossche
fc86c249dc
Sync with lexbor/lexbor@49b43eba41 (#19442) 2025-08-10 13:16:39 +02:00
Niels Dossche
aecf2a6e62
Fix GH-18877: \Dom\HTMLDocument querySelectorAll selecting only the first when using ~ and :has
Backports lexbor/lexbor@971faf11a5

Closes GH-19180.
2025-08-10 13:07:13 +02:00
Gina Peter Banyard
e990b691c5
Update NEWS and UPGRADING for recent deprecation merges 2025-08-09 23:12:05 +01:00
Gina Peter Banyard
284e622506
ext/openssl: Deprecate $key_length parameter of openssl_pkey_derive() (#19421)
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_key_length_parameter_of_openssl_pkey_derive
2025-08-09 22:55:53 +01:00
Jakub Zelenka
731d36ac61
Fix OpenSSL fetching of alias ciphers
This does not seem like an issue as the aliases seem to be already
fetched most of the time. But there might be cases when it could be
failing like it was failing for MD in GH-19369.

It should be noted that the test does not fail without this change but
it seems useful anyway so it is added as part of this change. I
actually have not found the case where alias is not fetched for cipher
but there might be some.

Closes GH-19437
2025-08-09 23:03:26 +02:00
Jakub Zelenka
066a977840
Clean up test for GH-19369 - openssl_sign issue 2025-08-09 23:02:46 +02:00
Jakub Zelenka
c8d7318daf
Fix GH-19369: openssl_sign() - support for alias digest algs broken
Closes GH-19436
2025-08-09 22:06:59 +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
dc0962c243
ext/standard: Deprecate passing null to readdir(), rewinddir(), and closedir() (#19423)
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_passing_null_to_readdir_rewinddir_and_closedir
2025-08-09 18:08:21 +01:00
Gina Peter Banyard
ba21ab4ea0
ext/finfo: Deprecate the parameter for finfo_buffer() (#19378)
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_the_context_parameter_for_finfo_buffer
2025-08-09 17:42:19 +01:00
Jakub Zelenka
c064fc4fe8
Fix php_openssl_pkey_derive merge issue 2025-08-09 18:25:42 +02:00
Jakub Zelenka
75931a2ce3
Merge branch 'PHP-8.4' 2025-08-09 18:02:10 +02:00
Jakub Zelenka
f52a59ff4f
Merge branch 'PHP-8.3' into PHP-8.4 2025-08-09 17:44:25 +02:00
Jakub Zelenka
9e2aa658a8
Fix GH-19428: openssl_pkey_derive segfaults for DH derive with low key_length
This happens only for OpenSSL 1.1.1 because key_length is ignored for
DH. It means that the provided string is overwritten with longer buffer.
2025-08-09 17:43:04 +02:00
Gina Peter Banyard
69f67f990d
ext/intl: Deprecate intl.error_level INI setting (#19430)
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_intlerror_level_ini_setting
2025-08-09 16:28:47 +01:00
David CARLIER
2bb98cd8c8
ext/int: IntlTimeZone converting few intl error to exceptions. (#13477) 2025-08-09 12:50:35 +01:00
Alexandre Daubois
74c006fbab
Use proper hash_spec_result enum for return values in ext/hash (#19386) 2025-08-09 12:56:40 +02:00
Gina Peter Banyard
d65025b53d
Update NEWS/UPGRADING for recent commits 2025-08-09 11:49:42 +01: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
1e108e9ab2
ext/intl: wrap DateTimeZone constructor exception in an IntlException (#19410)
The motivation is two fold:
- Userland code that deals with ext/intl can be expected to handle IntlException but not necessarily ext/date exceptions
- This removes the possibility of superfluous warnings being emitted by ext/intl when an exception has already been thrown
2025-08-09 11:24:11 +01:00
Gina Peter Banyard
8c5c03e33a
ext/spl: Deprecate passing spl_autoload_call() to spl_autoload_unregister() (#19422)
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_passing_spl_autoload_call_to_spl_autoload_unregister
2025-08-09 11:23: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
Alexandre Daubois
7bf79ab666
Make spl_filesystem_dir_read() return void (#19419) 2025-08-08 22:14:07 +01:00
Gina Peter Banyard
7b44bfd812
UPGRADING and NEWS for recent 8.5 deprecations 2025-08-08 21:45:02 +01:00
Tim Düsterhus
ccb716dcad
fileinfo: Deprecate finfo_close() (#18396)
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_finfo_close
2025-08-08 21:25:13 +01:00
Tim Düsterhus
922c225fbf
reflection: Deprecate Reflection*::setAccessible() (#19273)
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_reflectionsetaccessible
2025-08-08 21:24:41 +01:00
Tim Düsterhus
732069d98b
pdo: Deprecate the uri: DSN scheme (#19274)
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_pdo_s_urischeme
2025-08-08 21:24:15 +01:00
Tim Düsterhus
21625006e5
standard: Deprecate socket_set_timeout() (#19285)
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#formally_deprecate_socket_set_timeout
2025-08-08 21:23:48 +01:00
Tim Düsterhus
5d86515772
mysqli: Deprecate mysqli_execute() (#19286)
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#formally_deprecate_mysqli_execute
2025-08-08 21:23:31 +01: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
43a91089ca
ext/intl: Refactor timezone parameter passing (#19409) 2025-08-08 21:12:43 +01:00
Niels Dossche
be2889411a
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-19397: mb_list_encodings() can cause crashes on shutdown
2025-08-08 20:33:00 +02:00
Niels Dossche
db3f6d0bf0
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-19397: mb_list_encodings() can cause crashes on shutdown
2025-08-08 20:32:55 +02:00
Niels Dossche
cc93bbb765
Fix GH-19397: mb_list_encodings() can cause crashes on shutdown
The request shutdown does not necessarily hold the last reference, if
there is still a CV that refers to the array.

Closes GH-19405.
2025-08-08 20:32:29 +02:00
Niels Dossche
99e6b0ecc8
Use stack allocation in timezone_initialize() (#19394)
This lives temporarily, avoid overhead and handling of heap allocation.
2025-08-08 20:29:39 +02:00
Alexandre Daubois
9673079903
Fix GH-18404: Display diff when a single test is run (GH-19400) 2025-08-08 19:16:32 +02:00
Arnaud Le Blanc
e4078a6a70
Disable opcache if no SHM backend is available
Currently, configure fails when no SHM backend is available. Additionally,
even after bypassing the configure check, opcache emits a fatal error if no
SHM backend is available.

Make the configure check non-fatal (a warning is printed). At runtime, disable
opcache if no backend is available, in the same way we disable opcache by
default on CLI.

Closes GH-19350
2025-08-08 14:41:37 +02:00
Gina Peter Banyard
fe88711b14
ext/intl: Use ZPP specifier for IntlTimeZone::createEnumeration() (#19393)
The existing code is extremely convoluted, incorrectly documented, and does not follow the usual semantics
2025-08-07 22:37:16 +01:00
David CARLIER
140fc69b4a
ext/intl: update from C to C++ step2. (#19294) 2025-08-07 22:36:34 +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
Gina Peter Banyard
1f131e3ae6
[skip ci] ext/sockets: remove tests that leak memory (#19408)
I don't understand what the purposes of theses tests are.
2025-08-07 21:50:04 +01:00
Niels Dossche
a3f34043de
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-19371: integer overflow in calendar.c
2025-08-07 19:09:03 +02:00
Niels Dossche
11e6655624
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-19371: integer overflow in calendar.c
2025-08-07 19:08:58 +02:00
Niels Dossche
5cf45ba5ab
Fix GH-19371: integer overflow in calendar.c
Closes GH-19380.
2025-08-07 19:08:32 +02:00
Gina Peter Banyard
43420599f7
ext/intl: better errors for IntlTimeZone::createTimeZoneIDEnumeration (#19395)
IntlTimeZone::createTimeZoneIDEnumeration

And convert those to ValueErrors directly as they are bugs
2025-08-07 13:52:03 +01:00
Gina Peter Banyard
ca5667bc14
ext/intl: prevent creation of invalid UConverter instance (#19396) 2025-08-07 13:46:58 +01:00
Ilija Tovilo
abe75ca850
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix ERROR_CODE handling in COMMUNITY build
2025-08-07 13:56:19 +02:00
Ilija Tovilo
db5a3956f5
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix ERROR_CODE handling in COMMUNITY build
2025-08-07 13:56:12 +02:00
Ilija Tovilo
aae35f3617
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix ERROR_CODE handling in COMMUNITY build
2025-08-07 13:56:06 +02:00
Ilija Tovilo
080ba20d49
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix ERROR_CODE handling in COMMUNITY build
2025-08-07 13:55:59 +02:00
Ilija Tovilo
2cd9233e42
Fix ERROR_CODE handling in COMMUNITY build
We need || because a non-0 return from the application aborts the execution of
the job.
2025-08-07 13:54:55 +02:00
Arnaud Le Blanc
17826d31c6
Merge branch 'PHP-8.4'
* PHP-8.4:
  zend call stack fixing stack limit for macOs arm64.
2025-08-07 08:42:03 +02:00
Arnaud Le Blanc
58501bd136
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  zend call stack fixing stack limit for macOs arm64.
2025-08-07 08:41:24 +02: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
Arnaud Le Blanc
d1fceeec30
Check stack limit in fuzzer executor
The stack limit is checked when entering execute_ex(), but the fuzzer has
its own execute function and does not call execute_ex().

Add a stack limit check in the fuzzer's execute function.

Closes GH-19391
2025-08-07 08:32:02 +02:00
Gina Peter Banyard
c42e6d62d8
ext/intl: modernize tests (#19392)
This is effectively removing ZPP tests, enabling warnings, and moving INI settings into the INI PHPT block
2025-08-06 23:33:48 +01:00
Gina Peter Banyard
3fc0149325
[skip ci] drop invalid IntlDateFormat construction error test
The date.timezone INI setting defaults to UTC if an invalid value is provided, meaning that we construct a valid object with timezone UTC.
2025-08-06 22:15:06 +01:00
Ilija Tovilo
77eac5ec82
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Bump retries in benchmark diff when looking for benchmarked commits
2025-08-06 22:29:49 +02:00
Ilija Tovilo
0c303b2043
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [skip ci] Bump retries in benchmark diff when looking for benchmarked commits
2025-08-06 22:29:36 +02:00
Ilija Tovilo
44618752f9
[skip ci] Bump retries in benchmark diff when looking for benchmarked commits 2025-08-06 22:28:56 +02:00
Ilija Tovilo
c69f04dbab
Fix borked test 2025-08-06 22:25:14 +02:00
Gina Peter Banyard
aa9694bdd0
ext/date: null bytes in timezones can only happen via HT initialization (#19357)
Thus check this error condition early in the HT initialization code.
2025-08-06 21:02:25 +01:00
Arnaud Le Blanc
7af4709d38
Fix test 2025-08-06 19:57:32 +02:00
Arnaud Le Blanc
c105571052
Fix test 2025-08-06 19:55:56 +02:00
Arnaud Le Blanc
b7ac56822d
Fix build 2025-08-06 19:50:11 +02:00
Arnaud Le Blanc
32290b3529
Add opcache_preloading() internal function
Add a C function, opcache_preloading(), that returns true during
preloading. Extensions can use this to detect preloading, not only during
compilation/execution, but also in RINIT()/RSHUTDOWN().

Since opcache currently doesn't install any header, I'm adding a new one:
zend_accelerator_api.h. Header name is based on other files in ext/opcache.

Closes GH-19288
2025-08-06 18:21:19 +02:00
Arnaud Le Blanc
3088d64068
Remove the Opcache SAPI whitelist
Closes GH-19351
2025-08-06 18:14:10 +02:00
Arnaud Le Blanc
3ddbad9589
Allocate a fast thread-safe-resource id for opcache
Closes GH-19347
2025-08-06 18:02:43 +02:00
Gina Peter Banyard
5583273906 ext/ldap: Use size_t type instead of int type 2025-08-06 16:36:13 +01:00
Gina Peter Banyard
61790eb8a0 ext/ldap: Use uint32_t type instead of int type 2025-08-06 16:36:13 +01:00
Gina Peter Banyard
9af00b174a ext/ldap: Use bool type instead of int type 2025-08-06 16:36:13 +01:00
Gina Peter Banyard
53fde8b5a8 ext/ldap: Remove useless variable 2025-08-06 16:36:13 +01:00
Gina Peter Banyard
b5fb9555e1 ext/ldap: Reduce scope of variable 2025-08-06 16:36:13 +01:00
Gina Peter Banyard
1c820750da ext/ldap: Add static specifier for private function 2025-08-06 16:36:13 +01:00
Gina Peter Banyard
2e53aef1e8 ext/ldap: Remove unused include statement 2025-08-06 16:36:13 +01:00
Ilija Tovilo
e30a8a883f
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Fix Symfony COMMUNITY build for new phpunit version
2025-08-06 15:10:23 +02:00
Ilija Tovilo
c3467bd173
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [skip ci] Fix Symfony COMMUNITY build for new phpunit version
2025-08-06 15:10:17 +02:00
Ilija Tovilo
3aa4209ef6
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  [skip ci] Fix Symfony COMMUNITY build for new phpunit version
2025-08-06 15:10:07 +02:00
Ilija Tovilo
a8cea0c09b
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  [skip ci] Fix Symfony COMMUNITY build for new phpunit version
2025-08-06 15:10:01 +02:00
Ilija Tovilo
0ac37fb74d
[skip ci] Fix Symfony COMMUNITY build for new phpunit version
--exclude-group no longer accepts a comma-separated list. Doc block comments are
no longer supported, switch to attributes.
2025-08-06 15:07:45 +02:00
Ilija Tovilo
81c0aeaf5d
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Skip segfaulting OOM test in GH actions on Win
2025-08-06 14:29:46 +02:00
Ilija Tovilo
0b1aa86c71
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [skip ci] Skip segfaulting OOM test in GH actions on Win
2025-08-06 14:29:36 +02:00
Ilija Tovilo
5be04e25fd
[skip ci] Skip segfaulting OOM test in GH actions on Win
This only fails on the PHP-8.3 branch, most likely to be related to the
environment as discussed with Niels.
2025-08-06 14:28:47 +02:00
Ilija Tovilo
63cb81ff2c
Merge branch 'PHP-8.4'
* PHP-8.4:
  COMMUNTIY build grouping adjustments
2025-08-06 14:20:39 +02:00
Ilija Tovilo
d628ed5963
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  COMMUNTIY build grouping adjustments
2025-08-06 14:20:32 +02:00
Gina Peter Banyard
1e0c8baf05
tree: drop non canonical casts and ZPP tests 2025-08-06 13:20:28 +01:00
Ilija Tovilo
bf6a74d2f9
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  COMMUNTIY build grouping adjustments
2025-08-06 14:20:26 +02:00
Ilija Tovilo
9cbc09d189
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  COMMUNTIY build grouping adjustments
2025-08-06 14:20:17 +02:00
Ilija Tovilo
a63e97667e
COMMUNTIY build grouping adjustments
Unconditionally execute assignment of EXIT_CODE. Otherwise, the variable bleeds
into the next iteration. Also add newline before ::endgroup::. ASAN does not add
a trailing newline.
2025-08-06 14:18:43 +02:00
Ilija Tovilo
14034ad734
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Add fuzzer binaries to .gitignore
2025-08-06 14:01:32 +02:00
Ilija Tovilo
e7c8361089
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [skip ci] Add fuzzer binaries to .gitignore
2025-08-06 14:01:25 +02:00
Ilija Tovilo
c286cb8a1e
[skip ci] Add fuzzer binaries to .gitignore 2025-08-06 14:00:44 +02:00
Shivam Mathur
4a934005b4
Fix Windows test for openssl-3.5 upgrade (#19384)
* Fix Windows test for openssl-3.5 upgrade

* Update ext/openssl/tests/check_default_conf_path.phpt

Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>

---------

Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>
2025-08-06 16:11:38 +05:30
Derick Rethans
a9ab62d54d
Add a brief section on options to the test runner, and -j 2025-08-06 10:05:27 +01:00
Derick Rethans
0c82801384
Setting TEST_PHP_EXECUTABLE hasn't been necessary for ages. 2025-08-06 09:48:46 +01:00
Shivam Mathur
1820dd9b61 Merge branch 'PHP-8.4' 2025-08-06 00:05:47 +00:00
Shivam Mathur
6147be32fc Merge branch 'PHP-8.3' into PHP-8.4 2025-08-06 00:05:28 +00:00
Shivam Mathur
f08ac4f1c9 Merge branch 'PHP-8.2' into PHP-8.3 2025-08-06 00:04:58 +00:00
Shivam Mathur
871de14ceb Merge branch 'PHP-8.1' into PHP-8.2 2025-08-06 00:03:49 +00:00
Shivam Mathur
8199cad99f
Fix master branch check in find-target-branch.bat (#19385) 2025-08-06 05:32:36 +05:30
David CARLIER
d801a4634f
Fixed GH-19381: posix_kill_pidoverflow test depends on pcntl too. (#19382) 2025-08-05 20:03:21 +01:00
David CARLIER
9ccd2ba9ff
Fixed GH-19163 fix ext/intl build on midly older compilers but still supporting C++11. (#19353) 2025-08-05 19:09:37 +01:00
Gina Peter Banyard
5b3d0e4c09 ext/json: Refactor php_json_encode_array()
Stop relying on internal flags which were published in the header
Use a more descriptive variable name and have it be a boolean
2025-08-05 18:21:15 +01:00
Gina Peter Banyard
17328ef86b ext/json: Various small refactorings 2025-08-05 18:21:15 +01:00
Gina Peter Banyard
d9000b3094
tree: replace some unnecessary uses of spprintf (#19354) 2025-08-05 17:25:47 +01:00
Ilija Tovilo
0596135d20
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Group component output in community job
2025-08-05 15:44:36 +02:00
Ilija Tovilo
fbc705c3bd
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [skip ci] Group component output in community job
2025-08-05 15:44:21 +02:00
Ilija Tovilo
cdfd663266
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  [skip ci] Group component output in community job
2025-08-05 15:44:07 +02:00
Ilija Tovilo
dde094a442
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  [skip ci] Group component output in community job
2025-08-05 15:43:58 +02:00
Ilija Tovilo
1c65cc3998
[skip ci] Group component output in community job 2025-08-05 15:43:46 +02: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
d8e014dfbe
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Add zend_jit_arm64.c to gitignore
2025-08-04 23:12:48 +02:00
Ilija Tovilo
9f800aedfe
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [skip ci] Add zend_jit_arm64.c to gitignore
2025-08-04 23:12:33 +02:00
Ilija Tovilo
bfd42b060d
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  [skip ci] Add zend_jit_arm64.c to gitignore
2025-08-04 23:12:22 +02:00
Ilija Tovilo
f077c9d233
[skip ci] Add zend_jit_arm64.c to gitignore
This is not generated in CI since moving to macOS 14, which is arm based.
2025-08-04 23:12:09 +02:00
Ilija Tovilo
541a1e69d5
Merge branch 'PHP-8.4'
* PHP-8.4:
  Upgrade to macOS 14 and backport necessary changes
2025-08-04 22:21:58 +02:00
Ilija Tovilo
44d63a8ac0
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Upgrade to macOS 14 and backport necessary changes
2025-08-04 22:21:21 +02:00
Ilija Tovilo
234159d911
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Upgrade to macOS 14 and backport necessary changes
2025-08-04 22:20:06 +02:00
Ilija Tovilo
7ba4453f8f
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Upgrade to macOS 14 and backport necessary changes
2025-08-04 22:19:59 +02:00
Ilija Tovilo
e9e432a35d
Upgrade to macOS 14 and backport necessary changes 2025-08-04 22:12:30 +02:00
Ilija Tovilo
0d15bca041
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix filtering of INI directives to respect leading whitespaces
2025-08-04 16:56:59 +02:00
Ilija Tovilo
bd7ffc911d
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix filtering of INI directives to respect leading whitespaces
2025-08-04 16:56:51 +02:00
Arndt Kaiser
9d29283392
Fix filtering of INI directives to respect leading whitespaces
Directives are now correctly filtered out if the line in the php.ini
file begins with whitespace characters.

Closes GH-19348
2025-08-04 16:55:46 +02:00
Gina Peter Banyard
4d5bdef21a streams: refactor statbuf_from_array() 2025-08-04 15:30:57 +01:00
Gina Peter Banyard
9e334af6e4 streams: use type php_socket_t instead of type int 2025-08-04 15:30:57 +01:00
Gina Peter Banyard
a02b2b8eb6 streams: use %zu printf specifier for size_t
Rather than casting to zend_long
2025-08-04 15:30:57 +01:00
Gina Peter Banyard
051414bec6 streams: use an enum for return type of _php_stream_make_seekable() 2025-08-04 15:30:57 +01:00
Gina Peter Banyard
93ec0ac0f3 streams: drop unused includes 2025-08-04 15:30:57 +01:00
Gina Peter Banyard
fa85b38560 streams: voidify php_stream_filter_prepend_ex()
This only ever returned SUCCESS
2025-08-04 15:30:57 +01:00
Gina Peter Banyard
cd13ba73e2 streams: use RETURN_BOOL() when possible 2025-08-04 15:30:57 +01:00
Gina Peter Banyard
b46c5e6186 streams: refactor implementation of stream_select() 2025-08-04 15:30:57 +01:00
Gina Peter Banyard
c50a715a5c streams: remove useless casts 2025-08-04 15:30:57 +01:00
Gina Peter Banyard
0d0f774a6a streams: use call in if statement directly 2025-08-04 15:30:57 +01:00
Gina Peter Banyard
fb2585f4e2 streams: use -1 directly instead of FAILURE macro
The result of the functions returning those globals is never checked anyway
2025-08-04 15:30:57 +01:00
Gina Peter Banyard
4b6ebcc6e9 streams: remove confusing step variable 2025-08-04 15:30:57 +01:00
Gina Peter Banyard
02af9acfca streams: use precomputed persistant variable 2025-08-04 15:30:57 +01:00
Gina Peter Banyard
67d6160462 streams: use int type instead of long
The flags variable is passed to the filter virtual function that requires an int
2025-08-04 15:30:57 +01:00
Gina Peter Banyard
c9836b03ce streams: use type size_t instead of type unsigned int 2025-08-04 15:30:57 +01:00
Gina Peter Banyard
841afdc486 streams: use type zend_result instead of type int 2025-08-04 15:30:57 +01:00
Gina Peter Banyard
b3551cc31f streams: use type bool instead of type int 2025-08-04 15:30:57 +01:00
Gina Peter Banyard
b35dbe474e streams: reduce scope of variables 2025-08-04 15:30:57 +01:00
Gina Peter Banyard
17b8706bf6 streams: add const specifier 2025-08-04 15:30:57 +01:00
Dmitry Stogov
ef98a6e723
Merge branch 'PHP-8.4'
* PHP-8.4:
  Update IR
2025-08-04 17:26:46 +03:00
Dmitry Stogov
ac1cd9c26e
Update IR
IR commit: 6e2aea0ebfef2c741ebec30c57aa492df0d4e319
2025-08-04 17:26:24 +03:00
Alexandre Daubois
433c00b348
[skip ci] tree: Fix various typos (#19366) 2025-08-04 15:15:52 +01:00
Ilija Tovilo
cd80ed6f7b
Implement changes to GH-17951 according to ML discussion 2025-08-04 16:04:25 +02:00
Frederik Milling Pytlick
4e21924271
Fix GH-17951: Addition of max_memory_limit INI
Closes GH-18011
2025-08-04 16:04:25 +02:00
Arnaud Le Blanc
9aa8e8825f
Remove zend_jit_vm_kind (#19299)
JIT used to not have a compile-time dependency on VM kind, such that a single
build of opcache could work with different VM kinds at runtime. This has been broken
over time and would be difficult to restore. Additionally, as opcache is now
built-in, this would not be useful anymore.

Remove the zend_jit_vm_kind variable.
2025-08-04 15:52:09 +02:00
Máté Kocsis
98e0dbcefe
Opcache is always available in the previous commit of the real time benchmark
Now that there's one measured run after opcache is always enabled, we can change the PHP_OPCACHE back to 1.
2025-08-03 21:00:19 +02:00
Gina Peter Banyard
a66b631bce
main/php_ini: various minor refactorings (#19339) 2025-08-03 17:30:12 +01:00
Gina Peter Banyard
961412d6f2
main: refactor implementation of set_time_limit() (#19338) 2025-08-03 16:17:00 +01:00
Alexandre Daubois
345e04b619
[skip ci] Fix typos in NEWS, UPGRADING and UPGRADING.INTERNALS (#19341) 2025-08-02 20:36:39 +02:00
Máté Kocsis
55a3e33bb1
Do not allow concurrent runs of the real time benchmark
Closes GH-19345
2025-08-01 11:38:30 +02:00
Máté Kocsis
776d6f8660
Add valgrind instruction count meansurement support to manual benchmark flow 2025-08-01 11:34:31 +02:00
Máté Kocsis
e8f88e746b
Fixes the real time benchmark
First of all, the last successful build had been before opcache was made required - therefore the PHP_OPCACHE setting should be 2 to manually enable it.

Then, the manual flow should comment on the PR of the triggering repo (github.repository), not the repo of the benchmarked code (env.REPOSITORY).
2025-08-01 10:12:38 +02:00
Daniel Scherzer
6f630a882d
NEWS/UPGRADING: fix missing __ in __toString()
Forgotten by yours truly in 36ae82b73e

[skip ci]
2025-07-31 17:38:23 -07: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
Gina Peter Banyard
2c4d4a6f18
ext/odbc: various minor refactorings (#19337) 2025-07-31 23:56:27 +01:00
Calvin Buckley
18dee43e02
Add SAPI_HEADER_DELETE_PREFIX, make ext/session use it (#18678)
* Add SAPI_HEADER_DELETE_PREFIX operation

The session ext currently munges into the linked list of headers
itself, because the delete header API is given the key for headers to
delete. The session ext wants to use a prefix past the colon separator,
for i.e. "Set-Cookie: PHPSESSID=", to eliminate only the specific cookie
rather than all cookies.

This changes the SAPI code to add a new header op to take a prefix
instead. Call sites are yet unchanged. Also fix some whitespace.

* Simplify cookie setting code in ext/session

Use the modern SAPI header ops API, including the remove prefix op we
just added.

* [ci skip] Remove redundant and unnecessary comment

The purpose of this is clear, and after refactoring, the special case is
no longer there, so it has no value.

* Un-deprecate simple add/replace header API, use it

Suggestion from Jakub.

* Restore the optimization removing session cookies had

I don't think this needs to be special cased with the parameter.

* Move setting header length to caller

Suggestion from Jakub.

* [ci skip] adjust tab count

It may be better to use spaces in here instead.

* Use session_cookie_len rather than calling strlen
2025-07-31 19:52:04 -03: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
Gina Peter Banyard
65b9cf1db3
ext/standard/proc_open.c: Minor refactorings (#18085)
Add const modifier
Use unsigned types when the source type is unsigned
Use HashTable instead of zvals where possible
2025-07-31 23:02:35 +01:00
Máté Kocsis
ada10741b4
Add support for manually running the real-time benchmark on PRs (#19265)
[skip-ci]
2025-07-31 22:51:38 +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
Gina Peter Banyard
dad28a30f3
main: pack _php_netstream_data_t and use bool instead of int type (#19331)
Fix use sites at the same time
2025-07-31 19:56:38 +01:00
Niels Dossche
0591defd6f
Merge branch 'PHP-8.4'
* PHP-8.4:
  Remove dynamic defs from property hooks
  Add missing hooks JIT restart code
2025-07-31 20:22:20 +02:00
Niels Dossche
771bfaf34d
Remove dynamic defs from property hooks
Otherwise this hits an assertion failure in pass2 reversal and causes a
subsequent crash.

Closes GH-19206.
2025-07-31 20:22:11 +02:00
Niels Dossche
9ce51dad8b
Add missing hooks JIT restart code
Closes GH-19207.
2025-07-31 20:21:40 +02:00
Niels Dossche
cee8ed235a
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-19300: Nested array_multisort invocation with error breaks
2025-07-31 19:01:28 +02:00
Niels Dossche
b82c8ba7fe
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-19300: Nested array_multisort invocation with error breaks
2025-07-31 19:01:13 +02:00
Niels Dossche
a96b05e63f
Fix GH-19300: Nested array_multisort invocation with error breaks
There are 2 issues:
1. When a MULTISORT_ABORT happens, it frees func, but func may point to
   ARRAYG(multisort_func), which would be a problem with nested
   invocations as it can destroy that of the "parent" invocation.
   To solve this, delay assigning to the globals.
2. The old globals were not restored which means that nested invocations
   with different flags will cause a wrong sorting function to be used.

Closes GH-19319.
2025-07-31 19:00:45 +02: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
Gina Peter Banyard
9db21e18ad
main/streams/transports.c: remove useless cast (#19330)
The function pointer type declaration requires name to be a const char*
2025-07-31 12:44:58 +01: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
Remi Collet
bdffded054
Ensure no blacklist configured in test (#19325) 2025-07-31 10:38:46 +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
Jakub Zelenka
e1cf66b6cb
Fix release process feature freeze info (#19148) 2025-07-30 23:51:28 +02:00
Daniel Scherzer
0fc62310b1
AllowDynamicProperties: use fully qualified name in validation errors (#19296) 2025-07-30 14:50:40 -07:00
Daniel Scherzer
246e8e53ba
[ci skip] Update NEWS to reflect PHP 8.5.0 alpha 4 2025-07-30 13:55:45 -07:00
Niels Dossche
a5219c1ecc
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-19303: Unpacking empty packed array into uninitialized array causes assertion failure
2025-07-30 22:49:08 +02:00
Niels Dossche
a08df32f18
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-19303: Unpacking empty packed array into uninitialized array causes assertion failure
2025-07-30 22:48:59 +02:00
Niels Dossche
5bd5f352e5
Fix GH-19303: Unpacking empty packed array into uninitialized array causes assertion failure
Having an empty result array is not a problem, because zend_hash_extend()
will initialize it. Except it does not when the number of elements to add
equals 0, which leaves the array uninitialized and therefore does not
set the packed flag, causing the assertion failure.

Technically, removing the assert would also work and save a check.
On the other hand, this check could also prevent some real work to be
done and should be relatively cheap as we already have to compute the
sum anyway.

Closes GH-19318.
2025-07-30 22:47:11 +02:00
Daniel Scherzer
9999d66bce
ext/standard/tests/file/bug81145.phpt: unlink file before exit (#19293)
If the test is skipped, the `--SKIPIF--` section exits (via `die()`) without
removing the "bug81145_src.bin" file that gets created, and because the test
was skipped the `--CLEAN--` section is not run, leaving the .bin file behind.

Adjust the `--SKIPIF--` section to remove the .bin file before exiting.
2025-07-30 13:14:10 -07:00
Christoph M. Becker
4754d302bf
Fix #19307: PGO builds of shared ext-intl are broken
We resolve the name mangling issue by including the right header file
inside an `extern "C"` declaration.

Closes GH-19310.
2025-07-30 18:33:40 +02:00
Arnaud Le Blanc
8538e2fe6b
Merge branch 'PHP-8.4'
* PHP-8.4:
  Prevent operands from being released during comparison
2025-07-30 18:14:45 +02:00
Arnaud Le Blanc
28ed4e6ec0
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Prevent operands from being released during comparison
2025-07-30 18:11:32 +02:00
Arnaud Le Blanc
bc4b6ce7a8
Prevent operands from being released during comparison
Fixes GH-19305
Closes GH-19309
2025-07-30 18:09:24 +02:00
Gina Peter Banyard
6600d0e00f
ext/intl: Refactor error handling (#19196)
This is a comprehensive refactoring of the error mechanism of the Intl extension.

By moving the prefixing of the current method/function being executed to actual error message creation by accessing the execution context, we get the following benefits:
- Accurate error messages indicating *what* call caused the error
  - As we *always* "copy" the message, the `copyMsg` arg becomes unused, meaning we can reduce the size of the `intl_error` struct by 4 bytes.
  - Saving it as a zend_string means we know the length of the message
- Remove the need to pass around a "function name" `char*` across multiple calls
- Use Intl's exception mechanism to generate exceptions for constructor call
  - This removes the need for replacing the error handler
  - Which didn't do anything anyway in silent mode, which required throwing non-descriptive exceptions
2025-07-30 16:00:37 +01:00
Ilija Tovilo
03e2613ddd
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix failed assertion with throwing __toString in binary const expr
2025-07-30 13:34:43 +02:00
Ilija Tovilo
138ebf481b
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix failed assertion with throwing __toString in binary const expr
2025-07-30 13:34:32 +02:00
Ilija Tovilo
80022c035b
Fix failed assertion with throwing __toString in binary const expr
Solve this with the same pattern as ZEND_AST_GREATER[_EQUAL].

Fixes OSS-Fuzz #434346548
Closes GH-19291
2025-07-30 13:34:01 +02:00
Gina Peter Banyard
7bac9de94a Zend: refactor zend_call_method_if_exists() API
The objective of this is to stop relying on the fci.function_name zval field,
to see if in the future we can get rid of said field and fit an FCI/FCC pair in a single cache line
2025-07-30 12:02:41 +01:00
Gina Peter Banyard
fc6c49cbf4 ext/zend_test: Test zend_call_method_if_exists() 2025-07-30 12:02:41 +01:00
Remi Collet
a9f3e3c44e
Fix GH-19298 missing libraries for opcache
In the absence of `PHP_ARG_WITH([opcache],` the value of ext_shared is not
initialized while processing directives of ext/opcache/config.m4, causing
PHP_EVAL_LIBLINE() to add libs to OPCACHE_SHARED_LIBADD instead of LIBS.

Closes GH-19301
2025-07-30 11:15:45 +02:00
Niels Dossche
16b2fc41a3
Merge branch 'PHP-8.4'
* PHP-8.4:
  Reset global pointers to prevent use-after-free
2025-07-30 09:23:38 +02:00
Niels Dossche
6fda0a5617
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Reset global pointers to prevent use-after-free
2025-07-30 09:23:33 +02:00
Niels Dossche
be9f1d3d56
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Reset global pointers to prevent use-after-free
2025-07-30 09:23:12 +02:00
Niels Dossche
7016ad558b
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Reset global pointers to prevent use-after-free
2025-07-30 09:22:50 +02:00
Florian Engelhardt
3aaa8d3526
Reset global pointers to prevent use-after-free
Closes GH-19212.
2025-07-30 09:22:15 +02:00
Niels Dossche
bc2d02e3a9
Fix fuzzer after opcache became mandatory (#19292) 2025-07-30 09:01:10 +02:00
Daniel Scherzer
c1b129bd18
[ci skip] Update NEWS for PHP 8.5.0 beta1 2025-07-29 13:59:19 -07:00
Gina Peter Banyard
a95a81000d Zend: Exception::__toString() no need to allocate the method name
We can create the FCI/FCC pair ourself outside of the loop as the method getTraceAsString is final

Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
2025-07-29 21:16:13 +01:00
Gina Peter Banyard
c9e91bfbab Zend/zend_exceptions: Add const modifiers 2025-07-29 21:16:13 +01:00
David CARLIER
abee5c138f
ext/intl: convert C part to C++ step 1. (#19231) 2025-07-29 20:22:19 +01:00
Bogdan Ungureanu
e8b5bcfe19
Intl: IntlListFormatter - update exception message (#19282) 2025-07-29 08:35:27 -07:00
Niels Dossche
4c576a2b02
Fix exception handling in shm_put_var() (#19279) 2025-07-29 17:31:06 +02:00
Daniel Scherzer
ec0ec47bbf
NEWS: move a misplaced comma [skip ci] 2025-07-29 08:13:33 -07:00
Daniel Scherzer
61415942c2
ext/standard: drop old smart_string headers (#19233)
Functionality was removed in PHP 7.2
2025-07-29 07:57:19 -07:00
Daniel Scherzer
d23e4ba538
UPGRADING.INTERNALS: document ZEND_DECLARE_ATTRIBUTED_CONST (#19270)
[skip ci]
2025-07-29 07:55:39 -07:00
Daniel Scherzer
54863f4930
gen_stub: Update PHP-Parser to 5.6.0 (#19271)
Includes support for declaring functions named `clone`, so update the stub file
where `clone` is declared to remove the `_clone` workaround.
2025-07-29 07:47:58 -07:00
Arnaud Le Blanc
712508fdb2
Call php_child_init() after fork during preloading (#19287) 2025-07-29 16:10:35 +02:00
Jakub Zelenka
ce6e7a2786
Integrate OpenSSL libctx to pwhash (#19236)
This allows using OpenSSL Argon2 password hashing on ZTS.

Closes GH-19236
2025-07-29 15:06:34 +02:00
David Carlier
f72105be81
ext/posix: value ranges check for posix_setrlimit and posix_setpgid
setpgid accepts values from 0 to "PID_MAX".
for setrlimit the culprit is using zend_long to represent rlim_t
but at least we accept -1 for RLIM_INFINITY, however rl_cur should
not be greater than rl_max value.

close GH-19281
2025-07-29 13:10:26 +01:00
Arnaud Le Blanc
c561f7da85
Refresh zend_mm shadow key on fork
The shadow key is refreshed when resetting the memory manager between two
requests. But in forking SAPIs the first request of a child process inherits the
shadow key of the parent. As a result, a leak of the shadow key during the first
request of one process gives away the shadow key used during the first request
of other processes. This makes the key refresh mechanism less useful.

Here I ensure that we refresh the shadow key after a fork. We can not reset the
manager as there may be active allocations. Instead, we have to recompute shadow
pointers with the new key.

Closes GH-16765
2025-07-29 14:00:37 +02:00
Arnaud Le Blanc
8e38f6d1c6
Fix out of tree builds (#19283) 2025-07-29 13:36:30 +02:00
Jakub Zelenka
cecf9b02e5
Remove unused FPM_LOG_BUFFER 2025-07-29 11:43:57 +02:00
Jakub Zelenka
cfb3e98c84
FPM: Implement configurable access log limit
It sets the access log limit as configurable log_limit to allow larger
log limit than the currently fixed limit of 1024 characters.

Fixes GH-12302
Closes GH-18725
2025-07-29 11:32:01 +02:00
Ilija Tovilo
35a4656a59
Fix error recording with file cache only (GH-19278)
Introduced by GH-18541.

This path is hit when compilation fails with a compile error, rather than
bailout. If a non-fatal error is recorded, it will not be emitted nor freed.
Handle accordingly.
2025-07-29 10:06:43 +02:00
Máté Kocsis
e48099a03c
Update real-time benchmark config after opcache became mandatory
https://wiki.php.net/rfc/make_opcache_required removed the --enable-opcache option, and this change creates a problem for the benchmark: the master branch (containing the RFC implementation) cannot use the deprecated options and config anymore, while earlier versions must still use them.

Therefore, the benchmark had to introduce the PHP_OPCACHE=2 config value (3455b34856) to signal that opcache still has to be manually enabled. After the next benchmark run,  PHP_OPCACHE for the previous PHP version has to be switched back to "1".

[skip-ci]
2025-07-29 00:16:37 +02:00
Gina Peter Banyard
b30ccf9158
Merge branch 'PHP-8.4'
* PHP-8.4:
  ext/intl: Fix return value on failure for resourcebundle count handler
2025-07-28 15:36:44 +01:00
Gina Peter Banyard
5295fc07d5
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  ext/intl: Fix return value on failure for resourcebundle count handler
2025-07-28 15:36:02 +01:00
Gina Peter Banyard
6b0a80903b
ext/intl: Fix return value on failure for resourcebundle count handler
Closes GH-19277
2025-07-28 15:35:31 +01:00
Gina Peter Banyard
f63a35d944 ext/sysvmsg: various minor refactorings 2025-07-28 15:33:22 +01:00
Gina Peter Banyard
87d83d162d ext/sysvsem: use bool type instead of int 2025-07-28 15:33:22 +01:00
Gina Peter Banyard
bac158c80d ext/sysvshm: use size_t and ssize_t instead of zend_long 2025-07-28 15:33:22 +01:00
Gina Peter Banyard
6154fac64d ext/sysvshm: refactor php_put_shm_data() 2025-07-28 15:33:22 +01:00
Gina Peter Banyard
4844c7a92f ext/sysvshm: voidify php_remove_shm_data() 2025-07-28 15:33:22 +01:00
Gina Peter Banyard
e897621be9 ext/sysvshm: shm_detach() always returns true 2025-07-28 15:33:22 +01:00
David Carlier
3b4f2b0798
ext/posix: posix_kill() process_id range check.
pid_t is, for the most part, represented by a signed int, by overflowing
it, we end up being in the -1 case which affect all accessible processes.

close GH-18944
2025-07-28 15:31:14 +01:00
Gina Peter Banyard
eaf24ba4e2
Merge branch 'PHP-8.4'
* PHP-8.4:
  ext/gd: Fix comparison with result of php_stream_can_cast()
2025-07-28 11:55:43 +01:00
Gina Peter Banyard
19c84e2687
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  ext/gd: Fix comparison with result of php_stream_can_cast()
2025-07-28 11:55:14 +01:00
Gina Peter Banyard
83b8d2c290
ext/gd: Fix comparison with result of php_stream_can_cast()
Closes GH-19107
2025-07-28 11:54:19 +01:00
Gina Peter Banyard
b75c2dcb02
Remove myself from bcmath codeowner
I haven't kept up with the extension nor been doing proper reviews for it
2025-07-28 11:22:22 +01:00
Dmitrii Derepko
5947fedbbd
ext/standard: handle html entities empty string before processing (#19220) 2025-07-28 12:15:26 +02:00
Daniel Scherzer
ff810d5e36
Arginfo: reuse zend_string objects for initializing attribute values (#19241)
Avoid initializing the same string content multiple times and make use of the
fact that the strings created to initialize attribute values are not freed by
simply making use of an existing zend_string with the same content if one is
available.
2025-07-27 17:27:22 -07:00
David CARLIER
068aaed196
ext/sockets: using accept4 wheneever possible for php_accept_connect helper (#19268)
Haiku now supports it as well now, so we can simplify the workflow a bit for those platforms.
2025-07-27 20:52:11 +01:00
Gina Peter Banyard
191290e194
ext/intl: Split error tests out and stop relying on ut_common() testing (#19266) 2025-07-27 19:40:42 +01:00
David CARLIER
4a0ad9bd91
ext/sockets: cmsg data array elements using uint32_t type instead. (#19254) 2025-07-27 15:43:59 +01:00
Niels Dossche
63e40b1b29
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix bug #51558: shared readline build fails (#15242)
2025-07-27 15:34:30 +02:00
Niels Dossche
3da9478d78
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix bug #51558: shared readline build fails (#15242)
2025-07-27 15:34:23 +02:00
Peter Kokot
17df11e3f7
Fix bug #51558: shared readline build fails (#15242)
The 'rl_pending_input' is a variable in Readline library and checking it
with PHP_CHECK_LIBRARY wouldn't find it on some systems.

Library check works on most systems but not on the mentioned AIX in the
bug as it exports variables and functions differently whereas the linker
couldn't resolve the variable as a function.

This should fix the build on systems where this caused issues, such as
AIX.

The <readline/readline.h> is not self-contained header and needs to also
have <stdio.h> included before to have FILE type available. This fixes
the issue on unpatched default readline installations, such as macOS.

Checking this variable ensures that the found library is the correct
library and also that it is of minimum version needed by current PHP
code (https://bugs.php.net/48608).

The library check:

```c
| char rl_pending_input ();
| int main (void) {
|     return rl_pending_input ();
| }
```

The declaration check:

```c
| #include <stdio.h>
| #include <readline/readline.h>
| int main (void) {
| #ifndef rl_pending_input
| #ifdef __cplusplus
|     (void) rl_pending_input;
| #else
|     (void) rl_pending_input;
| #endif
| #endif
| ;
|     return 0;
| }
```

Closes https://bugs.php.net/51558

Closes GH-19259.
2025-07-27 15:33:48 +02:00
David Carlier
f4ad6ea287
Merge branch 'PHP-8.4' 2025-07-27 13:50:30 +01:00
David Carlier
87b4030503
Merge branch 'PHP-8.3' into PHP-8.4 2025-07-27 13:50:21 +01:00
David Carlier
e1c4a0ae51
Fixed GH-19261: msgfmt_parse_message leaks on message format failure.
close GH-19262
2025-07-27 13:49:24 +01:00
David Carlier
f7ca8138e7
Merge branch 'PHP-8.4' 2025-07-27 12:56:05 +01:00
David Carlier
279589c3af
Merge branch 'PHP-8.3' into PHP-8.4 2025-07-27 12:55:17 +01:00
dixyes
e16df981bf
ext/pdo_pgsql: Fix _pdo_pgsql_trim_message bad access
close GH-19239
2025-07-27 12:54:43 +01:00
Arnaud Le Blanc
7b3e68ff69
Fix error handling inconsistency with opcache
When opcache is enabled, error handling is altered in the following ways:

 * Errors emitted during compilation bypass the user-defined error handler
 * Exceptions emitted during class linking are turned into fatal errors

Changes here make the behavior consistent regardless of opcache being enabled or
not:

 * Errors emitted during compilation and class linking are always delayed and
   handled after compilation or class linking. During handling, user-defined
   error handlers are not bypassed. Fatal errors emitted during compilation or
   class linking cause any delayed errors to be handled immediately (without
   calling user-defined error handlers, as it would be unsafe).
 * Exceptions thrown by user-defined error handlers when handling class linking
   error are not promoted to fatal errors anymore and do not prevent linking.

Fixes GH-17422.
Closes GH-18541.
Closes GH-17627.

Co-authored-by: Tim Düsterhus <tim@bastelstu.be>
2025-07-27 11:01:49 +02:00
Niels Dossche
9b777b3c35
Merge branch 'PHP-8.4'
* PHP-8.4:
  Free opened_path when opened_path_len >= MAXPATHLEN
2025-07-27 10:54:53 +02:00
Niels Dossche
1c74a1a889
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Free opened_path when opened_path_len >= MAXPATHLEN
2025-07-27 10:54:46 +02:00
dixyes
5dd965117a
Free opened_path when opened_path_len >= MAXPATHLEN
Closes GH-19240.
2025-07-27 10:54:21 +02:00
Tim Düsterhus
d3ebf97d77
Fix expectations in version string tests 2025-07-27 09:40:23 +02:00
Arnaud Le Blanc
7b4c14dc10
Make OPcache non-optional
This removes the --enable-opcache/--disable-opcache configure switch. OPcache
is now always builtin. The default value of opcache.enable and
opcache.enable_cli is unchanged.

RFC: https://wiki.php.net/rfc/make_opcache_required

Closes GH-18961.

Co-authored-by: Tim Düsterhus <tim@tideways-gmbh.com>
2025-07-27 09:40:22 +02:00
Ayesh Karunaratne
6f3bc59950
ext/curl: Add CURLOPT_SSL_SIGNATURE_ALGORITHMS option
Adds support for `CURLOPT_SSL_SIGNATURE_ALGORITHMS`[^1], supported
since Curl version 8.14.0.

[^1]: https://curl.se/libcurl/c/CURLOPT_SSL_SIGNATURE_ALGORITHMS.html

Closes GH-18692
2025-07-26 20:17:05 +02:00
Arnaud Le Blanc
73b1ebfa20
Fix linker failure when building Opcache statically
We use linker relocations to fetch the TLS index and offset of _tsrm_ls_cache.
When building Opcache statically, linkers may attempt to optimize that into a
more efficient code sequence (relaxing from "General Dynamic" to "Local Exec"
model [1]). Unfortunately, linkers will fail, rather than ignore our
relocations, when they don't recognize the exact code sequence they are
expecting.

This results in errors as reported by GH-15074:

    TLS transition from R_X86_64_TLSGD to R_X86_64_GOTTPOFF against
    `_tsrm_ls_cache' at 0x12fc3 in section `.text' failed"

Here I take a different approach:

 * Emit the exact full code sequence expected by linkers
 * Extract the TLS index/offset by inspecting the linked ASM code, rather than
   executing it (execution would give us the thread-local address).
 * We detect when the code was relaxed, in which case we can extract the TCB
   offset instead.
 * This is done in a conservative way so that if the linker did something we
   didn't expect, we fallback to a safer (but slower) mechanism.

One additional benefit of that is we are now able to use the Local Exec model in
more cases, in JIT'ed code. This makes non-glibc builds faster in these cases.

Closes GH-18939.

Related RFC: https://wiki.php.net/rfc/make_opcache_required.

[1] https://www.akkadia.org/drepper/tls.pdf
2025-07-26 16:43:41 +02:00
Arnaud Le Blanc
04feb452ba
Merge branch 'PHP-8.4'
* PHP-8.4:
  Add unique entry point for extra tests
2025-07-26 16:17:51 +02:00
Arnaud Le Blanc
120a5ebb66
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Add unique entry point for extra tests
2025-07-26 16:17:40 +02:00
Arnaud Le Blanc
a7cdf0b172
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Add unique entry point for extra tests
2025-07-26 16:15:48 +02:00
Arnaud Le Blanc
5fa27e25b3
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Add unique entry point for extra tests
2025-07-26 16:14:56 +02:00
Arnaud Le Blanc
b633720585
Add unique entry point for extra tests
We are adding extra (non-phpt) test suites in [1] and [2]. In order to
avoid touching CI files too often (which are maintained in 8.1 and merged in
upper branches), we add a single entry point to call the extra tests. The entry
point can be updated in branches without synchronizing all the way from 8.1.

CI files still need to be touched to install dependencies of these tests,
but this should be manageable as these do not change often and are the same
in every branch.

Closes GH-19242.

[1] https://github.com/php/php-src/pull/16987
[2] https://github.com/php/php-src/pull/18939
2025-07-26 16:13:34 +02:00
Arnaud Le Blanc
7f7b3cdb90
Introduce zend_vm_opcode_handler_t / zend_vm_opcode_handler_func_t
This reduces the chances of confusion between opcode handlers used by the
VM, and opcode handler functions used for tracing or debugging. Depending
on the VM, zend_vm_opcode_handler_t may not be a function. For instance in
the HYBRID VM this is a label pointer.

Closes GH-19006
2025-07-26 13:20:59 +02:00
Daniel Scherzer
747ecce51f gen_stub: simplify ClassInfo::getRegistration() 2025-07-25 11:17:34 -07:00
Daniel Scherzer
74f7ecbe04 gen_stub: add ConstInfo::getPredefinedConstantElement()
Simplifies the implementation of `::getPredefinedConstantTerm()` and
`::getPredefinedConstantEntry()`, which only differ in the name of the tag
used.
2025-07-25 11:17:34 -07:00
Daniel Scherzer
5ae87ffef4 gen_stub: avoid unneeded regex match 2025-07-25 11:17:34 -07:00
Daniel Scherzer
ecc403a8fa gen_stub: inline computeStubHash() 2025-07-25 11:17:34 -07:00
Daniel Scherzer
2ed5472f06 gen_stub: make some FuncInfo methods private
* `FuncInfo::isFinalMethod()`
* `FuncInfo::getModifierNames()`
* `FuncInfo::equalsApartFromNameAndRefcount()`
2025-07-25 11:17:34 -07:00
Daniel Scherzer
0b01640b58 gen_stub: replace FunctionOrMethodName::isMethod() with instanceof 2025-07-25 11:17:34 -07:00
Daniel Scherzer
49f1685cde gen_stub: simplify FuncInfo::getFramelessDeclaration() 2025-07-25 11:17:34 -07:00
Daniel Scherzer
988da4c951 gen_stub: simplify FuncInfo::getFunctionEntry() 2025-07-25 11:17:34 -07:00
Daniel Scherzer
9dfee95dae gen_stub: add SimpleType::toTypeInfo()
Simplifies the implementation of `::toTypeCode()` and `::toTypeMask()` by
combining the `switch` blocks.
2025-07-25 11:17:34 -07:00
Daniel Scherzer
e5d4d656ab gen_stub: replace AbstractConstName::isClassConst() with instanceof 2025-07-25 11:17:34 -07:00
Daniel Scherzer
8bd8223bad gen_stub: remove unused AbstractConstName::equals() 2025-07-25 11:17:34 -07:00
Daniel Scherzer
15547a2eb1 gen_stub: simplify generateFunctionEntries() 2025-07-25 11:17:34 -07:00
Daniel Scherzer
30c8480a39 gen_stub: move getFileDocComments() into FileInfo
Reduce the number of global functions by moving it to static method
`FileInfo::getFileDocComments()`. Since it is only used by
`FileInfo::parseStubFile()`, also make it private.
2025-07-25 11:17:34 -07:00
Daniel Scherzer
24d94197fd gen_stub: move generateClassEntryCode() into FileInfo
Reduce the number of global functions by moving it to instance method
`FileInfo::generateClassEntryCode()`.
2025-07-25 11:17:34 -07:00
Daniel Scherzer
0d221c5b70 gen_stub: create VersionFlags class
This new class holds the logic for applying different flags based on the PHP
version, and replaces `VariableLike::addFlagForVersionsAbove()` (use
`VersionFlags::addForVersionsAbove()`) and `generateVersionDependentFlagCode()`
(use `VersionFlags::generateVersionDependentFlagCode()`).
2025-07-25 11:17:34 -07:00
Daniel Scherzer
1218e39b07 gen_stub: add maximum option to generateVersionDependentFlagCode()
In preparation for moving this logic to a dedicated class, add support for a
maximum version of PHP in the generation of version-dependent flags. This
replaces the manual logic in `FuncInfo::getFunctionEntry()` to split up the
flags that are used when PHP 8.4 is not supported.
2025-07-25 11:17:34 -07:00
Tim Düsterhus
a2d8ee27f2
opcache: Disallow changing opcache.memory_consumption when SHM is set up (#19146)
* opcache: Reset `accel_startup_ok` after shutting down

This is necessary for phpdbg, which runs multiple startup/shutdown cycles in
the same process.

* opcache: Disallow changing `opcache.memory_consumption` when SHM is set up

Normally changing the INI value is not possible after SHM is set up, since it
is `PHP_INI_SYSTEM`. FPM is a notable exception: SHM is set up in the master
process, but when spawning the individual pools, the `php_admin_value` config
option can be used to change `PHP_INI_SYSTEM` INIs on a per-pool basis. This
does not work for this option, since it will only be read on early start,
leading to misleading PHPInfo output, since the INI value appears to be
successfully set and since some of the calculated values are derived from the
INI value rather than the actual value.
2025-07-25 18:36:47 +02:00
Daniel Scherzer
b428bc934a
ext/reflection: voidify format_default_value() (#19234)
This function always returned SUCCESS unconditionally; removing the return type
revealed some impossible code for handling FAILURE that could also be removed.
2025-07-25 09:04:28 -07:00
Marc Bennewitz
7c1e461032
Removed unused var exec_time and fetch time in opcache/zend_accelerator_module.c (GH-19235) 2025-07-25 13:22:03 +02:00
Jakub Zelenka
b1fce8a98c
Add digest algo param to public encrypt and private decrypt
Specifically, it is added to openssl_public_encrypt() and
openssl_private_decrypt() functions. The purpose is to specify digest
algorithm for OEAP padding. It currently defaults to SHA1 for some
OpenSSL versions which is not preferred for modern setup and causes
problems in compatibility with web crypto.

Closes GH-19223
2025-07-25 12:56:47 +02:00
Niels Dossche
93b9808004
Merge branch 'PHP-8.4'
* PHP-8.4:
  NEWS for hrtime in FTP and standard
  Handle broken hrtime in ftp
  Fix arginfo/zpp violation if zend_hrtime is not available
2025-07-25 12:05:17 +02:00
Niels Dossche
802e348b49
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  NEWS for hrtime in FTP and standard
  Handle broken hrtime in ftp
  Fix arginfo/zpp violation if zend_hrtime is not available
2025-07-25 12:05:12 +02:00
Niels Dossche
f94c11fff8
NEWS for hrtime in FTP and standard 2025-07-25 12:04:40 +02:00
Niels Dossche
beeeee2978
Handle broken hrtime in ftp
Part of GH-19210.

Closes GH-19219.
2025-07-25 11:56:30 +02:00
Niels Dossche
ad2143f3b0
Fix arginfo/zpp violation if zend_hrtime is not available
Part of GH-19210.

Closes GH-19218.
2025-07-25 11:56:17 +02:00
DanielEScherzer
7777eaa8e1
zend_compile.h: align ZEND_CLASS_CONST_IS_CASE like others [skip ci] 2025-07-24 15:07:27 -07:00
Jorg Adam Sowa
da7d2e14ac
Add macos 15 to push GH action (GH-18514)
* Replaced macos14 with macos15 in push

* skip lc_ctype_inheritance test for macOS
2025-07-24 15:02:06 +02:00
Florian Engelhardt
29b38a1ced
Fix GH-19226: Segfault when spawning new thread in soap extension
Closes GH-19228.
2025-07-24 11:56:43 +02:00
David CARLIER
2645663d9b
ext/intl: GregorianCalendar using C++ upcasting operator. (#19216)
when fetching the internal ICU object also removing one useless cast.
2025-07-23 12:25:20 +01:00
Niels Dossche
719419a6e5
Fix unterminated string GCC warnings in mbstring (#19192)
Necessary for for Werror builds
2025-07-23 11:49:16 +02:00
Alexandre Daubois
d292968f7c
Add ReflectionProperty::getMangledName() (#18980) 2025-07-22 12:24:27 -07:00
DanielEScherzer
745e81bfd0
UPGRADING: clean up a few entries [skip ci] (#19204)
Co-authored-by: Tim Düsterhus <tim@tideways-gmbh.com>
2025-07-22 10:12:23 -07:00
Ilija Tovilo
aba6b89399
Merge branch 'PHP-8.4'
* PHP-8.4:
  Coerce numeric string keys from iterators when argument unpacking
2025-07-22 17:48:06 +02:00
Ilija Tovilo
4bc5aa3531
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Coerce numeric string keys from iterators when argument unpacking
2025-07-22 17:47:56 +02:00
Bob Weinand
5b8ee009d6 Merge branch 'PHP-8.4' of https://github.com/php/php-src 2025-07-22 17:47:20 +02:00
Ilija Tovilo
23ec35bf4a
Coerce numeric string keys from iterators when argument unpacking
Fixes GH-18581
Closes GH-19151
2025-07-22 17:46:34 +02:00
Bob Weinand
b13347be38
Fix GH-19044: Protected properties are not scoped according to their prototype (#19046)
* Fix GH-19044: Protected properties are not scoped according to their prototype

* Adjust after review

* Simplify to using prototype even for asymmetric visibility
2025-07-22 17:46:14 +02:00
Ilija Tovilo
5a06842bf8
Fix '?' in ReflectionNamedType::getName() from ReflectionProperty::getSettableType()
Fixes GH-19187
Closes GH-19201
2025-07-22 15:57:15 +02:00
Niels Dossche
441e55790f
Merge branch 'PHP-8.4'
* PHP-8.4:
  Run FreebSD CI under 13.5
2025-07-22 15:52:45 +02:00
Niels Dossche
4e1d3f8772
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Run FreebSD CI under 13.5
2025-07-22 15:52:38 +02:00
Niels Dossche
7efbb2e4e0
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Run FreebSD CI under 13.5
2025-07-22 15:52:29 +02:00
Niels Dossche
d9d412645d
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Run FreebSD CI under 13.5
2025-07-22 15:52:16 +02:00
Niels Dossche
be88192594
Run FreebSD CI under 13.5
13.3 gives a 404 now.
Also pulls in a 8.4 fix to include xxhash from the bundled location.

Closes GH-19213.
2025-07-22 15:51:19 +02:00
Ilija Tovilo
99b5b20479
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Fix wrong oss-fuzz ID
2025-07-22 15:46:51 +02:00
Ilija Tovilo
79368ed8f3
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [skip ci] Fix wrong oss-fuzz ID
2025-07-22 15:46:44 +02:00
Ilija Tovilo
a48d620c26
[skip ci] Fix wrong oss-fuzz ID
Oops, darn copy & paste.
2025-07-22 15:45:48 +02:00
Ilija Tovilo
5b05d429f2
Merge branch 'PHP-8.4'
* PHP-8.4:
  Leak in failed unserialize() with opcache
2025-07-22 15:44:24 +02:00
Ilija Tovilo
f0baf3dc11
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Leak in failed unserialize() with opcache
2025-07-22 15:44:16 +02:00
Ilija Tovilo
5d1636e40b
Leak in failed unserialize() with opcache
With opcache, zend_string_init_interned() will allocate non-interned strings at
runtime because shm is locked. Hence, we need to make sure to actually free this
string.

Fixes OSS-Fuzz #433303828
Closes GH-19211
2025-07-22 15:43:31 +02:00
Niels Dossche
ef5ca80a47
Merge branch 'PHP-8.4'
* PHP-8.4:
  Add missing cc clobber
2025-07-22 12:43:57 +02:00
Niels Dossche
c04f2d2d88
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Add missing cc clobber
2025-07-22 12:43:21 +02:00
Niels Dossche
13c781f04d
Add missing cc clobber
Closes GH-19205.
2025-07-22 12:43:08 +02:00
David CARLIER
a7fef37657
ext/intl: c++ memory management application to timezone class internals. (#19184) 2025-07-22 05:35:44 +01:00
Niels Dossche
113eb203b0
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix test conflict between chmod_variation2 and file_variation5
2025-07-21 23:57:55 +02:00
Niels Dossche
e572e899bd
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix test conflict between chmod_variation2 and file_variation5
2025-07-21 23:57:49 +02:00
Niels Dossche
7ab37e81e0
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix test conflict between chmod_variation2 and file_variation5
2025-07-21 23:57:42 +02:00
Niels Dossche
27f24bd9bc
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix test conflict between chmod_variation2 and file_variation5
2025-07-21 23:57:34 +02:00
Niels Dossche
605ee05491
Fix test conflict between chmod_variation2 and file_variation5
Both used "somelink".
See 4642146137

Closes GH-19208.
2025-07-21 23:57:21 +02:00
Niels Dossche
95f1350ca8
NEWS and UPGRADING for array_chunk 2025-07-21 23:00:44 +02:00
Niels Dossche
1b169bf28e Allocate array eagerly in array_chunk
By preallocating it as a packed array, we save the initial
initialization overhead.
Gives a few extra percentage points improvement.
2025-07-21 22:59:55 +02:00
Niels Dossche
4762d46427 Avoid modulo operation in loop in array_chunk
For this benchmark:
```php
$length = 25;
for ($i=0;$i<1000;$i++)
  array_chunk(range(0, 10000), $length);
```

On an i7-4790, length=25 speeds up by 1.8x and length=1 by 1.27x.
On an i7-1185G7, length=25 speeds up by 1.08x and length=1 by 1.02x.
2025-07-21 22:59:55 +02:00
DanielEScherzer
1eadf553f1
Arginfo: avoid using temporary zvals for initializing attribute values (#19141)
Instead of
* adding a zval on the stack
* initializing it
* copying the value to the attribute

Just initialize the value directly in the zend_attribute_arg
2025-07-21 13:33:51 -07:00
Niels Dossche
c55f142c6c
Make specialization of x64 zend_safe_address() for nmemb==1 (#19203) 2025-07-21 22:13:46 +02:00
Artem Ukrainskiy
e0c3f46496
Refactor traverse_for_entities for unescape_html_entities
Optimize scanning for '&' and ';' using memchr. Use memcpy instead of
character-by-character copying language.

Closes GH-18092
2025-07-21 20:57:09 +02:00
Ilija Tovilo
eb65ec41b7
Implement Closure::getCurrent() to retrieve current closure
Fixes GH-18163
Closes GH-18167
2025-07-21 16:07:49 +02:00
Ilija Tovilo
d20f4fca69
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix properties_info_table for abstract properties
2025-07-21 15:54:53 +02:00
Ilija Tovilo
c8cc23336d
Fix properties_info_table for abstract properties
Fixes GH-19053
Closes GH-19140

Co-authored-by: Bob Weinand <bobwei9@hotmail.com>
2025-07-21 15:54:24 +02:00
David Carlier
ff6c1c7a30
[ci kip] UPDATE NEWS 2025-07-21 12:30:52 +01:00
David CARLIER
bd886d21e7
Fix GH-19197: session build fails on system with memcpy as macro. (#19198)
Thus ZEND_STRL macro does not expand as expected so going back
to not using it like lower branches.
2025-07-21 10:19:29 +01:00
Niels Dossche
30f03021d1
[ci skip] Remove obsolete todo (#19195)
All arguments are documented on php.net, although result_type is called
mode in the docs and stub.
2025-07-21 10:57:54 +02:00
Tim Düsterhus
7f1b3606a8
main: Add PHP_BUILD_PROVIDER userland constant (#19157)
This constant can be handy for tools like PIE to determine the origin of a PHP
binary to provide better output / diagnostics.

see php/pie#275
see php/php-src#18168
2025-07-21 10:43:14 +02:00
David CARLIER
e91d2c719f
zend: ZEND_NONSTRING for clang >= 20 support (#19193) 2025-07-20 22:27:06 +01:00
Niels Dossche
d7f9caf37c
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-18640: heap-use-after-free ext/soap/php_encoding.c:299:32 in soap_check_zval_ref
2025-07-20 19:50:01 +02:00
Niels Dossche
f8196a5db5
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-18640: heap-use-after-free ext/soap/php_encoding.c:299:32 in soap_check_zval_ref
2025-07-20 19:49:56 +02:00
Niels Dossche
6cc4ae1f1d
Fix GH-18640: heap-use-after-free ext/soap/php_encoding.c:299:32 in soap_check_zval_ref
For attributes, relying on the ref_map doesn't make sense the first
place as you can't really refer to attributes from attributes.
The code therefore assumes that the node is unique, which is broken.

Closes GH-19181.
2025-07-20 19:49:22 +02:00
Niels Dossche
541620cf78
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-19098: libxml<2.13 segmentation fault caused by php_libxml_node_free
2025-07-20 17:20:53 +02:00
Niels Dossche
cb73155945
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-19098: libxml<2.13 segmentation fault caused by php_libxml_node_free
2025-07-20 17:20:47 +02:00
Niels Dossche
312869381a
Fix GH-19098: libxml<2.13 segmentation fault caused by php_libxml_node_free
This implements a workaround for reconciliation not being performed for
document-less nodes in libxml<2.13.

Closes GH-19186.
2025-07-20 17:19:43 +02:00
David CARLIER
999d29dc2b
ext/intl: reducing raw pointer usage in C++ part, using smart ones instead. (#19179) 2025-07-20 12:16:04 +01:00
Niels Dossche
726516b8c1 UPGRADING, UPGRADING.INTERNALS, and NEWS for SVG and extensible image API 2025-07-20 12:53:57 +02:00
Niels Dossche
0962c325fa Implement SVG image handler
This implements an SVG handler using the libxml reader API. This does
not parse the entire document but instead uses a pull parser to locate
the root element, check whether it's an svg root, do some extra sanity
checks on the attribute, and fill in the php_gfxinfo structure.
2025-07-20 12:53:57 +02:00
Niels Dossche
8db883c540 Add API to register custom image handlers
This is modelled similarly to the password registry API.
We have an array to which new handlers can be added, and when a built-in
handler cannot handle the image, we try the handlers in the array.
The standard module is in control of registering a new constant for the
image file type so that no clashes can occur. It also updates the image
file type count constant. As such, the registration may only happen
during module startup.
2025-07-20 12:53:57 +02:00
Niels Dossche
05bb051243 Expose gfxinfo as php_gfxinfo
This is necessary for future commits, when we extend the image handling
to support extensions adding their own handlers.
Also extend the struct with fields for when the width and height are not
numbers but strings (e.g. for SVG).
2025-07-20 12:53:57 +02:00
Niels Dossche
03a9f03822
Migrate from xmlNewNode to xmlNewDocNode (#19182)
The former is discouraged [1].

[1] https://gnome.pages.gitlab.gnome.org/libxml2/html/tree_8h.html#aa39c05fb472571ed00e38c065e67d2ec
2025-07-19 23:29:04 +02:00
Peter Kokot
68fdb43573
Remove duplicate libxml2-dev (#19185) 2025-07-19 20:33:37 +02:00
Benstone Zhang
dfac2da7fb
Add support for HEIF/HEIC to getimagesize
Signed-off-by: Benstone Zhang <benstonezhang@gmail.com>
2025-07-19 19:24:45 +02:00
Niels Dossche
dd3a098a9b
Disable error handler in fuzzer (#19183)
These are all the same root cause and it's known.
2025-07-19 13:08:21 +02:00
Volker Dusch
189b933dd4
RM docs: Update social media annoncement process (#19159) 2025-07-19 01:18:39 +02:00
Tim Düsterhus
6ca6d569ff
bless_tests: Replace the object ID in var_dump() for namespaced classes (#19174) 2025-07-18 20:43:23 +02:00
David Carlier
2c42479890
Merge branch 'PHP-8.4' 2025-07-18 18:02:46 +01:00
David Carlier
f1a77c0198
Merge branch 'PHP-8.3' into PHP-8.4 2025-07-18 18:02:02 +01:00
Petr Sumbera
be09985c87
Fix GH-19169: ZEND_STATIC_ASSERT for -std=c++17
needs to define ZEND_STATIC_ASSERT to appropriate C++ static_assert
instead of the C version.
2025-07-18 18:00:24 +01:00
Gina Peter Banyard
b48faee850
ext/snmp: no need to use a smart_string for error message (#19171) 2025-07-18 16:43:39 +01:00
Tim Düsterhus
5fdc02282f
uri: Improve exceptions for Uri\Rfc3986\Uri (#19161)
* uri: Streamline implementation of `uriparser_parse_uri_ex()`

Avoid the use of a macro and streamline the logic.

* uri: Improve exceptions for `Uri\Rfc3986\Uri`

* uri: Allow empty URIs for RFC3986

* NEWS

* uri: Improve ext/uri/tests/004.phpt for empty URIs
2025-07-18 17:38:44 +02:00
David CARLIER
063d795599
ext/intl: using a bit more modern c++ memory management features. (#19163)
not always possible (e.g. PHP objects) but when scoped we can manage
here to simplify memory managament starting with IntlDateFormat.
2025-07-18 14:10:40 +01:00
Gina Peter Banyard
419f6750c0 ext/tidy: refactor php_tidy_file_to_mem()
Pass zend_string* along
2025-07-18 13:21:56 +01:00
Gina Peter Banyard
4433986e40 ext/tidy: Refactor php_tidy_parse_string() 2025-07-18 13:21:56 +01:00
Gina Peter Banyard
0a130caf58 ext/tidy: refactor php_tidy_set_tidy_opt()
Bring closer to unique call site and return value of it
2025-07-18 13:21:56 +01:00
Gina Peter Banyard
01dbee83e1 ext/tidy: tidyOptGetType returns an enum that is fully checked 2025-07-18 13:21:56 +01:00
Gina Peter Banyard
aadd724362
ext/intl: Refactor IntlRuleBasedBreakIterator::__construct() (#19164)
There is no need to delegate this to a seperate function and overwrite the error handler to promote warnings
2025-07-17 23:00:05 +01:00
Tim Düsterhus
6b3f302132
streams: Re-add support for arbitrary metadata for stream notifier functions (#19158)
Support for attaching arbitrary metadata for consumption by stream notifier
functions got broken in php/php-src#19024 when the previous `zval ptr` got
changed to `zend_fcall_info_cache *fcc`, making the data specific to the
`user_space_stream_notifier`.

Fix this by changing the field to `void *ptr`, avoiding the indirection through
a `zval`, but preserving the ability to store arbitrary data. If necessary to
support different types than `IS_PTR`, extensions can heap-allocate a `zval` to
store within `->ptr` as a minimal change to keep compatibility with PHP 8.4 or
lower.
2025-07-17 23:01:43 +02:00
Tim Düsterhus
78d96e94fa
zend_API: Make scope a const zend_class_entry* for zend_update_property_*() (#19156)
Follow-up for php/php-src#19060.
2025-07-17 22:11:24 +02:00
Niels Dossche
04eadc803d
Merge branch 'PHP-8.4'
* PHP-8.4:
  NEWS for GH-19162
  ext/socket: Remove incorrect zval_ptr_dtor
  ext/hash: Remove incorrect zval_ptr_dtor
2025-07-17 21:53:39 +02:00
Niels Dossche
d9602e4362
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  NEWS for GH-19162
  ext/socket: Remove incorrect zval_ptr_dtor
  ext/hash: Remove incorrect zval_ptr_dtor
2025-07-17 21:52:23 +02:00
Niels Dossche
86aaded7e5
NEWS for GH-19162
Closes GH-19162.
2025-07-17 21:51:49 +02:00
Niels Dossche
d11099ae32
ext/socket: Remove incorrect zval_ptr_dtor 2025-07-17 21:50:35 +02:00
Niels Dossche
bdca73cc14
ext/hash: Remove incorrect zval_ptr_dtor 2025-07-17 21:50:35 +02:00
Tim Düsterhus
7f4076bae0
RFC: Clone with v2 (#18747)
RFC: https://wiki.php.net/rfc/clone_with_v2

Co-authored-by: Volker Dusch <volker@tideways-gmbh.com>
2025-07-17 21:13:42 +02:00
Niels Dossche
8629256dc7
Deduplicate error-handling code in finfo_open (#19149) 2025-07-17 20:45:09 +02:00
Niels Dossche
56308f6490
ext/standard/password: Use zend_string_efree() where possible (#19150) 2025-07-17 18:51:49 +02:00
Jakub Zelenka
a8a3c81528
Update NEWS for recent Curl changes [ci skip] 2025-07-17 15:00:56 +02:00
Emre Çalışkan
7fb6afbe9f
Add support for CURLINFO_QUEUE_TIME_T in curl_getinfo() (#19147)
This patch adds support for the CURLINFO_QUEUE_TIME_T constant in the
curl_getinfo() function when compiled with libcurl >= 8.6.0.

CURLINFO_QUEUE_TIME_T This constant allows retrieving the time (in
microseconds) that the request spent in libcurl’s connection queue
before it was sent.
2025-07-17 14:56:07 +02:00
Ilija Tovilo
0e80be83b3
Fix lineno for cpp assignment
We previously changed the lineno of the property to the cpp argument, but now
also update the lineno for RECV and ASSIGN_OBJ. No test because we don't have a
way to enable lineno's in the opcode dump, and this is not easily testable
through error messages.
2025-07-17 14:07:23 +02:00
Jakub Zelenka
a59caa3c33
Merge branch 'PHP-8.4' 2025-07-17 13:45:32 +02:00
Jakub Zelenka
554ae518a2
Merge branch 'PHP-8.3' into PHP-8.4 2025-07-17 13:45:14 +02:00
Jakub Zelenka
8516ae86d7
Skip LDAP TLS max version test for now 2025-07-17 13:44:21 +02:00
Tim Düsterhus
2e0c011fb8
zend_objects: Remove unnecessary refcounting when calling __clone() (#19145)
Found as part of the clone-with review in php/php-src#18747.
2025-07-16 18:53:04 +02:00
Niels Dossche
62742996f8
Merge branch 'PHP-8.4'
* PHP-8.4:
  ext/xml: Suppress libxml deprecation for `_xmlParserCtxt.inState` (#19131)
2025-07-16 18:27:08 +02:00
Niels Dossche
826fa36ba3
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  ext/xml: Suppress libxml deprecation for `_xmlParserCtxt.inState` (#19131)
2025-07-16 18:27:02 +02:00
Niels Dossche
034c3f2270
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  ext/xml: Suppress libxml deprecation for `_xmlParserCtxt.inState` (#19131)
2025-07-16 18:26:54 +02:00
Niels Dossche
9eee4dd92b
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  ext/xml: Suppress libxml deprecation for `_xmlParserCtxt.inState` (#19131)
2025-07-16 18:24:55 +02:00
Tim Düsterhus
a5df26691d
ext/xml: Suppress libxml deprecation for _xmlParserCtxt.inState (#19131)
The FreeBSD build fails due to the deprecation and -Werror:

    2025-07-15T00:37:20.8390774Z /home/runner/work/php-src/php-src/ext/xml/compat.c:358:38: error: 'instate' is deprecated [-Werror,-Wdeprecated-declarations]
    2025-07-15T00:37:20.8392577Z   358 |                 if (ret == NULL || parser->parser->instate == XML_PARSER_CONTENT) {
    2025-07-15T00:37:20.8393184Z       |                                                    ^
    2025-07-15T00:37:20.8394006Z /usr/local/include/libxml2/libxml/parser.h:309:33: note: 'instate' has been explicitly marked deprecated here
    2025-07-15T00:37:20.8394903Z   309 |     xmlParserInputState instate XML_DEPRECATED_MEMBER;
    2025-07-15T00:37:20.8395413Z       |                                 ^
    2025-07-15T00:37:20.8396166Z /usr/local/include/libxml2/libxml/xmlexports.h:74:50: note: expanded from macro 'XML_DEPRECATED_MEMBER'
    2025-07-15T00:37:20.8397058Z    74 |     #define XML_DEPRECATED_MEMBER __attribute__((deprecated))
    2025-07-15T00:37:20.8397581Z       |                                                  ^
    2025-07-15T00:37:20.8425542Z 1 error generated.
2025-07-16 18:23:54 +02:00
Samuel Melrose
6f1501a601
Add opcache_is_script_cached_in_file_cache() function
Closes GH-16979
2025-07-16 17:37:12 +02:00
Jakub Zelenka
b9844b545f
Merge branch 'PHP-8.4' 2025-07-16 17:32:20 +02:00
Jakub Zelenka
a57f58253a
Merge branch 'PHP-8.3' into PHP-8.4 2025-07-16 17:31:24 +02:00
Jakub Zelenka
eade5c17ea
Fix GH-18529: additional inheriting of TLS int options
This is for LDAP_OPT_X_TLS_PROTOCOL_MIN and LDAP_OPT_X_TLS_PROTOCOL_MAX

It also adds a test that uses LDAPCONF with TLS max version lower than
the minimum TLS server version so it should always fail. However it
does not fial for the second case without this change which confirms
that the change works as expected.

Closes GH-18676
2025-07-16 17:29:42 +02:00
Jakub Zelenka
2afab21ffb
Merge branch 'PHP-8.4' 2025-07-16 14:15:14 +02:00
Jakub Zelenka
4647dfc988
Merge branch 'PHP-8.3' into PHP-8.4 2025-07-16 14:10:35 +02:00
Jakub Zelenka
faf833bffc
PHP 8.3 is now for PHP-8.3.25-dev 2025-07-16 14:09:24 +02:00
Emre Çalışkan
e84320ad75
Add support for CURLINFO_CONN_ID in curl_getinfo() (#18984)
This patch adds support for the CURLINFO_CONN_ID constant in the curl_getinfo() function when compiled with libcurl >= 8.2.0.

CURLINFO_CONN_ID allows retrieving the unique identifier of the underlying connection used in the most recent transfer. This is useful for advanced features like connection reuse tracking, diagnostics, or connection pooling implementations at the PHP level.
2025-07-16 11:08:19 +02:00
Jakub Zelenka
2ecafd41ba
Remove curl OpenSSL locking for unsupported versions (#18784) 2025-07-16 11:06:21 +02:00
Niels Dossche
484d4351c2
Remove redundant operations from zend_llist_clean() (#19143)
This function calls zend_llist_destroy() which already sets the head and
tail pointers since c732ab40.
2025-07-16 09:08:30 +02:00
Máté Kocsis
02b94556cf
Add missing news and upgrading notes for ext/uri
[skip ci]
2025-07-15 22:45:59 +02:00
Máté Kocsis
967377369b
Fix parsing URIs with empty hosts
Both RFC 3986 and WHATWG support empty hosts
2025-07-15 22:28:44 +02:00
Máté Kocsis
889f38135d
Cherry pick some recent lexbor changes
The following changes are cherry-picked:
- c60846689d core/str.c: Fix undefined behavior in function lexbor_str_append
- 92260fd670 URL: fixed hostname setter if port is specified.
2025-07-15 22:28:16 +02:00
Niels Dossche
a22dc67a21
hash: Use zend_string_efree() where possible (#19137)
Mainly motivated to reduce machine code bloat.
2025-07-15 22:03:34 +02:00
Niels Dossche
478a520900
Fix incorrect OpenSSL merge 2025-07-15 21:07:25 +02:00
Niels Dossche
a22eb4d3e5
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix error return check of EVP_CIPHER_CTX_ctrl()
  Fix memleak on failure in collator_get_sort_key()
2025-07-15 20:39:30 +02:00
Niels Dossche
0f731b455c
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix error return check of EVP_CIPHER_CTX_ctrl()
  Fix memleak on failure in collator_get_sort_key()
2025-07-15 20:38:22 +02:00
Niels Dossche
cd8722304c
Fix error return check of EVP_CIPHER_CTX_ctrl()
OpenSSL can return -1 on error [1, 2], and OpenBSD's docs confirm this
[3]. Change all checks to <= 0.

[1] b3161bd9a9/crypto/evp/evp_enc.c (L1530-L1531)
[2] b3161bd9a9/crypto/evp/evp_enc.c (L1611)
[3] https://man.openbsd.org/EVP_CIPHER_CTX_ctrl.3

Closes GH-18987.
2025-07-15 20:37:33 +02:00
Niels Dossche
b495ce0371
Fix memleak on failure in collator_get_sort_key()
Closes GH-19138.
2025-07-15 20:36:56 +02:00
Niels Dossche
1089896b8c
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-18986: OpenSSL backend: incorrect RAND_{load,write}_file() return value check
2025-07-15 18:52:56 +02:00
Niels Dossche
f938f356cb
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-18986: OpenSSL backend: incorrect RAND_{load,write}_file() return value check
2025-07-15 18:50:46 +02:00
Niels Dossche
a8086be81c
Fix GH-18986: OpenSSL backend: incorrect RAND_{load,write}_file() return value check
As noted by the LibreSSL maintainer, these functions return -1 on error.
This is further confirmed by my static analyzer that inferred the same
thing for OpenSSL.

Closes GH-19013.
2025-07-15 18:50:19 +02:00
Calvin Buckley
7232c15b3e
Merge branch 'PHP-8.4'
* PHP-8.4:
  PHP-8.4 is now for PHP 8.4.12-dev
2025-07-15 13:50:05 -03:00
Calvin Buckley
3d468a181a
PHP-8.4 is now for PHP 8.4.12-dev 2025-07-15 13:46:33 -03:00
Dmitrii Derepko
ea9a7b2523
refactor: Drop unused op_array param from zend_get_brk_cont_target() (GH-19117) 2025-07-15 16:38:00 +02:00
Tim Düsterhus
b08753eef0
[skip ci] Fix NEWS for GH-19114
This did not make the cut for Alpha 2.
2025-07-15 14:28:57 +02:00
Volker Dusch
fec641d27a
Update NEWS for PHP 8.5.0 alpha2 2025-07-15 14:23:06 +02:00
David Carlier
64852b44b5
ext/sockets: multicast on unsupported socket type error change.
From a mere warning to an exception.

close GH-19114
2025-07-15 13:05:13 +01:00
1381 changed files with 23317 additions and 13630 deletions

View file

@ -90,7 +90,6 @@ jobs:
--prefix=/usr \
--enable-phpdbg \
--enable-fpm \
--enable-opcache \
--with-pdo-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pgsql \
@ -168,7 +167,6 @@ jobs:
no_output_timeout: 30m
command: |
sapi/cli/php run-tests.php \
-d zend_extension=opcache.so \
-d opcache.enable_cli=1 \
-d opcache.jit_buffer_size=64M \
-d opcache.jit=tracing \

2
.github/CODEOWNERS vendored
View file

@ -16,7 +16,7 @@
/.github @TimWolla
/build/gen_stub.php @kocsismate
/ext/bcmath @Girgias @nielsdos @SakiTakamachi
/ext/bcmath @nielsdos @SakiTakamachi
/ext/curl @adoy
/ext/date @derickr
/ext/dba @Girgias

View file

@ -6,6 +6,8 @@ runs:
run: |
set -x
OPCACHE_TLS_TESTS_DEPS="clang gcc binutils-gold lld"
apk update -q
apk add \
util-linux \
@ -53,4 +55,5 @@ runs:
postgresql14-dev \
tzdata \
musl-locales \
musl-locales-lang
musl-locales-lang \
$OPCACHE_TLS_TESTS_DEPS

View file

@ -6,6 +6,8 @@ runs:
run: |
set -x
OPCACHE_TLS_TESTS_DEPS="gcc clang lld"
export DEBIAN_FRONTEND=noninteractive
dpkg --add-architecture i386
apt-get update -y | true
@ -35,7 +37,6 @@ runs:
libssl-dev:i386 \
libwebp-dev:i386 \
libxml2-dev:i386 \
libxml2-dev:i386 \
libxpm-dev:i386 \
libxslt1-dev:i386 \
firebird-dev:i386 \
@ -45,4 +46,5 @@ runs:
re2c \
unzip \
wget \
zlib1g-dev:i386
zlib1g-dev:i386 \
$OPCACHE_TLS_TESTS_DEPS

View file

@ -10,6 +10,8 @@ runs:
run: |
set -x
OPCACHE_TLS_TESTS_DEPS="gcc clang lld"
export DEBIAN_FRONTEND=noninteractive
# Install sudo in Docker for consistent actions
@ -74,4 +76,5 @@ runs:
libqdbm-dev \
libjpeg-dev \
libpng-dev \
libfreetype6-dev
libfreetype6-dev \
$OPCACHE_TLS_TESTS_DEPS

View file

@ -0,0 +1,7 @@
name: Extra tests
runs:
using: composite
steps:
- shell: sh
run: |
sapi/cli/php run-extra-tests.php

View file

@ -3,13 +3,16 @@ inputs:
configurationParameters:
default: ''
required: false
runExtraTests:
default: false
required: false
runs:
using: composite
steps:
- name: FreeBSD
uses: vmactions/freebsd-vm@v1
with:
release: '13.3'
release: '13.5'
usesh: true
copyback: false
# Temporarily disable sqlite, as FreeBSD ships it with disabled double quotes. We'll need to fix our tests.
@ -17,6 +20,8 @@ runs:
prepare: |
cd $GITHUB_WORKSPACE
OPCACHE_TLS_TESTS_DEPS="gcc"
kldload accf_http
pkg install -y \
autoconf \
@ -41,9 +46,11 @@ runs:
webp \
libavif \
`#sqlite3` \
curl
curl \
$OPCACHE_TLS_TESTS_DEPS
./buildconf -f
CC=clang CXX=clang++ \
./configure \
--prefix=/usr/local \
--enable-debug \
@ -106,5 +113,8 @@ runs:
--offline \
--show-diff \
--show-slow 1000 \
--set-timeout 120 \
-d zend_extension=opcache.so
--set-timeout 120
if test "${{ inputs.runExtraTests }}" = "true"; then
sapi/cli/php run-extra-tests.php
fi

View file

@ -72,6 +72,9 @@ olcTLSCertificateKeyFile: /etc/ldap/ssl/server.key
add: olcTLSVerifyClient
olcTLSVerifyClient: never
-
add: olcTLSProtocolMin
olcTLSProtocolMin: 3.3
-
add: olcAuthzRegexp
olcAuthzRegexp: uid=usera,cn=digest-md5,cn=auth cn=usera,dc=my-domain,dc=com
-

View file

@ -128,7 +128,7 @@ mkdir %PHP_BUILD_DIR%\test_file_cache
rem generate php.ini
echo extension_dir=%PHP_BUILD_DIR% > %PHP_BUILD_DIR%\php.ini
echo opcache.file_cache=%PHP_BUILD_DIR%\test_file_cache >> %PHP_BUILD_DIR%\php.ini
if "%OPCACHE%" equ "1" echo zend_extension=php_opcache.dll >> %PHP_BUILD_DIR%\php.ini
echo opcache.record_warnings=1 >> %PHP_BUILD_DIR%\php.ini
rem work-around for some spawned PHP processes requiring OpenSSL and sockets
echo extension=php_openssl.dll >> %PHP_BUILD_DIR%\php.ini
echo extension=php_sockets.dll >> %PHP_BUILD_DIR%\php.ini

View file

@ -17,7 +17,7 @@ jobs:
if: github.repository == 'php/php-src'
steps:
- name: git checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Install dependencies
run: pip install -r docs/requirements.txt
- name: Check formatting

View file

@ -54,7 +54,7 @@ jobs:
runs-on: [self-hosted, gentoo, ppc64]
steps:
- name: git checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
ref: ${{ inputs.branch }}
- name: System info
@ -85,6 +85,8 @@ jobs:
with:
runTestsParameters: >-
--asan -x
- name: Extra tests
uses: ./.github/actions/extra-tests
ALPINE:
if: inputs.run_alpine
name: ALPINE_X64_ASAN_UBSAN_DEBUG_ZTS
@ -93,7 +95,7 @@ jobs:
image: 'alpine:3.20.1'
steps:
- name: git checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
ref: ${{ inputs.branch }}
- name: apk
@ -132,8 +134,9 @@ jobs:
jitType: tracing
runTestsParameters: >-
--asan -x
-d zend_extension=opcache.so
-d opcache.enable_cli=1
- name: Extra tests
uses: ./.github/actions/extra-tests
- name: Notify Slack
if: failure()
uses: ./.github/actions/notify-slack
@ -203,7 +206,7 @@ jobs:
runs-on: ubuntu-${{ matrix.asan && inputs.asan_ubuntu_version || inputs.ubuntu_version }}
steps:
- name: git checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
ref: ${{ inputs.branch }}
- name: Create MSSQL container
@ -246,14 +249,12 @@ jobs:
jitType: tracing
runTestsParameters: >-
${{ matrix.run_tests_parameters }}
-d zend_extension=opcache.so
-d opcache.enable_cli=1
- name: Test OpCache
uses: ./.github/actions/test-linux
with:
runTestsParameters: >-
${{ matrix.run_tests_parameters }}
-d zend_extension=opcache.so
-d opcache.enable_cli=1
- name: Test Function JIT
# ASAN frequently timeouts. Each test run takes ~90 minutes, we can
@ -264,8 +265,9 @@ jobs:
jitType: function
runTestsParameters: >-
${{ matrix.run_tests_parameters }}
-d zend_extension=opcache.so
-d opcache.enable_cli=1
- name: Extra tests
uses: ./.github/actions/extra-tests
- name: Verify generated files are up to date
uses: ./.github/actions/verify-generated-files
- name: Notify Slack
@ -304,7 +306,7 @@ jobs:
FIREBIRD_PASSWORD: test
steps:
- name: git checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
ref: ${{ inputs.branch }}
- name: apt
@ -338,14 +340,12 @@ jobs:
jitType: tracing
runTestsParameters: >-
${{ matrix.run_tests_parameters }}
-d zend_extension=opcache.so
-d opcache.enable_cli=1
- name: Test OpCache
uses: ./.github/actions/test-linux
with:
runTestsParameters: >-
${{ matrix.run_tests_parameters }}
-d zend_extension=opcache.so
-d opcache.enable_cli=1
- name: Test Function JIT
uses: ./.github/actions/test-linux
@ -353,8 +353,9 @@ jobs:
jitType: function
runTestsParameters: >-
${{ matrix.run_tests_parameters }}
-d zend_extension=opcache.so
-d opcache.enable_cli=1
- name: Extra tests
uses: ./.github/actions/extra-tests
- name: Notify Slack
if: failure()
uses: ./.github/actions/notify-slack
@ -373,7 +374,7 @@ jobs:
runs-on: macos-${{ matrix.os }}
steps:
- name: git checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
ref: ${{ inputs.branch }}
- name: brew
@ -398,13 +399,11 @@ jobs:
with:
jitType: tracing
runTestsParameters: >-
-d zend_extension=opcache.so
-d opcache.enable_cli=1
- name: Test OpCache
uses: ./.github/actions/test-macos
with:
runTestsParameters: >-
-d zend_extension=opcache.so
-d opcache.enable_cli=1
- name: Test Function JIT
if: matrix.os != '14' || !matrix.zts
@ -412,8 +411,9 @@ jobs:
with:
jitType: function
runTestsParameters: >-
-d zend_extension=opcache.so
-d opcache.enable_cli=1
- name: Extra tests
uses: ./.github/actions/extra-tests
- name: Verify generated files are up to date
uses: ./.github/actions/verify-generated-files
- name: Notify Slack
@ -449,7 +449,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: git checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
ref: ${{ inputs.branch }}
- name: Create MSSQL container
@ -474,7 +474,6 @@ jobs:
with:
jitType: tracing
runTestsParameters: >-
-d zend_extension=opcache.so
-d opcache.enable_cli=1
- uses: codecov/codecov-action@v4
if: ${{ !cancelled() }}
@ -503,7 +502,7 @@ jobs:
USE_TRACKED_ALLOC: 1
steps:
- name: git checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
ref: ${{ inputs.branch }}
- name: apt
@ -528,7 +527,6 @@ jobs:
- name: Enable Opcache
run: |
echo memory_limit=-1 >> /etc/php.d/opcache.ini
echo zend_extension=opcache.so > /etc/php.d/opcache.ini
echo opcache.enable_cli=1 >> /etc/php.d/opcache.ini
echo opcache.enable=1 >> /etc/php.d/opcache.ini
echo opcache.protect_memory=1 >> /etc/php.d/opcache.ini
@ -555,14 +553,17 @@ jobs:
repositories="amp cache dns file http parallel parser pipeline process serialization socket sync websocket-client websocket-server"
X=0
for repository in $repositories; do
printf "Testing amp/%s\n" "$repository"
echo "::group::$repository"
git clone "https://github.com/amphp/$repository.git" "amphp-$repository" --depth 1
cd "amphp-$repository"
git rev-parse HEAD
php /usr/bin/composer install --no-progress --ignore-platform-req=php+
EXIT_CODE=0
vendor/bin/phpunit || EXIT_CODE=$?
echo -e "\n::endgroup::"
if [ ${EXIT_CODE:-0} -gt 128 ]; then
X=1;
echo "Failed"
fi
cd ..
done
@ -586,14 +587,17 @@ jobs:
repositories="async cache child-process datagram dns event-loop promise promise-stream promise-timer stream"
X=0
for repository in $repositories; do
printf "Testing reactphp/%s\n" "$repository"
echo "::group::$repository"
git clone "https://github.com/reactphp/$repository.git" "reactphp-$repository" --depth 1
cd "reactphp-$repository"
git rev-parse HEAD
php /usr/bin/composer install --no-progress --ignore-platform-req=php+
EXIT_CODE=0
vendor/bin/phpunit || EXIT_CODE=$?
echo -e "\n::endgroup::"
if [ $[EXIT_CODE:-0} -gt 128 ]; then
X=1;
echo "Failed"
fi
cd ..
done
@ -618,15 +622,19 @@ jobs:
php /usr/bin/composer install --no-progress --ignore-platform-req=php+
php ./phpunit install
# Test causes a heap-buffer-overflow but I cannot reproduce it locally...
php -r '$c = file_get_contents("src/Symfony/Component/HtmlSanitizer/Tests/HtmlSanitizerCustomTest.php"); $c = str_replace("public function testSanitizeDeepNestedString()", "/** @group skip */\n public function testSanitizeDeepNestedString()", $c); file_put_contents("src/Symfony/Component/HtmlSanitizer/Tests/HtmlSanitizerCustomTest.php", $c);'
php -r '$c = file_get_contents("src/Symfony/Component/HtmlSanitizer/Tests/HtmlSanitizerCustomTest.php"); $c = str_replace("public function testSanitizeDeepNestedString()", "#[\\PHPUnit\\Framework\\Attributes\\Group('"'"'skip'"'"')]\n public function testSanitizeDeepNestedString()", $c); file_put_contents("src/Symfony/Component/HtmlSanitizer/Tests/HtmlSanitizerCustomTest.php", $c);'
# Buggy FFI test in Symfony, see https://github.com/symfony/symfony/issues/47668
php -r '$c = file_get_contents("src/Symfony/Component/VarDumper/Tests/Caster/FFICasterTest.php"); $c = str_replace("public function testCastNonTrailingCharPointer()", "/** @group skip */\n public function testCastNonTrailingCharPointer()", $c); file_put_contents("src/Symfony/Component/VarDumper/Tests/Caster/FFICasterTest.php", $c);'
php -r '$c = file_get_contents("src/Symfony/Component/VarDumper/Tests/Caster/FFICasterTest.php"); $c = str_replace("public function testCastNonTrailingCharPointer()", "#[\\PHPUnit\\Framework\\Attributes\\Group('"'"'skip'"'"')]\n public function testCastNonTrailingCharPointer()", $c); file_put_contents("src/Symfony/Component/VarDumper/Tests/Caster/FFICasterTest.php", $c);'
export SYMFONY_DEPRECATIONS_HELPER=max[total]=999
X=0
for component in $(find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist -printf '%h\n'); do
php ./phpunit $component --exclude-group tty,benchmark,intl-data,transient --exclude-group skip || EXIT_CODE=$?
echo "::group::$component"
EXIT_CODE=0
php ./phpunit $component --exclude-group tty --exclude-group benchmark --exclude-group intl-data --exclude-group transient --exclude-group skip || EXIT_CODE=$?
echo -e "\n::endgroup::"
if [ ${EXIT_CODE:-0} -gt 128 ]; then
X=1;
echo "Failed"
fi
done
exit $X
@ -697,7 +705,7 @@ jobs:
runs-on: ubuntu-${{ inputs.ubuntu_version }}
steps:
- name: git checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
ref: ${{ inputs.branch }}
- name: Create MSSQL container
@ -719,21 +727,18 @@ jobs:
uses: ./.github/actions/test-linux
with:
runTestsParameters: >-
-d zend_extension=opcache.so
-d opcache.enable_cli=1
--file-cache-prime
- name: Test File Cache (prime shm, use shm)
uses: ./.github/actions/test-linux
with:
runTestsParameters: >-
-d zend_extension=opcache.so
-d opcache.enable_cli=1
--file-cache-use
- name: Test File Cache (prime shm, use file)
uses: ./.github/actions/test-linux
with:
runTestsParameters: >-
-d zend_extension=opcache.so
-d opcache.enable_cli=1
--file-cache-use
-d opcache.file_cache_only=1
@ -741,7 +746,6 @@ jobs:
uses: ./.github/actions/test-linux
with:
runTestsParameters: >-
-d zend_extension=opcache.so
-d opcache.enable_cli=1
--file-cache-prime
-d opcache.file_cache_only=1
@ -749,7 +753,6 @@ jobs:
uses: ./.github/actions/test-linux
with:
runTestsParameters: >-
-d zend_extension=opcache.so
-d opcache.enable_cli=1
--file-cache-use
-d opcache.file_cache_only=1
@ -765,7 +768,7 @@ jobs:
runs-on: ubuntu-${{ inputs.ubuntu_version }}
steps:
- name: git checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
ref: ${{ inputs.branch }}
- name: apt
@ -843,7 +846,6 @@ jobs:
with:
runTestsParameters: >-
--msan
-d zend_extension=opcache.so
-d opcache.enable_cli=1
- name: Verify generated files are up to date
uses: ./.github/actions/verify-generated-files
@ -857,7 +859,7 @@ jobs:
runs-on: ubuntu-${{ inputs.ubuntu_version }}
steps:
- name: git checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
ref: ${{ inputs.branch }}
- name: apt
@ -907,38 +909,38 @@ jobs:
CXX: ccache g++
steps:
- name: git checkout PHP
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
path: php
ref: ${{ inputs.branch }}
- name: git checkout apcu
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
repository: krakjoe/apcu
path: apcu
- name: git checkout imagick
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
repository: Imagick/imagick
path: imagick
- name: git checkout memcached
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
repository: php-memcached-dev/php-memcached
path: memcached
- name: git checkout redis
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
repository: phpredis/phpredis
path: redis
- name: git checkout xdebug
if: false
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
repository: xdebug/xdebug
path: xdebug
- name: git checkout yaml
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
repository: php/pecl-file_formats-yaml
path: yaml
@ -1048,7 +1050,7 @@ jobs:
- name: git config
run: git config --global core.autocrlf false && git config --global core.eol lf
- name: git checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
ref: ${{ inputs.branch }}
- name: Setup
@ -1066,9 +1068,10 @@ jobs:
- zts: ${{ !inputs.run_freebsd_zts && true || '*never*' }}
name: "FREEBSD_${{ matrix.zts && 'ZTS' || 'NTS' }}"
runs-on: ubuntu-latest
timeout-minutes: 50
steps:
- name: git checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
ref: ${{ inputs.branch }}
- name: FreeBSD
@ -1076,3 +1079,4 @@ jobs:
with:
configurationParameters: >-
--${{ matrix.zts && 'enable' || 'disable' }}-zts
runExtraTests: true

View file

@ -82,7 +82,7 @@ jobs:
timeout-minutes: 50
steps:
- name: git checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: apt
uses: ./.github/actions/apt-x64
- name: System info
@ -130,7 +130,6 @@ jobs:
with:
jitType: tracing
runTestsParameters: >-
-d zend_extension=opcache.so
-d opcache.enable_cli=1
${{ matrix.asan && '--asan -x' || '' }}
- name: Verify generated files are up to date
@ -167,7 +166,7 @@ jobs:
FIREBIRD_PASSWORD: test
steps:
- name: git checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: apt
uses: ./.github/actions/apt-x32
- name: ccache
@ -190,7 +189,6 @@ jobs:
with:
jitType: tracing
runTestsParameters: >-
-d zend_extension=opcache.so
-d opcache.enable_cli=1
MACOS_DEBUG_NTS:
if: github.repository == 'php/php-src' || github.event_name == 'pull_request'
@ -198,14 +196,14 @@ jobs:
fail-fast: false
matrix:
include:
- os: 14
- os: 15
arch: ARM64
name: MACOS_${{ matrix.arch }}_DEBUG_NTS
runs-on: macos-${{ matrix.os }}
timeout-minutes: 50
steps:
- name: git checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: brew
uses: ./.github/actions/brew
- name: ccache
@ -229,7 +227,6 @@ jobs:
with:
jitType: tracing
runTestsParameters: >-
-d zend_extension=opcache.so
-d opcache.enable_cli=1
- name: Verify generated files are up to date
uses: ./.github/actions/verify-generated-files
@ -253,7 +250,7 @@ jobs:
- name: git config
run: git config --global core.autocrlf false && git config --global core.eol lf
- name: git checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Setup
uses: ./.github/actions/setup-windows
- name: Build
@ -267,7 +264,7 @@ jobs:
timeout-minutes: 50
steps:
- name: git checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
fetch-depth: 0
# ASLR can cause a lot of noise due to missed sse opportunities for memcpy
@ -299,7 +296,6 @@ jobs:
./configure \
--disable-debug \
--enable-mbstring \
--enable-opcache \
--enable-option-checking=fatal \
--enable-sockets \
--enable-werror \
@ -319,7 +315,6 @@ jobs:
sudo mkdir -p /etc/php.d
sudo chmod 777 /etc/php.d
echo mysqli.default_socket=/var/run/mysqld/mysqld.sock > /etc/php.d/mysqli.ini
echo zend_extension=opcache.so >> /etc/php.d/opcache.ini
echo opcache.enable=1 >> /etc/php.d/opcache.ini
echo opcache.enable_cli=1 >> /etc/php.d/opcache.ini
- name: Setup
@ -331,7 +326,7 @@ jobs:
mysql -uroot -proot -e "CREATE USER 'wordpress'@'localhost' IDENTIFIED BY 'wordpress'; FLUSH PRIVILEGES;"
mysql -uroot -proot -e "GRANT ALL PRIVILEGES ON *.* TO 'wordpress'@'localhost' WITH GRANT OPTION;"
- name: git checkout benchmarking-data
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
repository: php/benchmarking-data
ssh-key: ${{ secrets.BENCHMARKING_DATA_DEPLOY_KEY }}
@ -371,8 +366,9 @@ jobs:
if: github.repository == 'php/php-src' || github.event_name == 'pull_request'
name: FREEBSD
runs-on: ubuntu-latest
timeout-minutes: 50
steps:
- name: git checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: FreeBSD
uses: ./.github/actions/freebsd

View file

@ -2,14 +2,94 @@ name: Real-time Benchmark
on:
schedule:
- cron: "30 0 * * *"
workflow_dispatch:
inputs:
pull_request:
description: 'PR number that is going to be benchmarked (e.g. "1234")'
required: true
type: number
jit:
description: 'Whether JIT is benchmarked'
required: false
default: "0"
type: choice
options:
- "0"
- "1"
instruction_count:
description: 'Whether Valgrind instruction count should be measured'
required: true
default: "0"
type: choice
options:
- "0"
- "1"
opcache:
description: 'Whether opcache is enabled for the benchmarked commit'
required: true
default: "1"
type: choice
options:
- "0"
- "1"
- "2"
baseline_opcache:
description: 'Whether opcache is enabled for the baseline commit'
required: true
default: "1"
type: choice
options:
- "0"
- "1"
- "2"
permissions:
contents: read
pull-requests: write
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false
jobs:
REAL_TIME_BENCHMARK:
name: REAL_TIME_BENCHMARK
if: github.repository == 'php/php-src'
if: github.repository == 'php/php-src' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-22.04
env:
REPOSITORY: ${{ github.repository }}
BRANCH: "master"
COMMIT: ${{ github.sha }}
BASELINE_COMMIT: "d5f6e56610c729710073350af318c4ea1b292cfe"
ID: "master"
OPCACHE: ${{ inputs.opcache || '1' }}
BASELINE_OPCACHE: ${{ inputs.baseline_opcache || '2' }}
JIT: ${{ inputs.jit || '1' }}
INSTRUCTION_COUNT: ${{ inputs.instruction_count || '0' }}
YEAR: ""
steps:
- name: Setup benchmark environment
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
YEAR="$(date '+%Y')"
echo "YEAR=$YEAR" >> $GITHUB_ENV
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
PR_INFO=$(gh pr view ${{ inputs.pull_request }} --json headRepositoryOwner,headRepository,headRefName,headRefOid,baseRefOid --repo ${{ github.repository }} | jq -r '.headRepositoryOwner.login, .headRepository.name, .headRefName, .headRefOid, .baseRefOid')
REPOSITORY="$(echo "$PR_INFO" | sed -n '1p')/$(echo "$PR_INFO" | sed -n '2p')"
echo "REPOSITORY=$REPOSITORY" >> $GITHUB_ENV
BRANCH=$(echo "$PR_INFO" | sed -n '3p')
echo "BRANCH=$BRANCH" >> $GITHUB_ENV
COMMIT=$(echo "$PR_INFO" | sed -n '4p')
echo "COMMIT=$COMMIT" >> $GITHUB_ENV
BASELINE_COMMIT=$(echo "$PR_INFO" | sed -n '5p')
echo "BASELINE_COMMIT=$BASELINE_COMMIT" >> $GITHUB_ENV
echo "ID=benchmarked" >> $GITHUB_ENV
fi
- name: Install dependencies
run: |
set -ex
@ -23,77 +103,149 @@ jobs:
sudo apt-get update -y
sudo apt-get install -y terraform=1.5.7-*
- name: Checkout benchmark suite
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
repository: 'kocsismate/php-version-benchmarks'
ref: 'main'
fetch-depth: 1
path: 'php-version-benchmarks'
- name: Checkout php-src
uses: actions/checkout@v4
- name: Checkout php-src (benchmarked version)
uses: actions/checkout@v5
with:
repository: 'php/php-src'
ref: '${{ github.sha }}'
repository: '${{ env.REPOSITORY }}'
ref: '${{ env.COMMIT }}'
fetch-depth: 100
path: 'php-version-benchmarks/tmp/php_master'
path: 'php-version-benchmarks/tmp/php_${{ env.ID }}'
- name: Checkout php-src (baseline version)
uses: actions/checkout@v5
with:
repository: '${{ env.REPOSITORY }}'
ref: '${{ env.BASELINE_COMMIT }}'
fetch-depth: 100
path: 'php-version-benchmarks/tmp/php_baseline'
- name: Setup benchmark results
run: |
git config --global user.name "Benchmark"
git config --global user.email "benchmark@php.net"
rm -rf ./php-version-benchmarks/docs/results
- name: Checkout benchmark data
uses: actions/checkout@v4
if: github.event_name != 'workflow_dispatch'
uses: actions/checkout@v5
with:
repository: php/real-time-benchmark-data
ssh-key: ${{ secrets.PHP_VERSION_BENCHMARK_RESULTS_DEPLOY_KEY }}
path: 'php-version-benchmarks/docs/results'
- name: Set benchmark config
- name: Setup infra config
run: |
set -e
# Set infrastructure config
cp ./php-version-benchmarks/config/infra/aws/x86_64-metal.ini.dist ./php-version-benchmarks/config/infra/aws/x86_64-metal.ini
ESCAPED_DOCKER_REGISTRY=$(printf '%s\n' "${{ secrets.PHP_VERSION_BENCHMARK_DOCKER_REGISTRY }}" | sed -e 's/[\/&]/\\&/g')
sed -i "s/INFRA_DOCKER_REGISTRY=public.ecr.aws\/abcdefgh/INFRA_DOCKER_REGISTRY=$ESCAPED_DOCKER_REGISTRY/g" ./php-version-benchmarks/config/infra/aws/x86_64-metal.ini
sed -i "s/INFRA_MEASURE_INSTRUCTION_COUNT=0/INFRA_MEASURE_INSTRUCTION_COUNT=${{ env.INSTRUCTION_COUNT }}/g" ./php-version-benchmarks/config/infra/aws/x86_64-metal.ini
cp ./php-version-benchmarks/build/infrastructure/config/aws.tfvars.dist ./php-version-benchmarks/build/infrastructure/config/aws.tfvars
sed -i 's/access_key = ""/access_key = "${{ secrets.PHP_VERSION_BENCHMARK_AWS_ACCESS_KEY }}"/g' ./php-version-benchmarks/build/infrastructure/config/aws.tfvars
sed -i 's/secret_key = ""/secret_key = "${{ secrets.PHP_VERSION_BENCHMARK_AWS_SECRET_KEY }}"/g' ./php-version-benchmarks/build/infrastructure/config/aws.tfvars
sed -i 's/github_token = ""/github_token = "${{ secrets.GITHUB_TOKEN }}"/g' ./php-version-benchmarks/build/infrastructure/config/aws.tfvars
- name: Setup PHP config - baseline PHP version
run: |
set -e
YEAR="$(date '+%Y')"
DATABASE="./php-version-benchmarks/docs/results/$YEAR/database.tsv"
BASELINE_SHORT_SHA="$(echo "${{ env.BASELINE_COMMIT }}" | cut -c1-4)"
cat << EOF > ./php-version-benchmarks/config/php/baseline.ini
PHP_NAME="PHP - baseline@$BASELINE_SHORT_SHA"
PHP_ID=php_baseline
PHP_REPO=https://github.com/${{ env.REPOSITORY }}.git
PHP_BRANCH=${{ env.BRANCH }}
PHP_COMMIT=${{ env.BASELINE_COMMIT }}
PHP_OPCACHE=${{ env.BASELINE_OPCACHE }}
PHP_JIT=0
EOF
- name: Setup PHP config - baseline PHP version with JIT
if: github.event_name == 'workflow_dispatch' && inputs.jit == '1'
run: |
set -e
BASELINE_SHORT_SHA="$(echo "${{ env.BASELINE_COMMIT }}" | cut -c1-4)"
cat << EOF > ./php-version-benchmarks/config/php/baseline_jit.ini
PHP_NAME="PHP - baseline@$BASELINE_SHORT_SHA (JIT)"
PHP_ID=php_baseline_jit
PHP_REPO=https://github.com/${{ env.REPOSITORY }}.git
PHP_BRANCH=${{ env.BRANCH }}
PHP_COMMIT=${{ env.BASELINE_COMMIT }}
PHP_OPCACHE=${{ env.BASELINE_OPCACHE }}
PHP_JIT=${{ env.JIT }}
EOF
git clone ./php-version-benchmarks/tmp/php_baseline/ ./php-version-benchmarks/tmp/php_baseline_jit
- name: Setup PHP config - previous PHP version
if: github.event_name != 'workflow_dispatch'
run: |
set -e
DATABASE="./php-version-benchmarks/docs/results/${{ env.YEAR }}/database.tsv"
if [ -f "$DATABASE" ]; then
LAST_RESULT_SHA="$(tail -n 2 "$DATABASE" | head -n 1 | cut -f 6)"
else
YESTERDAY="$(date -d "-2 day 23:59:59" '+%Y-%m-%d %H:%M:%S')"
LAST_RESULT_SHA="$(cd ./php-version-benchmarks/tmp/php_master/ && git --no-pager log --until="$YESTERDAY" -n 1 --pretty='%H')"
LAST_RESULT_SHA="$(cd ./php-version-benchmarks/tmp/php_${{ env.ID }}/ && git --no-pager log --until="$YESTERDAY" -n 1 --pretty='%H')"
fi
BASELINE_SHA="d5f6e56610c729710073350af318c4ea1b292cfe"
BASELINE_SHORT_SHA="$(echo "$BASELINE_SHA" | cut -c1-4)"
cat << EOF > ./php-version-benchmarks/config/php/previous.ini
PHP_NAME="PHP - previous ${{ env.BRANCH }}"
PHP_ID=php_previous
# Set config for the baseline PHP version
cp ./php-version-benchmarks/config/php/master.ini.dist ./php-version-benchmarks/config/php/master_baseline.ini
sed -i 's/PHP_NAME="PHP - master"/PHP_NAME="PHP - baseline@'"$BASELINE_SHORT_SHA"'"/g' ./php-version-benchmarks/config/php/master_baseline.ini
sed -i "s/PHP_ID=php_master/PHP_ID=php_master_baseline/g" ./php-version-benchmarks/config/php/master_baseline.ini
sed -i "s/PHP_COMMIT=/PHP_COMMIT=$BASELINE_SHA/g" ./php-version-benchmarks/config/php/master_baseline.ini
PHP_REPO=https://github.com/${{ env.REPOSITORY }}.git
PHP_BRANCH=${{ env.BRANCH }}
PHP_COMMIT=$LAST_RESULT_SHA
# Set config for the previous PHP version
cp ./php-version-benchmarks/config/php/master.ini.dist ./php-version-benchmarks/config/php/master_last.ini
sed -i 's/PHP_NAME="PHP - master"/PHP_NAME="PHP - previous master"/g' ./php-version-benchmarks/config/php/master_last.ini
sed -i "s/PHP_ID=php_master/PHP_ID=php_master_previous/g" ./php-version-benchmarks/config/php/master_last.ini
sed -i "s/PHP_COMMIT=/PHP_COMMIT=$LAST_RESULT_SHA/g" ./php-version-benchmarks/config/php/master_last.ini
PHP_OPCACHE=1
PHP_JIT=0
EOF
- name: Setup PHP config - benchmarked PHP version
run: |
set -e
# Set config for the current PHP version
cp ./php-version-benchmarks/config/php/master.ini.dist ./php-version-benchmarks/config/php/master_now.ini
sed -i "s/PHP_COMMIT=/PHP_COMMIT=${{ github.sha }}/g" ./php-version-benchmarks/config/php/master_now.ini
cat << EOF > ./php-version-benchmarks/config/php/this.ini
PHP_NAME="PHP - ${{ env.BRANCH }}"
PHP_ID=php_${{ env.ID }}
# Set config for current PHP version with JIT
git clone ./php-version-benchmarks/tmp/php_master/ ./php-version-benchmarks/tmp/php_master_jit
cp ./php-version-benchmarks/config/php/master_jit.ini.dist ./php-version-benchmarks/config/php/master_now_jit.ini
sed -i "s/PHP_COMMIT=/PHP_COMMIT=${{ github.sha }}/g" ./php-version-benchmarks/config/php/master_now_jit.ini
PHP_REPO=https://github.com/${{ env.REPOSITORY }}.git
PHP_BRANCH=${{ env.BRANCH }}
PHP_COMMIT=${{ env.COMMIT }}
PHP_OPCACHE=${{ env.OPCACHE }}
PHP_JIT=0
EOF
- name: Setup PHP config - benchmarked PHP version with JIT
if: env.JIT == '1'
run: |
set -e
cat << EOF > ./php-version-benchmarks/config/php/this_jit.ini
PHP_NAME="PHP - ${{ env.BRANCH }} (JIT)"
PHP_ID=php_${{ env.ID }}_jit
PHP_REPO=https://github.com/${{ env.REPOSITORY }}.git
PHP_BRANCH=${{ env.BRANCH }}
PHP_COMMIT=${{ env.COMMIT }}
PHP_OPCACHE=${{ env.OPCACHE }}
PHP_JIT=${{ env.JIT }}
EOF
git clone ./php-version-benchmarks/tmp/php_${{ env.ID }}/ ./php-version-benchmarks/tmp/php_${{ env.ID }}_jit
- name: Setup test config
run: |
set -e
# Set test configs
cp ./php-version-benchmarks/config/test/1_laravel.ini.dist ./php-version-benchmarks/config/test/1_laravel.ini
cp ./php-version-benchmarks/config/test/2_symfony_main.ini.dist ./php-version-benchmarks/config/test/2_symfony_main.ini
cp ./php-version-benchmarks/config/test/4_wordpress.ini.dist ./php-version-benchmarks/config/test/4_wordpress.ini
@ -102,6 +254,7 @@ jobs:
- name: Run benchmark
run: ./php-version-benchmarks/benchmark.sh run aws
- name: Store results
if: github.repository == 'php/php-src' && github.event_name != 'workflow_dispatch'
run: |
set -ex
@ -117,6 +270,21 @@ jobs:
fi
git commit -m "Add result for ${{ github.repository }}@${{ github.sha }}"
git push
- name: Upload artifact
if: github.event_name == 'workflow_dispatch'
uses: actions/upload-artifact@v4
with:
name: results
path: ./php-version-benchmarks/docs/results/${{ env.YEAR }}
retention-days: 30
- name: Comment results
if: github.event_name == 'workflow_dispatch'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd ./php-version-benchmarks/tmp/php_${{ env.ID }}
NEWEST_RESULT_DIRECTORY=$(ls -td ${{ github.workspace }}/php-version-benchmarks/docs/results/${{ env.YEAR }}/*/ | head -1)
gh pr comment ${{ inputs.pull_request }} --body-file "${NEWEST_RESULT_DIRECTORY}result.md" --repo ${{ github.repository }}
- name: Cleanup
if: always()
run: |

View file

@ -13,7 +13,7 @@ jobs:
outputs:
branches: ${{ steps.set-matrix.outputs.branches }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
with:
# Set fetch-depth to 0 to clone the full repository
# including all branches. This is required to find

1
.gitignore vendored
View file

@ -131,6 +131,7 @@ config.h.in
/sapi/cgi/php-cgi
/sapi/fpm/php-fpm
/sapi/phpdbg/phpdbg
/sapi/fuzzer/php-fuzz-*
/scripts/php-config
/scripts/phpize
php

211
NEWS
View file

@ -1,6 +1,198 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 8.5.0alpha2
?? ??? ????, PHP 8.5.0beta2
- Core:
. Fixed bug GH-18850 (Repeated inclusion of file with __halt_compiler()
triggers "Constant already defined" warning). (ilutov)
. Fixed bug GH-19476 (pipe operator fails to correctly handle returning
by reference). (alexandre-daubois)
- ODBC:
. Remove ODBCVER and assume ODBC 3.5. (Calvin Buckley)
- OpenSSL:
. Implement #81724 (openssl_cms_encrypt only allows specific ciphers).
(Jakub Zelenka)
- Session:
. Added support for partitioned cookies. (nielsdos)
- Standard:
. Fixed bug GH-16649 (UAF during array_splice). (alexandre-daubois)
. Passing integers outside the interval [0, 255] to chr() is now deprecated.
(Girgias)
. Added support for partitioned cookies. (nielsdos)
14 Aug 2025, PHP 8.5.0beta1
- Core:
. Non-canonical cast names (boolean), (integer), (double), and (binary) have
been deprecated. (Girgias)
. The $exclude_disabled parameter of the get_defined_functions() function has
been deprecated, as it no longer has any effect since PHP 8.0. (Girgias)
. Terminating case statements with a semicolon instead of a colon has
been deprecated. (theodorejb)
. The backtick operator as an alias for shell_exec() has been deprecated.
(timwolla)
. Returning null from __debugInfo() has been deprecated. (DanielEScherzer)
. Support #[\Override] on properties. (Jiří Pudil)
- Curl:
. The curl_close() function has been deprecated. (DanielEScherzer)
. The curl_share_close() function has been deprecated. (DanielEScherzer)
- Date:
. The DATE_RFC7231 and DateTimeInterface::RFC7231 constants have been
deprecated. (jorgsowa)
- DOM:
. Fixed bug GH-18877 (\Dom\HTMLDocument querySelectorAll selecting only the
first when using ~ and :has). (nielsdos, lexborisov)
- FileInfo
. The finfo_close() function has been deprecated. (timwolla)
. The $context parameter of the finfo_buffer() function has been deprecated
as it is ignored. (Girgias)
- GD:
. The imagedestroy() function has been deprecated. (DanielEScherzer)
- Intl:
. Intl's internal error mechanism has been modernized so that it
indicates more accurately which call site caused what error.
Moreover, some ext/date exceptions have been wrapped inside a
IntlException now. (Girgias)
. The intl.error_level INI setting has been deprecated. (Girgias)
- MySQLi:
. The mysqli_execute() alias function has been deprecated. (timwolla)
- OpenSSL:
. Fixed bug GH-19369 (8.5 | Regression in openssl_sign() - support for alias
algorithms appears to be broken). (Jakub Zelenka)
. The $key_length parameter for openssl_pkey_derive() has been deprecated.
(Girgias)
. Implement #80495 (Enable to set padding in openssl_(sign|verify).
(Jakub Zelenka)
. Implement #47728 (openssl_pkcs7_sign ignores new openssl flags).
(Jakub Zelenka)
- PDO:
. The "uri:" DSN scheme has been deprecated due to security concerns with
DSNs coming from remote URIs. (timwolla)
- Reflection:
. Fixed bug GH-17927 (Reflection: have some indication of property hooks in
`_property_string()`). (DanielEScherzer)
. The setAccessible() methods of various Reflection objects have been
deprecated, as those no longer have an effect. (timwolla)
. ReflectionClass::getConstant() for constants that do not exist has been
deprecated. (DanielEScherzer)
. ReflectionProperty::getDefaultValue() for properties without default values
has been deprecated. (DanielEScherzer)
- SPL:
. Unregistering all autoloaders by passing the spl_autoload_call() function
as a callback argument to spl_autoload_unregister() has been deprecated.
Instead if this is needed, one should iterate over the return value of
spl_autoload_functions() and call spl_autoload_unregister() on each
value. (Girgias)
. The SplObjectStorage::contains(), SplObjectStorage::attach(), and
SplObjectStorage::detach() methods have been deprecated in favour of
SplObjectStorage::offsetExists(), SplObjectStorage::offsetSet(), and
SplObjectStorage::offsetUnset() respectively. (Girgias)
- Standard:
. The socket_set_timeout() alias function has been deprecated. (timwolla)
. Passing null to to readdir(), rewinddir(), and closedir() to use the last
opened directory has been deprecated. (Girgias)
. Fixed bug GH-19153 (#[\Attribute] validation should error on
trait/interface/enum/abstract class). (DanielEScherzer)
- XML:
. The xml_parser_free() function has been deprecated. (DanielEScherzer)
31 Jul 2025, PHP 8.5.0alpha4
- Core:
. Add clone-with support to the clone() function. (timwolla, edorian)
. Fix support for non-userland stream notifiers. (timwolla)
. Added PHP_BUILD_PROVIDER constant. (timwolla)
. Fixed bug GH-19305 (Operands may be being released during comparison).
(Arnaud)
. Fixed bug GH-19306 (Generator can be resumed while fetching next value from
delegated Generator). (Arnaud)
. Fixed bug GH-19326 (Calling Generator::throw() on a running generator with
a non-Generator delegate crashes). (Arnaud)
- Curl:
. Add support for CURLINFO_CONN_ID in curl_getinfo() (thecaliskan)
. Add support for CURLINFO_QUEUE_TIME_T in curl_getinfo() (thecaliskan)
. Add support for CURLOPT_SSL_SIGNATURE_ALGORITHMS. (Ayesh Karunaratne)
- FPM:
. Make FPM access log limit configurable using log_limit. (Jakub Zelenka)
- GD:
. Fix incorrect comparison with result of php_stream_can_cast(). (Girgias)
- Intl:
. Fix return value on failure for resourcebundle count handler. (Girgias)
. Fixed bug GH-19307 (PGO builds of shared ext-intl are broken). (cmb)
- OPcache:
. Disallow changing opcache.memory_consumption when SHM is already set up.
(timwolla)
. Fixed bug GH-15074 (Compiling opcache statically into ZTS PHP fails).
(Arnaud)
. Make OPcache non-optional (Arnaud, timwolla)
. Fixed bug GH-17422 (OPcache bypasses the user-defined error handler for
deprecations). (Arnaud, timwolla)
. Fixed bug GH-19301 (opcache build failure). (Remi)
- OpenSSL:
. Add $digest_algo parameter to openssl_public_encrypt() and
openssl_private_decrypt() functions. (Jakub Zelenka)
- POSIX:
. posix_kill and posix_setpgid throws a ValueError on invalid process_id.
(David Carlier)
. posix_setpgid throws a ValueError on invalid process_group_id,
posix_setrlimit throws a ValueError on invalid soft_limit and hard_limit
arguments. (David Carlier)
- Reflection:
. Fixed bug GH-19187 (ReflectionNamedType::getName() prints nullable type when
retrieved from ReflectionProperty::getSettableType()). (ilutov)
- Session:
. Fixed GH-19197: build broken with ZEND_STRL usage with memcpy
when implemented as macro. (David Carlier)
- Soap:
. Fixed bug GH-19226 (Segfault when spawning new thread in soap extension).
(Florian Engelhardt)
- Sockets:
. socket_set_option for multicast context throws a ValueError
when the socket family is not of AF_INET/AF_INET6 family. (David Carlier)
- Standard:
. Add HEIF/HEIC support to getimagesize. (Benstone Zhang)
. Implement #71517 (Implement SVG support for getimagesize() and friends).
(nielsdos)
. Optimized PHP html_entity_decode function. (Artem Ukrainskiy)
. Minor optimization to array_chunk(). (nielsdos)
- URI:
. Empty host handling is fixed. (Máté Kocsis)
. Error handling of Uri\WhatWg\Url::withHost() is fixed when the input
contains a port. Now, it triggers an exception; previously, the error
was silently swallowed. (Máté Kocsis)
. Support empty URIs with Uri\Rfc3986\Uri. (timwolla)
17 Jul 2025, PHP 8.5.0alpha2
- Core:
. Fix OSS-Fuzz #427814452 (pipe compilation fails with assert).
@ -41,7 +233,7 @@ PHP NEWS
- CURL:
. Added CURLFOLLOW_ALL, CURLFOLLOW_OBEYCODE and CURLFOLLOW_FIRSTONLY
values for CURLOPT_FOLLOLOCATION curl_easy_setopt option. (David Carlier)
values for CURLOPT_FOLLOWLOCATION curl_easy_setopt option. (David Carlier)
- COM:
. Fixed property access of PHP objects wrapped in variant. (cmb)
@ -135,8 +327,8 @@ PHP NEWS
. Added grapheme_levenshtein() function. (Yuya Hamada)
. Added Locale::addLikelySubtags/Locale::minimizeSubtags to handle
adding/removing likely subtags to a locale. (David Carlier)
. Added IntlListFormatter class to format a list of items with a locale
, operands types and units. (BogdanUngureanu)
. Added IntlListFormatter class to format a list of items with a locale,
operands types and units. (BogdanUngureanu)
. Fixed bug GH-18566 ([intl] Weird numeric sort in Collator). (nielsdos)
- LDAP:
@ -160,7 +352,7 @@ PHP NEWS
- OpenSSL:
. Added openssl.libctx INI that allows to select the OpenSSL library context
type and convert verious parts of the extension to use the custom libctx.
type and convert various parts of the extension to use the custom libctx.
(Jakub Zelenka)
- Output:
@ -170,7 +362,7 @@ PHP NEWS
. Extend pcntl_waitid with rusage parameter. (vrza)
- PCRE:
. Upgraded to pre2lib from 10.44 to 10.45. (nielsdos)
. Upgraded to pcre2lib from 10.44 to 10.45. (nielsdos)
. Remove PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK from pcre compile options.
(mvorisek)
@ -216,8 +408,9 @@ PHP NEWS
(DanielEScherzer)
. Fixed bug GH-12856 (ReflectionClass::getStaticPropertyValue() returns UNDEF
zval for uninitialized typed properties). (nielsdos)
. Fixed bug GH-15766 (ReflectionClass::toString() should have better output
. Fixed bug GH-15766 (ReflectionClass::__toString() should have better output
for enums). (DanielEScherzer)
. Added ReflectionProperty::getMangledName() method. (alexandre-daubois)
- Session:
. session_start() throws a ValueError on option argument if not a hashmap
@ -278,7 +471,7 @@ PHP NEWS
(David Carlier)
- Sodium:
. Fix overall theorical overflows on zend_string buffer allocations.
. Fix overall theoretical overflows on zend_string buffer allocations.
(David Carlier/nielsdos)
- Sqlite:
@ -307,7 +500,7 @@ PHP NEWS
(cmb)
- Tests:
. Allow to shuffle tests even in non-parallell mode. (dhuang00)
. Allow to shuffle tests even in non-parallel mode. (dhuang00)
- Tidy:
. tidy::__construct/parseFile/parseString methods throw an exception if

252
UPGRADING
View file

@ -44,6 +44,15 @@ PHP 8.5 UPGRADE NOTES
. Traits are now bound before the parent class. This is a subtle behavioral
change, but should more closely match user expectations, demonstrated by
GH-15753 and GH-16198.
. Errors emitted during compilation and class linking are now always delayed
and handled after compilation or class linking. Fatal errors emitted during
compilation or class linking cause any delayed errors to be handled
immediately, without calling user-defined error handlers.
. Exceptions thrown by user-defined error handlers when handling class linking
errors are not promoted to fatal errors anymore and do not prevent linking.
. Applying #[\Attribute] to an abstract class, enum, interface, or trait triggers
an error during compilation. Previously, the attribute could be added, but when
ReflectionAttribute::newInstance() was called an error would be thrown.
- DOM:
. Cloning a DOMNamedNodeMap, DOMNodeList, Dom\NamedNodeMap, Dom\NodeList,
@ -71,6 +80,20 @@ PHP 8.5 UPGRADE NOTES
. Calling the mysqli constructor on an already-constructed object
is now no longer possible and throws an Error.
- ODBC:
. ODBC now assumes that at least ODBC 3.5 functionality is available. The
ODBCVER definition and build system flags to control it have been removed.
- Opcache:
. The Opcache extension is now always built into the PHP binary and is always
loaded. The INI directives opcache.enable and opcache.enable_cli are still
honored.
The --enable-opcache/--disable-opcache configure flags have been removed,
and the build does not produce opcache.so or php_opcache.dll objects
anymore.
Using zend_extension=opcache.so or zend_extension=php_opcache.dll INI
directives will emit a warning.
- PCNTL:
. pcntl_exec() now throws ValueErrors when entries of the $args parameter
contain null bytes.
@ -159,6 +182,8 @@ PHP 8.5 UPGRADE NOTES
RFC: https://wiki.php.net/rfc/pipe-operator-v3
. Constructor property promotion can now be used for final properties.
RFC: https://wiki.php.net/rfc/final_promotion
. #[\Override] can now be applied to properties.
RFC: https://wiki.php.net/rfc/override_properties
- Curl:
. Added support for share handles that are persisted across multiple PHP
@ -188,6 +213,18 @@ PHP 8.5 UPGRADE NOTES
first redirect thus if there is any follow up redirect, it won't go
any further. CURLFOLLOW_ALL is equivalent to setting CURLOPT_FOLLOWLOCATION
to true.
. Added support for CURLINFO_CONN_ID (libcurl >= 8.2.0) to the curl_getinfo()
function. This constant allows retrieving the unique ID of the connection
used by a cURL transfer. It is primarily useful when connection reuse or
connection pooling logic is needed in PHP-level applications. When
curl_getinfo() returns an array, this value is available as the "conn_id" key.
. Added support for CURLINFO_QUEUE_TIME_T (libcurl >= 8.6.0) to the curl_getinfo()
function. This constant allows retrieving the time (in microseconds) that the
request spent in libcurls connection queue before it was sent.
This value can also be retrieved by passing CURLINFO_QUEUE_TIME_T to the
curl_getinfo() $option parameter.
. Added support for CURLOPT_SSL_SIGNATURE_ALGORITHMS to specify the signature
algorithms to use for TLS.
- DOM:
. Added Dom\Element::$outerHTML.
@ -216,6 +253,11 @@ PHP 8.5 UPGRADE NOTES
Pdo_Sqlite::EXPLAIN_MODE_PREPARED, Pdo_Sqlite::EXPLAIN_MODE_EXPLAIN,
Pdo_Sqlite::EXPLAIN_MODE_EXPLAIN_QUERY_PLAN.
- Session:
. session_set_cookie_params(), session_get_cookie_params(), and session_start()
now support partitioned cookies via the "partitioned" key.
RFC: https://wiki.php.net/rfc/CHIPS
- SOAP:
. Enumeration cases are now dumped in __getTypes().
. Implemented request #61105:
@ -234,6 +276,16 @@ PHP 8.5 UPGRADE NOTES
process was terminated unexpectedly. In such cases, a warning is emitted
and the function returns false. Previously, these errors were silently
ignored. This change affects only the sendmail transport.
. getimagesize() now supports HEIF/HEIC images.
. getimagesize() now supports SVG images when ext-libxml is also loaded.
Similarly, image_type_to_extension() and image_type_to_mime_type()
now also handle IMAGETYPE_SVG.
. The array returned by getimagesize() now has two additional entries:
"width_unit" and "height_unit" to indicate in which units the dimensions
are expressed. These units are px by default. They are not necessarily
the same (just to give one example: one may be cm and the other may be px).
. setcookie() and setrawcookie() now support the "partitioned" key.
RFC: https://wiki.php.net/rfc/CHIPS
- XSL:
. The $namespace argument of XSLTProcessor::getParameter(),
@ -260,6 +312,7 @@ PHP 8.5 UPGRADE NOTES
- FPM:
. FPM with httpd ProxyPass decodes the full script path. Added
fastcgi.script_path_encoded INI setting to prevent this new behavior.
. FPM access log limit now respects log_limit value.
========================================
4. Deprecated Functionality
@ -277,12 +330,115 @@ PHP 8.5 UPGRADE NOTES
one will still be used. If a user output handler returns a non-string and
produces output, the warning about producing an output is emitted first.
RFC: https://wiki.php.net/rfc/deprecations_php_8_4
. Non-canonical cast names (boolean), (integer), (double), and (binary) have
been deprecated, use (bool), (int), (float), and (string) respectively.
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_non-standard_cast_names
. The $exclude_disabled parameter of the get_defined_functions() function has
been deprecated, as it no longer has any effect since PHP 8.0.
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_the_exclude_disabled_parameter_of_get_defined_functions
. Terminating case statements with a semicolon instead of a colon has
been deprecated.
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_semicolon_after_case_in_switch_statement
. The backtick operator as an alias for shell_exec() has been deprecated.
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_backticks_as_an_alias_for_shell_exec
. Returning null from __debugInfo() has been deprecated.
Return an empty array instead.
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_debuginfo_returning_null
- Curl:
. The curl_close() function has been deprecated, as CurlHandle objects are
freed automatically.
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_curl_close
. The curl_share_close() function has been deprecated, as CurlShareHandle
objects are freed automatically.
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_curl_share_close
- Date:
. The DATE_RFC7231 and DateTimeInterface::RFC7231 constants have been
deprecated. This is because the associated timezone is ignored and always
uses GMT.
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_date_rfc7231_and_datetimeinterfacerfc7231
- FileInfo:
. The finfo_close() function has been deprecated.
As finfo objects are freed automatically.
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_finfo_close
. The $context parameter of the finfo_buffer() function has been deprecated
as it is ignored.
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_the_context_parameter_for_finfo_buffer
- GD:
. The imagedestroy() function has been deprecated, as GdImage objects are
freed automatically.
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_imagedestroy
- Hash:
. The MHASH_* constants have been deprecated. These have been overlooked
when the mhash*() function family has been deprecated per
https://wiki.php.net/rfc/deprecations_php_8_1#mhash_function_family
- Intl:
. The intl.error_level INI setting has been deprecated.
Errors should either be checked manually or exceptions should be enabled
by using the intl.use_exceptions INI setting.
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_intlerror_level_ini_setting
- MySQLi:
. The mysqli_execute() alias function has been deprecated.
Use mysqli_stmt_execute() instead.
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#formally_deprecate_mysqli_execute
- OpenSSL:
. The $key_length parameter for openssl_pkey_derive() has been deprecated.
This is because it is either ignored, or truncates the key, which can be
a vulnerability.
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_key_length_parameter_of_openssl_pkey_derive
- PDO:
. The "uri:" DSN scheme has been deprecated due to security concerns with
DSNs coming from remote URIs.
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_pdo_s_urischeme
- Reflection:
. The setAccessible() methods of various Reflection objects have been
deprecated, as those no longer have an effect.
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_reflectionsetaccessible
. Calling ReflectionClass::getConstant() for constants that do not exist has
been deprecated.
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_reflectionclassgetconstant_for_missing_constants
. Calling ReflectionProperty::getDefaultValue() for properties without default
values has been deprecated.
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_reflectionpropertygetdefaultvalue_for_properties_without_default_values
- SPL:
. Unregistering all autoloaders by passing the spl_autoload_call() function
as a callback argument to spl_autoload_unregister() has been deprecated.
Instead if this is needed, one should iterate over the return value of
spl_autoload_functions() and call spl_autoload_unregister() on each value.
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_passing_spl_autoload_call_to_spl_autoload_unregister
. The SplObjectStorage::contains(), SplObjectStorage::attach(), and
SplObjectStorage::detach() methods have been deprecated in favour of
SplObjectStorage::offsetExists(), SplObjectStorage::offsetSet(), and
SplObjectStorage::offsetUnset() respectively.
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_splobjectstoragecontains_splobjectstorageattach_and_splobjectstoragedetach
- Standard:
. The socket_set_timeout() alias function has been deprecated.
Use stream_set_timeout() instead.
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#formally_deprecate_socket_set_timeout
. Passing null to to readdir(), rewinddir(), and closedir() to use the last
opened directory has been deprecated. Provide the last opened directory
explicitly instead.
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_passing_null_to_readdir_rewinddir_and_closedir
. Passing integers outside the interval [0, 255] to chr() is now deprecated.
This is because a byte can only hold a value within this interval.
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_passing_integers_outside_the_interval_0_255_to_chr
- XML:
. The xml_parser_free() function has been deprecated, as XMLParser objects
are freed automatically.
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_xml_parser_free
========================================
5. Changed Functions
========================================
@ -307,6 +463,15 @@ PHP 8.5 UPGRADE NOTES
- libxml:
. libxml_set_external_entity_loader() now has a formal return type of true.
- OpenSSL:
. openssl_public_encrypt() and openssl_private_decrypt() have new parameter
$digest_algo that allows specifying hash digest algorithm for OEAP padding.
. openssl_sign() and openssl_verify() have new parameter $padding to allow
using more secure RSA PSS padding.
. openssl_cms_encrypt() $cipher_algo parameter can be a string with the
cipher name. That allows to use more algorithms including AES GCM cipher
algorithms for auth enveloped data.
- PCNTL:
. pcntl_exec() now has a formal return type of false.
. pcntl_waitid() takes an additional resource_usage argument to
@ -339,16 +504,28 @@ PHP 8.5 UPGRADE NOTES
an invalid file descriptor.
. posix_fpathconf checks invalid file descriptors and sets
last_error to EBADF and raises an E_WARNING message.
. posix_kill throws a ValueError when the process_id argument is lower
or greater than what supports the platform (signed integer or long
range), posix_setpgid throws a ValueError when the process_id or
the process_group_id is lower than zero or greater than
what supports the platform.
. posix_setrlimit throws a ValueError when the hard_limit of soft_limit
argument are lower than -1 or if soft_limit is greater than hard_limit.
- Reflection:
. The output of ReflectionClass::toString() for enums has changed to
. The output of ReflectionClass::__toString() for enums has changed to
better indicate that the class is an enum, and that the enum cases
are enum cases rather than normal class constants.
. The output of ReflectionProperty::__toString() for properties with
hooks has changed to indicate what hooks the property has, whether those
hooks are final, and whether the property is virtual. This also affects
the output of ReflectionClass::__toString() when a class contains hooked
properties.
- Session:
. session_start is stricter in regard to the option argument.
It throws a ValueError if the whole is not a hashmap or
a TypeError if read_on_close value is not a valid type
a TypeError if read_and_close value is not a valid type
compatible with int.
- SNMP:
@ -361,7 +538,7 @@ PHP 8.5 UPGRADE NOTES
- Sockets:
. socket_create_listen, socket_bind and socket_sendto throw a
ValueError if the port is lower than 0 or greater than 65535,
also if any of the hints array entry is indexes numerically.
and also if any of the hints array entries are indexed numerically.
. socket_addrinfo_lookup throws a TypeError if any of the hints
values cannot be cast to int and can throw a ValueError if
any of these values overflow.
@ -371,6 +548,8 @@ PHP 8.5 UPGRADE NOTES
. socket_create/socket_bind can create AF_PACKET family sockets.
. socket_getsockname gets the interface index and its string
representation with AF_PACKET socket.
. socket_set_option with multicast context throws a ValueError
when the created socket is not of AF_INET/AF_INET6 family.
- Tidy:
. tidy::__construct/parseFile/parseString now throws a ValueError
@ -396,8 +575,10 @@ PHP 8.5 UPGRADE NOTES
. get_exception_handler() allows retrieving the current user-defined exception
handler function.
RFC: https://wiki.php.net/rfc/get-error-exception-handler
. The clone language construct is now a function.
. The clone language construct is now a function and supports reassigning
(readonly) properties during cloning via the new $withProperties parameter.
RFC: https://wiki.php.net/rfc/clone_with_v2
. Added Closure::getCurrent() to receive currently executing closure.
- Curl:
. curl_multi_get_handles() allows retrieving all CurlHandles current
@ -423,6 +604,9 @@ PHP 8.5 UPGRADE NOTES
. Added grapheme_levenshtein() function.
RFC: https://wiki.php.net/rfc/grapheme_levenshtein
- Opcache:
. Added opcache_is_script_cached_in_file_cache().
- Pdo\Sqlite:
. Added support for Pdo\Sqlite::setAuthorizer(), which is the equivalent of
SQLite3::setAuthorizer(). The only interface difference is that the
@ -440,6 +624,7 @@ PHP 8.5 UPGRADE NOTES
ReflectionConstant::getExtensionName() were introduced.
. ReflectionConstant::getAttributes() was introduced.
RFC: https://wiki.php.net/rfc/attributes-on-constants
. ReflectionProperty::getMangledName() was introduced.
- Sqlite:
. Sqlite3Stmt::busy to check if a statement had been fetched
@ -458,6 +643,13 @@ PHP 8.5 UPGRADE NOTES
across multiple PHP requests.
RFC: https://wiki.php.net/rfc/curl_share_persistence_improvement
- URI:
. Uri\UriException, Uri\InvalidUriException, Uri\UriComparisonMode,
Uri\Rfc3986\Uri, Uri\WhatWg\InvalidUrlException,
Uri\WhatWg\UrlValidationErrorType, Uri\WhatWg\UrlValidationError,
and Uri\WhatWg\Url are added.
RFC: https://wiki.php.net/rfc/url_parsing_api
========================================
8. Removed Extensions and SAPIs
========================================
@ -472,17 +664,33 @@ PHP 8.5 UPGRADE NOTES
CURLFOLLOW_FIRSTONLY.
- Fileinfo:
. Upgraded to file 5.46.
. Upgraded file from 5.45 to 5.46.
. The return type of finfo_close() has been changed to true, rather
than bool.
- Intl:
. Intl's internal error mechanism has been modernized so that it
indicates more accurately which call site caused what error.
Moreover, some ext/date exceptions have been wrapped inside a
IntlException now.
- Lexbor:
. An always enabled lexbor extension is added. It contains the lexbor
library that was separated from ext/dom for being reused among other
extensions. The new extension is not directly exposed to userland.
- Opcache:
. The Opcache extension is now always built into the PHP binary and is always
loaded. The INI directives opcache.enable and opcache.enable_cli are still
honored.
- URI:
. An always enabled uri extension is added that can be used for handling
URIs and URLs according to RFC 3986 and WHATWG URL.
RFC: https://wiki.php.net/rfc/url_parsing_api
- PCRE:
. Upgraded to pcre2lib from 10.44 to 10.45.
. Upgraded pcre2lib from 10.44 to 10.45.
- PDO_Sqlite:
. Increased minimum release version support from 3.7.7 to 3.7.17.
@ -498,11 +706,14 @@ PHP 8.5 UPGRADE NOTES
- Core:
. PHP_BUILD_DATE.
. PHP_BUILD_PROVIDER.
- Curl:
. CURLINFO_USED_PROXY.
. CURLINFO_HTTPAUTH_USED.
. CURLINFO_PROXYAUTH_USED.
. CURLINFO_CONN_ID.
. CURLINFO_QUEUE_TIME_T.
. CURLOPT_INFILESIZE_LARGE.
. CURLFOLLOW_ALL.
. CURLFOLLOW_OBEYCODE.
@ -512,6 +723,13 @@ PHP 8.5 UPGRADE NOTES
. DECIMAL_COMPACT_SHORT.
. DECIMAL_COMPACT_LONG.
- OpenSSL:
. OPENSSL_PKCS1_PSS_PADDING
. PKCS7_NOSMIMECAP
. PKCS7_CRLFEOL
. PKCS7_NOCRL
. PKCS7_NO_DUAL_CONTENT
- POSIX:
. POSIX_SC_OPEN_MAX.
@ -535,6 +753,9 @@ PHP 8.5 UPGRADE NOTES
. T_VOID_CAST.
. T_PIPE.
- Standard:
. IMAGETYPE_SVG when libxml is loaded.
========================================
11. Changes to INI File Handling
========================================
@ -543,6 +764,11 @@ PHP 8.5 UPGRADE NOTES
. Added fatal_error_backtraces to control whether fatal errors should include
a backtrace.
RFC: https://wiki.php.net/rfc/error_backtraces_v2
. Added startup-only max_memory_limit INI setting to control the maximum
memory_limit that may be configured at startup or runtime. Exceeding this
value emits a warning, unless set to -1, and sets memory_limit to the
current max_memory_limit instead.
ML discussion: https://externals.io/message/127108
- Opcache:
. Added opcache.file_cache_read_only to support a read-only
@ -557,11 +783,14 @@ PHP 8.5 UPGRADE NOTES
. The default value of opcache.jit_hot_loop is now 61 (a prime) to prevent it
from being a multiple of loop iteration counts.
It is recommended that this parameter is set to a prime number.
. Changing opcache.memory_consumption when OPcache SHM is already set up
will now correctly report a failure instead of silently doing nothing and
showing misleading values in PHPInfo.
- OpenSSL:
Added openssl.libctx to select the OpenSSL library context type. Either
custom libctx for each thread can be used or a single global (default)
libctx is used.
. Added openssl.libctx to select the OpenSSL library context type. Either
custom libctx for each thread can be used or a single global (default)
libctx is used.
========================================
12. Windows Support
@ -638,6 +867,10 @@ PHP 8.5 UPGRADE NOTES
. The parts of the code that used SSE2 have been adapted to use SIMD
with ARM NEON as well.
- Opcache:
. Improved performance of fetching TLS variables in JIT'ed code in non-Glibc
builds.
- ReflectionProperty:
. Improved performance of the following methods: getValue(), getRawValue(),
isInitialized(), setValue(), setRawValue().
@ -652,6 +885,7 @@ PHP 8.5 UPGRADE NOTES
. Improved unpack() performance with nameless repetitions by avoiding
creating temporary strings and reparsing them.
. Improved pack() performance.
. Minor improvements in array_chunk() performance.
- XMLReader:
. Improved property access performance.

View file

@ -23,6 +23,15 @@ PHP 8.5 INTERNALS UPGRADE NOTES
the user side when requiring libphp.so, by using dlmopen with LM_ID_NEWLM
instead of dlopen.
RTLD_DEEPBIND is still enabled when the Apache SAPI is in use.
. The ptr field of the php_stream_notifier struct is now a void* instead
of a zval. If the zval was used to store IS_PTR values only, the
extra layer of indirection can be removed. In other cases a zval can
be heap-allocated and stored in the pointer as a minimal change to keep
compatibility.
- Hash
. Hash functions now use proper hash_spec_result enum for return values
instead of using SUCCESS and FAILURE.
- Zend
. Added zend_safe_assign_to_variable_noref() function to safely assign
@ -66,6 +75,15 @@ PHP 8.5 INTERNALS UPGRADE NOTES
* zend_register_string_constant()
* zend_register_stringl_constant()
. EG(fake_scope) now is a _const_ zend_class_entry*.
. zend_begin_record_errors() or EG(record_errors)=true cause errors to be
delayed. Before, errors would be recorded but not delayed.
. zend_mm_refresh_key_child() must be called on any zend_mm_heap inherited
from the parent process after a fork().
. HASH_KEY_IS_* constants have been moved in the zend_hash_key_type enum.
- standard
. ext/standard/php_smart_string.h and ext/standard/php_smart_string_public.h
were removed. Use the corresponding headers in Zend/ instead.
========================
2. Build system changes
@ -83,11 +101,12 @@ PHP 8.5 INTERNALS UPGRADE NOTES
that appropriate build rules are created.
- Unix build system changes
. libdir is properly set when --libdir (ex: /usr/lib64) and --with-libdir (ex lib64)
. libdir is properly set when --libdir (ex: /usr/lib64) and --with-libdir (ex: lib64)
configure options are used to ${libdir}/php (ex: /usr/lib64/php)
. PHP_ODBC_CFLAGS, PHP_ODBC_LFLAGS, PHP_ODBC_LIBS, PHP_ODBC_TYPE preprocessor
macros defined by ext/odbc are now defined in php_config.h instead of the
build-defs.h header.
. Autoconf macro AX_CHECK_COMPILE_FLAG updated to serial 11.
. Autoconf macro PHP_AP_EXTRACT_VERSION has been removed.
. Autoconf macro PHP_BUILD_THREAD_SAFE has been removed (set enable_zts
manually).
@ -129,11 +148,24 @@ PHP 8.5 INTERNALS UPGRADE NOTES
. The php_std_date() function has been removed. Use php_format_date() with
the "D, d M Y H:i:s \\G\\M\\T" format instead.
. Added php_url_encode_to_smart_str() to encode a URL to a smart_str buffer.
. The functionality of getimagesize(), image_type_to_mime_type(),
and image_type_to_extension() is now extensible using the internal APIs
php_image_register_handler() and php_image_unregister_handler() in
php_image.h.
========================
4. OpCode changes
========================
* New ZEND_DECLARE_ATTRIBUTED_CONST is used when a global constant is declared
with `const` and has attributes; this opcode is used *instead* of the
ZEND_DECLARE_CONST, and in addition to the name of the constant and the
value to use, has a ZEND_OP_DATA with a pointer to the compiled attributes.
========================
5. SAPI changes
========================
- SAPIs must now call php_child_init() after a fork. If php-src code was
executed in other threads than the one initiating the fork,
refresh_memory_manager() must be called in every such thread.

View file

@ -420,6 +420,14 @@ static void zend_optimize_block(zend_basic_block *block, zend_op_array *op_array
}
break;
case ZEND_EXT_STMT:
if (opline->op1_type & (IS_TMP_VAR|IS_VAR)) {
/* Variable will be deleted later by FREE, so we can't optimize it */
Tsource[VAR_NUM(opline->op1.var)] = NULL;
break;
}
break;
case ZEND_CASE:
case ZEND_CASE_STRICT:
case ZEND_COPY_TMP:

View file

@ -98,6 +98,10 @@ ZEND_API int zend_optimizer_register_pass(zend_optimizer_pass_t pass);
ZEND_API void zend_optimizer_unregister_pass(int idx);
zend_result zend_optimizer_startup(void);
zend_result zend_optimizer_shutdown(void);
typedef void (*zend_op_array_func_t)(zend_op_array *, void *context);
void zend_foreach_op_array(zend_script *script, zend_op_array_func_t func, void *context);
END_EXTERN_C()
#endif

View file

@ -128,7 +128,4 @@ int sccp_optimize_op_array(zend_optimizer_ctx *ctx, zend_op_array *op_array, zen
int dce_optimize_op_array(zend_op_array *op_array, zend_optimizer_ctx *optimizer_ctx, zend_ssa *ssa, bool reorder_dtor_effects);
zend_result zend_ssa_escape_analysis(const zend_script *script, zend_op_array *op_array, zend_ssa *ssa);
typedef void (*zend_op_array_func_t)(zend_op_array *, void *context);
void zend_foreach_op_array(zend_script *script, zend_op_array_func_t func, void *context);
#endif

View file

@ -22,6 +22,7 @@
#include "zend_ssa.h"
#include "zend_dump.h"
#include "zend_inference.h"
#include "zend_worklist.h"
#include "Optimizer/zend_optimizer_internal.h"
static bool dominates(const zend_basic_block *blocks, int a, int b) {
@ -816,7 +817,7 @@ ZEND_API int zend_ssa_rename_op(const zend_op_array *op_array, const zend_op *op
}
/* }}} */
static zend_result zend_ssa_rename(const zend_op_array *op_array, uint32_t build_flags, zend_ssa *ssa, int *var, int n) /* {{{ */
static void zend_ssa_rename_in_block(const zend_op_array *op_array, uint32_t build_flags, zend_ssa *ssa, int *var, int n) /* {{{ */
{
zend_basic_block *blocks = ssa->cfg.blocks;
zend_ssa_block *ssa_blocks = ssa->blocks;
@ -824,15 +825,6 @@ static zend_result zend_ssa_rename(const zend_op_array *op_array, uint32_t build
int ssa_vars_count = ssa->vars_count;
int i, j;
zend_op *opline, *end;
int *tmp = NULL;
ALLOCA_FLAG(use_heap = 0);
// FIXME: Can we optimize this copying out in some cases?
if (blocks[n].next_child >= 0) {
tmp = do_alloca(sizeof(int) * (op_array->last_var + op_array->T), use_heap);
memcpy(tmp, var, sizeof(int) * (op_array->last_var + op_array->T));
var = tmp;
}
if (ssa_blocks[n].phis) {
zend_ssa_phi *phi = ssa_blocks[n].phis;
@ -916,22 +908,90 @@ static zend_result zend_ssa_rename(const zend_op_array *op_array, uint32_t build
}
ssa->vars_count = ssa_vars_count;
}
/* }}} */
j = blocks[n].children;
while (j >= 0) {
// FIXME: Tail call optimization?
if (zend_ssa_rename(op_array, build_flags, ssa, var, j) == FAILURE)
return FAILURE;
j = blocks[j].next_child;
static zend_result zend_ssa_rename(const zend_op_array *op_array, uint32_t build_flags, zend_ssa *ssa, int *var, int n)
{
/* The worklist contains block numbers, encoded as positive or negative value.
* Positive values indicate that the variable rename still needs to happen for the block.
* Negative values indicate the variable rename was done and all children were handled too.
* In that case, we will clean up.
* Because block 0 is valid, we bias the block numbers by adding 1 such that we can distinguish
* positive and negative values in all cases. */
zend_worklist_stack work;
ALLOCA_FLAG(work_use_heap);
ZEND_WORKLIST_STACK_ALLOCA(&work, ssa->cfg.blocks_count, work_use_heap);
zend_worklist_stack_push(&work, n + 1);
/* This is used to backtrack the right version of the renamed variables to use. */
ALLOCA_FLAG(save_vars_use_heap);
unsigned int save_vars_top = 0;
int **save_vars = do_alloca(sizeof(int *) * (ssa->cfg.blocks_count + 1), save_vars_use_heap);
save_vars[0] = var;
while (work.len) {
n = zend_worklist_stack_pop(&work);
/* Enter state: perform SSA variable rename */
if (n > 0) {
n--;
// FIXME: Can we optimize this copying out in some cases?
int *new_var;
if (ssa->cfg.blocks[n].next_child >= 0) {
new_var = emalloc(sizeof(int) * (op_array->last_var + op_array->T));
memcpy(new_var, save_vars[save_vars_top], sizeof(int) * (op_array->last_var + op_array->T));
save_vars[++save_vars_top] = new_var;
} else {
new_var = save_vars[save_vars_top];
}
zend_ssa_rename_in_block(op_array, build_flags, ssa, new_var, n);
int j = ssa->cfg.blocks[n].children;
if (j >= 0) {
/* Push backtrack state */
zend_worklist_stack_push(&work, -(n + 1));
/* Push children in enter state */
unsigned int child_count = 0;
int len_prior = work.len;
do {
zend_worklist_stack_push(&work, j + 1);
j = ssa->cfg.blocks[j].next_child;
child_count++;
} while (j >= 0);
/* Reverse block order to maintain SSA variable number order given in previous PHP versions,
* but the data structure doesn't allow reverse dominator tree traversal. */
for (unsigned int i = 0; i < child_count / 2; i++) {
int tmp = work.buf[len_prior + i];
work.buf[len_prior + i] = work.buf[work.len - 1 - i];
work.buf[work.len - 1 - i] = tmp;
}
} else {
/* Leafs jump directly to backtracking */
goto backtrack;
}
}
/* Leave state: backtrack */
else {
n = -n;
n--;
backtrack:;
if (ssa->cfg.blocks[n].next_child >= 0) {
efree(save_vars[save_vars_top]);
save_vars_top--;
}
}
}
if (tmp) {
free_alloca(tmp, use_heap);
}
free_alloca(save_vars, save_vars_use_heap);
ZEND_WORKLIST_STACK_FREE_ALLOCA(&work, work_use_heap);
return SUCCESS;
}
/* }}} */
ZEND_API zend_result zend_build_ssa(zend_arena **arena, const zend_script *script, const zend_op_array *op_array, uint32_t build_flags, zend_ssa *ssa) /* {{{ */
{

View file

@ -193,28 +193,21 @@ AS_VAR_IF([GCC], [yes],
dnl Check if compiler supports -Wno-clobbered (only GCC).
AX_CHECK_COMPILE_FLAG([-Wno-clobbered],
[CFLAGS="-Wno-clobbered $CFLAGS"],,
[-Werror])
[CFLAGS="-Wno-clobbered $CFLAGS"])
dnl Check for support for implicit fallthrough level 1, also add after previous
dnl CFLAGS as level 3 is enabled in -Wextra.
AX_CHECK_COMPILE_FLAG([-Wimplicit-fallthrough=1],
[CFLAGS="$CFLAGS -Wimplicit-fallthrough=1"],,
[-Werror])
[CFLAGS="$CFLAGS -Wimplicit-fallthrough=1"])
AX_CHECK_COMPILE_FLAG([-Wduplicated-cond],
[CFLAGS="-Wduplicated-cond $CFLAGS"],,
[-Werror])
[CFLAGS="-Wduplicated-cond $CFLAGS"])
AX_CHECK_COMPILE_FLAG([-Wlogical-op],
[CFLAGS="-Wlogical-op $CFLAGS"],,
[-Werror])
[CFLAGS="-Wlogical-op $CFLAGS"])
AX_CHECK_COMPILE_FLAG([-Wformat-truncation],
[CFLAGS="-Wformat-truncation $CFLAGS"],,
[-Werror])
[CFLAGS="-Wformat-truncation $CFLAGS"])
AX_CHECK_COMPILE_FLAG([-Wstrict-prototypes],
[CFLAGS="-Wstrict-prototypes $CFLAGS"],,
[-Werror])
[CFLAGS="-Wstrict-prototypes $CFLAGS"])
AX_CHECK_COMPILE_FLAG([-fno-common],
[CFLAGS="-fno-common $CFLAGS"],,
[-Werror])
[CFLAGS="-fno-common $CFLAGS"])
ZEND_CHECK_ALIGNMENT
ZEND_CHECK_SIGNALS

View file

@ -1,3 +0,0 @@
<?php
/* dummy file for 014.phpt */
?>

View file

@ -9,6 +9,7 @@ function skipFunction($function): bool {
/* terminates script */
|| $function === 'exit'
|| $function === 'die'
|| $function === 'zend_trigger_bailout'
/* intentionally violate invariants */
|| $function === 'zend_create_unterminated_string'
|| $function === 'zend_test_array_return'

View file

@ -0,0 +1,11 @@
--TEST--
GH-19303 (Unpacking empty packed array into uninitialized array causes assertion failure)
--FILE--
<?php
$a = [0];
unset($a[0]);
var_dump([...$a]);
?>
--EXPECT--
array(0) {
}

View file

@ -5,12 +5,12 @@ zend.assertions=1
assert.exception=1
--FILE--
<?php
var_dump((integer)ini_get("zend.assertions"));
var_dump((int)ini_get("zend.assertions"));
ini_set("zend.assertions", 0);
var_dump((integer)ini_get("zend.assertions"));
var_dump((int)ini_get("zend.assertions"));
assert(false);
ini_set("zend.assertions", 1);
var_dump((integer)ini_get("zend.assertions"));
var_dump((int)ini_get("zend.assertions"));
assert(true);
var_dump(true);
?>

View file

@ -0,0 +1,24 @@
--TEST--
GH-19044: Protected properties must be scoped according to their prototype (protected(set) on non-hooked property)
--FILE--
<?php
class P {
public mixed $foo { get => 42; }
}
class C1 extends P {
public protected(set) mixed $foo = 1;
}
class C2 extends P {
public protected(set) mixed $foo;
static function foo($c) { return $c->foo += 1; }
}
var_dump(C2::foo(new C1));
?>
--EXPECT--
int(43)

View file

@ -0,0 +1,12 @@
--TEST--
#[Attribute] on an abstract class
--FILE--
<?php
#[Attribute]
abstract class Demo {}
echo "Done\n";
?>
--EXPECTF--
Fatal error: Cannot apply #[\Attribute] to abstract class Demo in %s on line %d

View file

@ -0,0 +1,12 @@
--TEST--
#[Attribute] on an enum
--FILE--
<?php
#[Attribute]
enum Demo {}
echo "Done\n";
?>
--EXPECTF--
Fatal error: Cannot apply #[\Attribute] to enum Demo in %s on line %d

View file

@ -0,0 +1,12 @@
--TEST--
#[Attribute] on an interface
--FILE--
<?php
#[Attribute]
interface Demo {}
echo "Done\n";
?>
--EXPECTF--
Fatal error: Cannot apply #[\Attribute] to interface Demo in %s on line %d

View file

@ -0,0 +1,12 @@
--TEST--
#[Attribute] on a trait
--FILE--
<?php
#[Attribute]
trait Demo {}
echo "Done\n";
?>
--EXPECTF--
Fatal error: Cannot apply #[\Attribute] to trait Demo in %s on line %d

View file

@ -8,4 +8,4 @@ enum Test {}
?>
--EXPECTF--
Fatal error: Cannot apply #[AllowDynamicProperties] to enum Test in %s on line %d
Fatal error: Cannot apply #[\AllowDynamicProperties] to enum Test in %s on line %d

View file

@ -8,4 +8,4 @@ interface Test {}
?>
--EXPECTF--
Fatal error: Cannot apply #[AllowDynamicProperties] to interface Test in %s on line %d
Fatal error: Cannot apply #[\AllowDynamicProperties] to interface Test in %s on line %d

View file

@ -8,4 +8,4 @@ trait Test {}
?>
--EXPECTF--
Fatal error: Cannot apply #[AllowDynamicProperties] to trait Test in %s on line %d
Fatal error: Cannot apply #[\AllowDynamicProperties] to trait Test in %s on line %d

View file

@ -0,0 +1,39 @@
--TEST--
#[\Override]: Properties
--FILE--
<?php
interface I {
public mixed $i { get; }
}
interface II extends I {
#[\Override]
public mixed $i { get; }
}
class P {
public mixed $p1;
public mixed $p2;
}
class PP extends P {
#[\Override]
public mixed $p1;
public mixed $p2;
}
class C extends PP implements I {
#[\Override]
public mixed $i;
#[\Override]
public mixed $p1;
public mixed $p2;
public mixed $c;
}
echo "Done";
?>
--EXPECT--
Done

View file

@ -0,0 +1,15 @@
--TEST--
#[\Override]: Properties: No parent class.
--FILE--
<?php
class C {
#[\Override]
public mixed $c;
}
echo "Done";
?>
--EXPECTF--
Fatal error: C::$c has #[\Override] attribute, but no matching parent property exists in %s on line %d

View file

@ -0,0 +1,21 @@
--TEST--
#[\Override]: Properties: No parent class, but child implements matching interface.
--FILE--
<?php
interface I {
public mixed $i { get; }
}
class P {
#[\Override]
public mixed $i;
}
class C extends P implements I {}
echo "Done";
?>
--EXPECTF--
Fatal error: P::$i has #[\Override] attribute, but no matching parent property exists in %s on line %d

View file

@ -0,0 +1,21 @@
--TEST--
#[\Override]: Properties: No parent class, but child implements matching interface (2).
--FILE--
<?php
interface I {
public mixed $i { get; }
}
class C extends P implements I {}
class P {
#[\Override]
public mixed $i;
}
echo "Done";
?>
--EXPECTF--
Fatal error: P::$i has #[\Override] attribute, but no matching parent property exists in %s on line %d

View file

@ -0,0 +1,26 @@
--TEST--
#[\Override]: Properties: No parent interface.
--FILE--
<?php
interface I {
#[\Override]
public mixed $i { get; }
}
interface II extends I {}
class C implements II {
public mixed $i;
}
class C2 implements I {
public mixed $i;
}
echo "Done";
?>
--EXPECTF--
Fatal error: I::$i has #[\Override] attribute, but no matching parent property exists in %s on line %d

View file

@ -0,0 +1,15 @@
--TEST--
#[\Override]: Properties: On trait.
--FILE--
<?php
trait T {
#[\Override]
public mixed $t;
}
echo "Done";
?>
--EXPECT--
Done

View file

@ -0,0 +1,19 @@
--TEST--
#[\Override]: Properties: On used trait without parent property.
--FILE--
<?php
trait T {
#[\Override]
public mixed $t;
}
class Foo {
use T;
}
echo "Done";
?>
--EXPECTF--
Fatal error: Foo::$t has #[\Override] attribute, but no matching parent property exists in %s on line %d

View file

@ -0,0 +1,23 @@
--TEST--
#[\Override]: Properties: On used trait with interface property.
--FILE--
<?php
trait T {
#[\Override]
public mixed $i;
}
interface I {
public mixed $i { get; }
}
class Foo implements I {
use T;
}
echo "Done";
?>
--EXPECT--
Done

View file

@ -0,0 +1,19 @@
--TEST--
#[\Override]: Properties: Parent property is private, child property is public.
--FILE--
<?php
class P {
private mixed $p;
}
class C extends P {
#[\Override]
public mixed $p;
}
echo "Done";
?>
--EXPECTF--
Fatal error: C::$p has #[\Override] attribute, but no matching parent property exists in %s on line %d

View file

@ -0,0 +1,19 @@
--TEST--
#[\Override]: Properties: Parent property is private, child property is private.
--FILE--
<?php
class P {
private mixed $p;
}
class C extends P {
#[\Override]
private mixed $p;
}
echo "Done";
?>
--EXPECTF--
Fatal error: C::$p has #[\Override] attribute, but no matching parent property exists in %s on line %d

View file

@ -0,0 +1,19 @@
--TEST--
#[\Override]: Properties: Parent property is protected, child property is public.
--FILE--
<?php
class P {
protected mixed $p;
}
class C extends P {
#[\Override]
public mixed $p;
}
echo "Done";
?>
--EXPECT--
Done

View file

@ -0,0 +1,19 @@
--TEST--
#[\Override]: Properties: Parent property is protected, child property is protected.
--FILE--
<?php
class P {
protected mixed $p;
}
class C extends P {
#[\Override]
protected mixed $p;
}
echo "Done";
?>
--EXPECT--
Done

View file

@ -0,0 +1,21 @@
--TEST--
#[\Override]: Properties: Redeclared trait property.
--FILE--
<?php
trait T {
public mixed $t;
}
class C {
use T;
#[\Override]
public mixed $t;
}
echo "Done";
?>
--EXPECTF--
Fatal error: C::$t has #[\Override] attribute, but no matching parent property exists in %s on line %d

View file

@ -0,0 +1,25 @@
--TEST--
#[\Override]: Properties: Redeclared trait property with interface.
--FILE--
<?php
interface I {
public mixed $i { get; }
}
trait T {
public mixed $i;
}
class C implements I {
use T;
#[\Override]
public mixed $i;
}
echo "Done";
?>
--EXPECT--
Done

View file

@ -0,0 +1,19 @@
--TEST--
#[\Override]: Properties: Valid anonymous class.
--FILE--
<?php
interface I {
public mixed $i { get; }
}
new class () implements I {
#[\Override]
public mixed $i;
};
echo "Done";
?>
--EXPECT--
Done

View file

@ -0,0 +1,21 @@
--TEST--
#[\Override]: Properties: Invalid anonymous class.
--FILE--
<?php
interface I {
public mixed $i { get; }
}
new class () implements I {
public mixed $i;
#[\Override]
public mixed $c;
};
echo "Done";
?>
--EXPECTF--
Fatal error: I@anonymous::$c has #[\Override] attribute, but no matching parent property exists in %s on line %d

View file

@ -0,0 +1,16 @@
--TEST--
#[\Override]: Properties: Static property no parent class.
--FILE--
<?php
class C
{
#[\Override]
public static mixed $c;
}
echo "Done";
?>
--EXPECTF--
Fatal error: C::$c has #[\Override] attribute, but no matching parent property exists in %s on line %d

View file

@ -0,0 +1,19 @@
--TEST--
#[\Override]: Properties: Static property.
--FILE--
<?php
class P {
public static mixed $p;
}
class C extends P {
#[\Override]
public static mixed $p;
}
echo "Done";
?>
--EXPECT--
Done

View file

@ -0,0 +1,21 @@
--TEST--
#[\Override]: Properties: valid promoted property
--FILE--
<?php
interface I {
public mixed $i { get; }
}
class C implements I {
public function __construct(
#[\Override]
public mixed $i,
) {}
}
echo "Done";
?>
--EXPECT--
Done

View file

@ -0,0 +1,17 @@
--TEST--
#[\Override]: Properties: invalid promoted property
--FILE--
<?php
class C {
public function __construct(
#[\Override]
public mixed $c,
) {}
}
echo "Done";
?>
--EXPECTF--
Fatal error: C::$c has #[\Override] attribute, but no matching parent property exists in %s on line %d

View file

@ -11,7 +11,6 @@ function boom()
$thing = new Thing();
xml_set_object($reader, $thing);
die("ok\n");
xml_parser_free($reader);
}
boom();
?>

View file

@ -8,7 +8,7 @@ if (extension_loaded("readline")) die("skip Test doesn't support readline");
<?php
$php = getenv('TEST_PHP_EXECUTABLE_ESCAPED');
$cmd = "$php -n -d memory_limit=4M -a \"".__DIR__."\"/bug40236.inc";
echo `$cmd`;
echo shell_exec($cmd);
?>
--EXPECT--
Interactive shell (-a) requires the readline extension.

View file

@ -9,22 +9,19 @@ class wrapper {
return true;
}
function stream_eof() {
throw new exception();
throw new Exception('cannot eof');
}
}
stream_wrapper_register("wrap", "wrapper");
$fp = fopen("wrap://...", "r");
feof($fp);
echo "Done\n";
try {
feof($fp);
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECTF--
Warning: feof(): wrapper::stream_eof is not implemented! Assuming EOF in %s on line %d
Fatal error: Uncaught Exception in %s:%d
Stack trace:
#0 [internal function]: wrapper->stream_eof()
#1 %s(%d): feof(Resource id #%d)
#2 {main}
thrown in %s on line %d
--EXPECT--
Exception: cannot eof

View file

@ -28,7 +28,7 @@ if (PHP_OS == 'Linux') {
}
}
elseif (PHP_OS == 'FreeBSD') {
$lines = explode("\n",`sysctl -a`);
$lines = explode("\n", shell_exec("sysctl -a"));
$infos = array();
foreach ($lines as $line) {
if (!$line){

View file

@ -17,5 +17,12 @@ function show_outputa($prepend, $output) {
show_outputa('Files: ', `cd .`); // this works as expected
?>
--EXPECT--
--EXPECTF--
Deprecated: The backtick (`) operator is deprecated, use shell_exec() instead in %s on line %d
Deprecated: The backtick (`) operator is deprecated, use shell_exec() instead in %s on line %d
Deprecated: The backtick (`) operator is deprecated, use shell_exec() instead in %s on line %d
Deprecated: The backtick (`) operator is deprecated, use shell_exec() instead in %s on line %d
Okey

View file

@ -1,7 +1,5 @@
--TEST--
Bug #67368 (Memory leak with immediately dereferenced array in class constant)
--INI--
report_memleaks=1
--FILE--
<?php
class FooBar {

View file

@ -1,16 +0,0 @@
--TEST--
Bug #79668 (get_defined_functions(true) may miss functions)
--INI--
disable_functions=sha1_file,password_hash
--FILE--
<?php
$df = get_defined_functions(true);
foreach (['sha1', 'sha1_file', 'hash', 'password_hash'] as $funcname) {
var_dump(in_array($funcname, $df['internal'], true));
}
?>
--EXPECT--
bool(true)
bool(false)
bool(true)
bool(false)

View file

@ -2,7 +2,6 @@
Bug #81104: Warning: "Failed to set memory limit to ... bytes" emitted after exit in debug
--INI--
memory_limit=5M
report_memleaks=0
--FILE--
<?php
#[AllowDynamicProperties]

View file

@ -0,0 +1,71 @@
--TEST--
Clone with basic
--FILE--
<?php
class Dummy { }
$x = new stdClass();
$foo = 'FOO';
$bar = new Dummy();
$array = [
'baz' => 'BAZ',
'array' => [1, 2, 3],
];
var_dump(clone $x);
var_dump(clone($x));
var_dump(clone($x, [ 'foo' => $foo, 'bar' => $bar ]));
var_dump(clone($x, $array));
var_dump(clone($x, [ 'obj' => $x ]));
var_dump(clone($x, [
'abc',
'def',
new Dummy(),
'named' => 'value',
]));
?>
--EXPECTF--
object(stdClass)#%d (0) {
}
object(stdClass)#%d (0) {
}
object(stdClass)#%d (2) {
["foo"]=>
string(3) "FOO"
["bar"]=>
object(Dummy)#%d (0) {
}
}
object(stdClass)#%d (2) {
["baz"]=>
string(3) "BAZ"
["array"]=>
array(3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
}
}
object(stdClass)#%d (1) {
["obj"]=>
object(stdClass)#%d (0) {
}
}
object(stdClass)#%d (4) {
["0"]=>
string(3) "abc"
["1"]=>
string(3) "def"
["2"]=>
object(Dummy)#%d (0) {
}
["named"]=>
string(5) "value"
}

View file

@ -0,0 +1,114 @@
--TEST--
Clone with respects visiblity
--FILE--
<?php
class P {
public $a = 'default';
protected $b = 'default';
private $c = 'default';
public private(set) string $d = 'default';
public function m1() {
return clone($this, [ 'a' => 'updated A', 'b' => 'updated B', 'c' => 'updated C', 'd' => 'updated D' ]);
}
}
class C extends P {
public function m2() {
return clone($this, [ 'a' => 'updated A', 'b' => 'updated B', 'c' => 'dynamic C' ]);
}
public function m3() {
return clone($this, [ 'd' => 'inaccessible' ]);
}
}
class Unrelated {
public function m3(P $p) {
return clone($p, [ 'b' => 'inaccessible' ]);
}
}
$p = new P();
var_dump(clone($p, [ 'a' => 'updated A' ]));
var_dump($p->m1());
$c = new C();
var_dump($c->m1());
var_dump($c->m2());
try {
var_dump($c->m3());
} catch (Error $e) {
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
}
try {
var_dump(clone($p, [ 'b' => 'inaccessible' ]));
} catch (Error $e) {
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
}
try {
var_dump(clone($p, [ 'd' => 'inaccessible' ]));
} catch (Error $e) {
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
}
try {
var_dump((new Unrelated())->m3($p));
} catch (Error $e) {
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
}
?>
--EXPECTF--
object(P)#%d (4) {
["a"]=>
string(9) "updated A"
["b":protected]=>
string(7) "default"
["c":"P":private]=>
string(7) "default"
["d"]=>
string(7) "default"
}
object(P)#%d (4) {
["a"]=>
string(9) "updated A"
["b":protected]=>
string(9) "updated B"
["c":"P":private]=>
string(9) "updated C"
["d"]=>
string(9) "updated D"
}
object(C)#%d (4) {
["a"]=>
string(9) "updated A"
["b":protected]=>
string(9) "updated B"
["c":"P":private]=>
string(9) "updated C"
["d"]=>
string(9) "updated D"
}
Deprecated: Creation of dynamic property C::$c is deprecated in %s on line %d
object(C)#%d (5) {
["a"]=>
string(9) "updated A"
["b":protected]=>
string(9) "updated B"
["c":"P":private]=>
string(7) "default"
["d"]=>
string(7) "default"
["c"]=>
string(9) "dynamic C"
}
Error: Cannot modify private(set) property P::$d from scope C
Error: Cannot access protected property P::$b
Error: Cannot modify private(set) property P::$d from global scope
Error: Cannot access protected property P::$b

View file

@ -0,0 +1,23 @@
--TEST--
Clone with supports property hooks
--FILE--
<?php
class Clazz {
public string $hooked = 'default' {
set {
$this->hooked = strtoupper($value);
}
}
}
$c = new Clazz();
var_dump(clone($c, [ 'hooked' => 'updated' ]));
?>
--EXPECTF--
object(Clazz)#%d (1) {
["hooked"]=>
string(7) "UPDATED"
}

View file

@ -0,0 +1,82 @@
--TEST--
Clone with evaluation order
--FILE--
<?php
class Clazz {
public string $hooked = 'default' {
set {
echo __FUNCTION__, PHP_EOL;
$this->hooked = strtoupper($value);
}
}
public string $maxLength {
set {
echo __FUNCTION__, PHP_EOL;
if (strlen($value) > 5) {
throw new \Exception('Length exceeded');
}
$this->maxLength = $value;
}
}
public string $minLength {
set {
echo __FUNCTION__, PHP_EOL;
if (strlen($value) < 5) {
throw new \Exception('Length unsufficient');
}
$this->minLength = $value;
}
}
}
$c = new Clazz();
var_dump(clone($c, [ 'hooked' => 'updated' ]));
echo PHP_EOL;
var_dump(clone($c, [ 'hooked' => 'updated', 'maxLength' => 'abc', 'minLength' => 'abcdef' ]));
echo PHP_EOL;
var_dump(clone($c, [ 'minLength' => 'abcdef', 'hooked' => 'updated', 'maxLength' => 'abc' ]));
?>
--EXPECTF--
$hooked::set
object(Clazz)#%d (1) {
["hooked"]=>
string(7) "UPDATED"
["maxLength"]=>
uninitialized(string)
["minLength"]=>
uninitialized(string)
}
$hooked::set
$maxLength::set
$minLength::set
object(Clazz)#%d (3) {
["hooked"]=>
string(7) "UPDATED"
["maxLength"]=>
string(3) "abc"
["minLength"]=>
string(6) "abcdef"
}
$minLength::set
$hooked::set
$maxLength::set
object(Clazz)#%d (3) {
["hooked"]=>
string(7) "UPDATED"
["maxLength"]=>
string(3) "abc"
["minLength"]=>
string(6) "abcdef"
}

View file

@ -0,0 +1,64 @@
--TEST--
Clone with error handling
--FILE--
<?php
class Clazz {
public string $hooked = 'default' {
set {
echo __FUNCTION__, PHP_EOL;
$this->hooked = strtoupper($value);
}
}
public string $maxLength {
set {
echo __FUNCTION__, PHP_EOL;
if (strlen($value) > 5) {
throw new \Exception('Length exceeded');
}
$this->maxLength = $value;
}
}
public string $minLength {
set {
echo __FUNCTION__, PHP_EOL;
if (strlen($value) < 5) {
throw new \Exception('Length insufficient');
}
$this->minLength = $value;
}
}
}
$c = new Clazz();
try {
var_dump(clone($c, [ 'hooked' => 'updated', 'maxLength' => 'abcdef', 'minLength' => 'abc' ]));
} catch (Throwable $e) {
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
}
echo PHP_EOL;
try {
var_dump(clone($c, [ 'hooked' => 'updated', 'minLength' => 'abc', 'maxLength' => 'abcdef' ]));
} catch (Throwable $e) {
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
$hooked::set
$maxLength::set
Exception: Length exceeded
$hooked::set
$minLength::set
Exception: Length insufficient

View file

@ -0,0 +1,16 @@
--TEST--
Clone with error cases
--FILE--
<?php
$x = new stdClass();
try {
var_dump(clone($x, 1));
} catch (Throwable $e) {
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
TypeError: clone(): Argument #2 ($withProperties) must be of type array, int given

View file

@ -0,0 +1,29 @@
--TEST--
Clone with supports __clone
--FILE--
<?php
class Clazz {
public function __construct(
public string $foo,
public string $bar,
) { }
public function __clone() {
$this->foo = 'foo updated in __clone';
$this->bar = 'bar updated in __clone';
}
}
$c = new Clazz('foo', 'bar');
var_dump(clone($c, [ 'foo' => 'foo updated in clone-with' ]));
?>
--EXPECTF--
object(Clazz)#%d (2) {
["foo"]=>
string(25) "foo updated in clone-with"
["bar"]=>
string(22) "bar updated in __clone"
}

View file

@ -0,0 +1,40 @@
--TEST--
Clone with readonly
--FILE--
<?php
readonly class Clazz {
public function __construct(
public public(set) string $a,
public public(set) string $b,
) { }
public function __clone() {
$this->b = '__clone';
}
}
$c = new Clazz('default', 'default');
var_dump(clone($c, [ 'a' => "with" ]));
try {
var_dump(clone($c, [ 'b' => "with" ]));
} catch (Throwable $e) {
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
}
?>
--EXPECTF--
object(Clazz)#%d (2) {
["a"]=>
string(4) "with"
["b"]=>
string(7) "__clone"
}
object(Clazz)#%d (2) {
["a"]=>
string(7) "default"
["b"]=>
string(4) "with"
}

View file

@ -0,0 +1,72 @@
--TEST--
Clone with lazy objects
--FILE--
<?php
class C {
public $a = 1;
public function __construct() {
}
}
function test(string $name, object $obj) {
printf("# %s:\n", $name);
$reflector = new ReflectionClass($obj::class);
$clone = clone($obj, [ 'a' => 2 ]);
var_dump($reflector->isUninitializedLazyObject($obj));
var_dump($obj);
var_dump($reflector->isUninitializedLazyObject($clone));
var_dump($clone);
}
$reflector = new ReflectionClass(C::class);
$obj = $reflector->newLazyGhost(function ($obj) {
var_dump("initializer");
$obj->__construct();
});
test('Ghost', $obj);
$obj = $reflector->newLazyProxy(function ($obj) {
var_dump("initializer");
return new C();
});
test('Proxy', $obj);
?>
--EXPECTF--
# Ghost:
string(11) "initializer"
bool(false)
object(C)#%d (1) {
["a"]=>
int(1)
}
bool(false)
object(C)#%d (1) {
["a"]=>
int(2)
}
# Proxy:
string(11) "initializer"
bool(false)
lazy proxy object(C)#%d (1) {
["instance"]=>
object(C)#%d (1) {
["a"]=>
int(1)
}
}
bool(false)
lazy proxy object(C)#%d (1) {
["instance"]=>
object(C)#%d (1) {
["a"]=>
int(2)
}
}

View file

@ -0,0 +1,21 @@
--TEST--
Clone with native classes
--FILE--
<?php
try {
var_dump(clone(new \Random\Engine\Secure(), [ 'with' => "something" ]));
} catch (Throwable $e) {
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
}
try {
var_dump(clone(new \Random\Engine\Xoshiro256StarStar(), [ 'with' => "something" ]));
} catch (Throwable $e) {
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
Error: Trying to clone an uncloneable object of class Random\Engine\Secure
Error: Cannot create dynamic property Random\Engine\Xoshiro256StarStar::$with

View file

@ -0,0 +1,18 @@
--TEST--
Clone with name mangling
--FILE--
<?php
class Foo {
private string $bar = 'default';
}
try {
var_dump(clone(new Foo(), ["\0Foo\0bar" => 'updated']));
} catch (Throwable $e) {
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
Error: Cannot access property starting with "\0"

View file

@ -0,0 +1,35 @@
--TEST--
Clone with property hook updating readonly property
--FILE--
<?php
class Clazz {
public string $foo {
set {
$this->foo = $value;
$this->bar = 'bar updated in hook';
}
}
public public(set) readonly string $bar;
}
$f = new Clazz();
var_dump(clone($f, ['foo' => 'foo updated in clone-with']));
try {
var_dump(clone($f, ['foo' => 'foo updated in clone-with', 'bar' => 'bar updated in clone-with']));
} catch (Throwable $e) {
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
}
?>
--EXPECTF--
object(Clazz)#%d (2) {
["foo"]=>
string(25) "foo updated in clone-with"
["bar"]=>
string(19) "bar updated in hook"
}
Error: Cannot modify readonly property Clazz::$bar

View file

@ -0,0 +1,31 @@
--TEST--
Clone with references
--FILE--
<?php
$x = new stdClass();
$ref = 'reference';
$with = ['x' => &$ref];
try {
var_dump(clone($x, $with));
} catch (Throwable $e) {
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
}
unset($ref);
try {
var_dump(clone($x, $with));
} catch (Throwable $e) {
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
}
?>
--EXPECTF--
Error: Cannot assign by reference when cloning with updated properties
object(stdClass)#%d (1) {
["x"]=>
string(9) "reference"
}

View file

@ -0,0 +1,64 @@
--TEST--
Closure::getCurrent()
--FILE--
<?php
$i = 1;
$c = function ($p) use (&$i) {
$self = Closure::getCurrent();
var_dump($p, $i);
$i++;
if ($p < 10) {
$self($p + 1);
}
};
$c(1);
var_dump($i);
function fail() {
Closure::getCurrent();
}
try {
fail();
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
function foo() {
var_dump(Closure::getCurrent());
}
try {
foo(...)();
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
int(1)
int(1)
int(2)
int(2)
int(3)
int(3)
int(4)
int(4)
int(5)
int(5)
int(6)
int(6)
int(7)
int(7)
int(8)
int(8)
int(9)
int(9)
int(10)
int(10)
int(11)
Current function is not a closure
Current function is not a closure

View file

@ -0,0 +1,5 @@
<?php
var_dump(__COMPILER_HALT_OFFSET__);
__halt_compiler();

View file

@ -0,0 +1,12 @@
--TEST--
GH-18850: Repeated inclusion of file with __halt_compiler() triggers "Constant already defined" warning
--FILE--
<?php
require __DIR__ . '/gh18850.inc';
require __DIR__ . '/gh18850.inc';
?>
--EXPECT--
int(62)
int(62)

View file

@ -36,5 +36,7 @@ object(Foo)#%d (3) {
["c":"Foo":private]=>
int(3)
}
Deprecated: Returning null from Bar::__debugInfo() is deprecated, return an empty array instead in %s on line %d
object(Bar)#%d (0) {
}

View file

@ -0,0 +1,31 @@
--TEST--
Testing __debugInfo() magic method
--FILE--
<?php
set_error_handler(
static function () {
echo "in handler\n";
$f = new Foo();
var_dump($f);
}
);
class Foo {
public function __debugInfo() {
return null;
}
}
$f = new Foo;
var_dump($f);
?>
--EXPECTF--
in handler
Deprecated: Returning null from Foo::__debugInfo() is deprecated, return an empty array instead in %s on line %d
object(Foo)#3 (0) {
}
object(Foo)#2 (0) {
}

View file

@ -16,8 +16,8 @@ $storage[Foo::Baz] = 'Baz';
var_dump($storage[Foo::Bar]);
var_dump($storage[Foo::Baz]);
var_dump($storage->contains(Foo::Bar));
var_dump($storage->contains(Foo::Qux));
var_dump($storage->offsetExists(Foo::Bar));
var_dump($storage->offsetExists(Foo::Qux));
$serialized = serialize($storage);
var_dump($serialized);

View file

@ -3,8 +3,6 @@ Bug #26698 (Thrown exceptions while evaluating argument to pass as parameter cra
--FILE--
<?php
ini_set("report_memleaks", 0); // the exception thrown in this test results in a memory leak, which is fine
class ObjectOne
{
function getNone()

View file

@ -104,7 +104,7 @@ int(10)
func_get_arg(): Argument #1 ($position) must be less than the number of the arguments passed to the currently executed function
int(1)
func_get_arg(): Argument #1 ($position) must be less than the number of the arguments passed to the currently executed function
Exception: Too few arguments to function test2(), 0 passed in %s002.php on line %d and exactly 1 expected
Exception: Too few arguments to function test2(), 0 passed in %s on line %d and exactly 1 expected
int(1)
int(2)
func_get_arg(): Argument #1 ($position) must be less than the number of the arguments passed to the currently executed function

View file

@ -59,7 +59,7 @@ array(1) {
[0]=>
int(1)
}
Exception: Too few arguments to function test2(), 0 passed in %s003.php on line %d and exactly 1 expected
Exception: Too few arguments to function test2(), 0 passed in %s on line %d and exactly 1 expected
array(2) {
[0]=>
int(1)
@ -68,7 +68,7 @@ array(2) {
}
array(0) {
}
Exception: Too few arguments to function test3(), 1 passed in %s003.php on line %d and exactly 2 expected
Exception: Too few arguments to function test3(), 1 passed in %s on line %d and exactly 2 expected
array(2) {
[0]=>
int(1)

Some files were not shown because too many files have changed in this diff Show more