Compare commits

...

6790 commits

Author SHA1 Message Date
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
Tim Düsterhus
2039664e47
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-15 13:36:56 +02:00
Jakub Zelenka
81d1529a13
Merge branch 'PHP-8.4' 2025-07-15 11:29:18 +02:00
Jakub Zelenka
0d19984cda
Merge branch 'PHP-8.3' into PHP-8.4 2025-07-15 11:24:34 +02:00
Jakub Zelenka
25c0874bc1
Use custom OpenSSL libctx for NCONF (#19130) 2025-07-15 09:30:15 +02:00
Daniel Scherzer
142e378618 Arginfo: add and use known strings for attribute values 2025-07-14 17:31:22 -07:00
Daniel Scherzer
0c920ecb07 gen_stub: use StringBuilder for attribute strings 2025-07-14 17:31:22 -07:00
Daniel Scherzer
ecdff3b563 gen_stub: add StringBuilder class for managing known strings
Split out from the PropertyInfo class so that known strings can also be used
for attributes in a follow-up commit.
2025-07-14 17:31:22 -07:00
Peter Kokot
a4d39f9713
Fix missing strnlen symbol on Solaris 10 (#19109)
- On Solaris, strnlen was implemented on Solaris 11.
- In Autotools, strnlen can be also checked in Zend scope as
  HAVE_STRNLEN is used only there.
2025-07-14 23:07:04 +02:00
Niels Dossche
9121b015c1
Implement GH-18550: Implement getElementsByClassName() (#19108)
Spec: https://dom.spec.whatwg.org/#ref-for-dom-element-getelementsbyclassname
2025-07-14 21:53:37 +02:00
Peter Kokot
114fc16266
GitHub: Remove ext/phar/php_phar.h (#19124)
This header is not installed anymore and not intended to be used as a
public header.
Related to: d7bdf902e5
2025-07-14 15:51:42 +02:00
Jakub Zelenka
b750aa8bfc
[ci skip] Update NEWS and UPGRADING with OpenSSL libctx changes 2025-07-14 15:23:54 +02:00
Jakub Zelenka
d0c0a9abfd
Introduce OpenSSL INI for selecting libctx (#18768)
Closes GH-18768

Co-authored-by: Gina Peter Banyard <girgias@php.net>
2025-07-14 15:16:14 +02:00
Dmitry Stogov
2beb44a80b
Merge branch 'PHP-8.4'
* PHP-8.4:
  Revert "Update IR"
2025-07-14 14:28:55 +03:00
Dmitry Stogov
9abb0fb0c4
Revert "Update IR"
This reverts commit e8ae27bf8a.

Something wrong in irrducable loops habdling that causes ir_find_loop()
to stuck. See https://github.com/php/php-src/issues/19104
2025-07-14 14:27:05 +03:00
Peter Kokot
4d9fc506df
Autotools, ext/gd: Ensure test program compiles without warnings (#19116)
In case compiler is configured in some strict way it might emit warnings
or even errors in the future if these aren't casted to void.
2025-07-13 17:17:14 +02:00
Peter Kokot
d40b603856
ext/gd: Make BMP always available (#19115)
- When building with bundled libgd, it has support for BMP
- When building with external libgd, at least 2.1.0 is required, which
  has BMP support.
- The HAVE_GD_PNG moved to PHP_GD_PNG Autoconf macro as it is always
  required when building with bundled libgd.
2025-07-13 15:25:53 +02:00
Peter Kokot
ba68cbefc5
ext/gd: Make TGA always available (#19105)
- When building with bundled libgd, it has support for TGA
- When building with external libgd, at least 2.1.0 is required, which
  has TGA support.
2025-07-13 11:45:44 +02:00
Yudai Takada
6e22d4c096
Refactor newline handling in zend_scan_escape_string to use HANDLE_NEWLINE macro (#19112) 2025-07-13 10:40:31 +02:00
Ilija Tovilo
a402edac1a
[skip ci] Add fatal_error_backtraces to php.ini templates (GH-19099) 2025-07-12 19:28:48 +02:00
Ilija Tovilo
9460dbe906
Fix lineno for constructor property promotion errors
Fixes GH-19081
Closes GH-19100
2025-07-12 19:15:48 +02:00
David CARLIER
46213f879a
ext/sockets: socket_addrinfo_lookup narrowing down socket family check to AF_INET/AF_INET6 only. (#19040) 2025-07-12 15:48:25 +01:00
Niels Dossche
a64cdd63f3
[ci skip] Update credits in NEWS 2025-07-12 10:03:30 +02:00
Niels Dossche
8712f4bf19
Fix OSS-Fuzz #427814452
Pipe compilation uses a temporary znode with QM_ASSIGN to remove
references. Assert compilation wants to look at the operand AST and
convert it to a string. However the original AST is lost due to the
temporary znode. To solve this we either have to handle this specially
in pipe compilation [1], or store the AST anyway somehow.
Special casing this either way is not worth the complexity in my
opinion, especially as it looks like a dynamic call anyway due to the
FCC syntax.

[1] Prototype (incomplete) at
    https://gist.github.com/nielsdos/50dc71718639c3af05db84a4dea6eb71
    shows this is not worthwhile in my opinion.

Closes GH-18965.

Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com>
2025-07-12 09:51:27 +02:00
Niels Dossche
f11ea2ae13 Refactor dom_html_collection_named_item()
This factors out the specific objmap handling to virtual functions.
This is the last step in preparation for GH-18550.
2025-07-11 12:29:29 +02:00
Niels Dossche
a2d65354a0 dom: Rename get_named_item -> get_ns_named_item, and has_named_item -> has_ns_named_item 2025-07-11 12:29:29 +02:00
Niels Dossche
5cacae8f29
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-19094: Attaching class with no Iterator implementation to MultipleIterator causes crash
2025-07-11 12:28:47 +02:00
Niels Dossche
76b6b60b8c
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-19094: Attaching class with no Iterator implementation to MultipleIterator causes crash
2025-07-11 12:28:25 +02:00
Yudai Takada
28cd3761a1
Remove unnecessary semicolon in match rule (#19096) 2025-07-11 10:36:25 +02:00
Yudai Takada
0dc83c2b10
Fix typo in SAPI and ADD_SOURCES description in upgrade notes (#19095)
[ci skip]
2025-07-11 10:35:43 +02:00
Niels Dossche
4aa8c2fe5d
dom: Remove unnecessary objmap ptr null checks (#19092) 2025-07-11 10:35:14 +02:00
Niels Dossche
e013b4a91e
Make cloning DOM node lists, maps, and collections fail
This never worked and creates a broken object,
and on master can cause a crash with foreach.
It makes no sense to fix a behaviour that never worked, block it
instead.

Closes GH-19089.
2025-07-11 10:34:25 +02:00
Niels Dossche
f6380e4a38
Merge branch 'PHP-8.4'
* PHP-8.4:
  ext/soap/php_http.c: Fix memory leak of header value
2025-07-10 22:32:58 +02:00
Niels Dossche
de7a212630
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  ext/soap/php_http.c: Fix memory leak of header value
2025-07-10 22:32:52 +02:00
Niels Dossche
5623e67fb6
Merge branch 'PHP-8.4'
* PHP-8.4:
  ext/gd: Drop useless and doubtful MSVC specific code (libgd/libgd@f1480ab)
2025-07-10 22:22:31 +02:00
Niels Dossche
5a45d71a11
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  ext/gd: Drop useless and doubtful MSVC specific code (libgd/libgd@f1480ab)
2025-07-10 22:22:26 +02:00
Niels Dossche
224f95f442
Merge branch 'PHP-8.4'
* PHP-8.4:
  Update NEWS for GH-19068
  ext/gd: Drop useless and doubtful MSVC specific code (libgd/libgd@f1480ab)
  Zend: fix undefined symbol 'execute_ex' on Windows ARM64 #19064; ext/gd: fix emmintrin.h not found on Windows ARM64
2025-07-10 22:15:43 +02:00
Niels Dossche
2fa0e55450
Update NEWS for GH-19068 2025-07-10 22:14:38 +02:00
Demon
12fa8c637f
ext/gd: Drop useless and doubtful MSVC specific code (libgd/libgd@f1480ab) 2025-07-10 22:13:29 +02:00
Demon
2be3aa86f0
Zend: fix undefined symbol 'execute_ex' on Windows ARM64 #19064; ext/gd: fix emmintrin.h not found on Windows ARM64 2025-07-10 22:13:29 +02:00
Niels Dossche
c4183fba00
Fix GH-19070: setlocale($type, NULL) should not be deprecated
This restores the old behaviour.

Closes GH-19071.
2025-07-10 22:01:16 +02:00
Calvin Buckley
0d584c32c5
pdo_odbc: Don't fetch 256 byte blocks for long columns (#10809)
* pdo_odbc: Don't fetch 256 byte blocks for long columns

Fetching 256 byte blocks can confuse some drivers with conversion
routines. That, and it seems to me the round trips to and from a
database could be a major performance impact.

Instead, we try to fetch all at once, and continue fetching if a
driver somehow has more for us.

This has been tested with a problematic case with the Db2i driver
with stateful MBCS encodings.

See GH-10733 for discussion about this and issues it can resolve.

* change to separate by 256 bytes, when C->fetched_len == SQL_NO_TOTAL

change to separate by 256 bytes, when C->fetched_len == SQL_NO_TOTAL

changed from 256 byte to 2048 byte buf block.

* Make long column buffer size single define

Could be configurable maybe, but best to avoid magic numbers even for a
compile-time constant.

* Use ZendMM page size minus zend_string overhead

Change recommended by Christoph.

Probably a little better performance wise I have to guess.

* [skip ci] Update comment to mention constant

* Update UPGRADING for PDO_ODBC change

mention GH issues in UPGRADING too

* Update NEWS for PDO_ODBC change

---------

Co-authored-by: SakiTakamachi <saki@sakiot.com>
2025-07-10 13:03:11 -03:00
Kasey Jenkins
cea0918352
Fix empty_fcall_info C++ missing-field-initializers warning (GH-19084)
Closes GH-19085
2025-07-10 11:02:39 +02:00
DanielEScherzer
07f1cfd9b0
Deprecate producing output in a user output handler (#19067)
https://wiki.php.net/rfc/deprecations_php_8_4
2025-07-09 21:20:58 -07:00
Calvin Buckley
964a404451
Use C23 unreachable() when possible (#19077)
This is a macro defined in stddef, which is already included in this
header. Since this is a macro, we can just check for the define rather
than add any additional build system checks.

Fixes GH-18975
2025-07-09 11:27:25 -03:00
Tim Düsterhus
b43a7ac0e7
Zend: Make EG(fake_scope) a const zend_class_entry* (#19060) 2025-07-09 11:55:53 +02:00
DanielEScherzer
64e2832bc8
Remove old zend_string compatibility aliases (#19034) 2025-07-07 14:53:59 -07:00
DanielEScherzer
d8577d9bfb
Deprecate returning non-string values from a user output handler (#18932)
https://wiki.php.net/rfc/deprecations_php_8_4
2025-07-07 14:31:13 -07:00
Niels Dossche
6cc21c4ee6
Optimize pack()
Instead of using lookup tables, we can use a combination of shifts and
byte swapping to achieve the same thing in less cycles and with less
code.

Benchmark files
---------------

pack1.php:
```php
for ($i = 0; $i < 10_000_000; ++$i) {
    pack("J", 0x7FFFFFFFFFFFFFFF);
}
```

pack2.php:
```php
for ($i = 0; $i < 4000000; ++$i) {
    pack("nvc*", 0x1234, 0x5678, 65, 66);
}
```

On an i7-4790:
```
Benchmark 1: ./sapi/cli/php pack1.php
  Time (mean ± σ):     408.8 ms ±   3.4 ms    [User: 406.1 ms, System: 1.6 ms]
  Range (min … max):   403.6 ms … 413.6 ms    10 runs

Benchmark 2: ./sapi/cli/php_old pack1.php
  Time (mean ± σ):     451.7 ms ±   7.7 ms    [User: 448.5 ms, System: 2.0 ms]
  Range (min … max):   442.8 ms … 461.2 ms    10 runs

Summary
  ./sapi/cli/php pack1.php ran
    1.11 ± 0.02 times faster than ./sapi/cli/php_old pack1.php

Benchmark 1: ./sapi/cli/php pack2.php
  Time (mean ± σ):     239.3 ms ±   6.0 ms    [User: 236.2 ms, System: 2.3 ms]
  Range (min … max):   233.2 ms … 256.8 ms    12 runs

Benchmark 2: ./sapi/cli/php_old pack2.php
  Time (mean ± σ):     271.9 ms ±   3.3 ms    [User: 269.7 ms, System: 1.3 ms]
  Range (min … max):   267.4 ms … 279.0 ms    11 runs

Summary
  ./sapi/cli/php pack2.php ran
    1.14 ± 0.03 times faster than ./sapi/cli/php_old pack2.php
```

On an i7-1185G7:
```
Benchmark 1: ./sapi/cli/php pack1.php
  Time (mean ± σ):     263.7 ms ±   1.8 ms    [User: 262.6 ms, System: 0.9 ms]
  Range (min … max):   261.5 ms … 268.2 ms    11 runs

Benchmark 2: ./sapi/cli/php_old pack1.php
  Time (mean ± σ):     303.3 ms ±   6.5 ms    [User: 300.7 ms, System: 2.3 ms]
  Range (min … max):   297.4 ms … 318.1 ms    10 runs

Summary
  ./sapi/cli/php pack1.php ran
    1.15 ± 0.03 times faster than ./sapi/cli/php_old pack1.php

Benchmark 1: ./sapi/cli/php pack2.php
  Time (mean ± σ):     156.7 ms ±   2.9 ms    [User: 154.7 ms, System: 1.7 ms]
  Range (min … max):   151.6 ms … 164.7 ms    19 runs

Benchmark 2: ./sapi/cli/php_old pack2.php
  Time (mean ± σ):     174.6 ms ±   3.3 ms    [User: 171.9 ms, System: 2.3 ms]
  Range (min … max):   170.7 ms … 180.4 ms    17 runs

Summary
  ./sapi/cli/php pack2.php ran
    1.11 ± 0.03 times faster than ./sapi/cli/php_old pack2.php
```

Closes GH-18524.

Co-authored-by: divinity76 <divinity76@gmail.com>
2025-07-07 22:28:12 +02:00
DanielEScherzer
45215d0e78
php_spl.c: fix typo in spl_classes() description [skip ci] 2025-07-07 12:33:36 -07:00
Tim Düsterhus
45d948f2da
Zend: Add zend_check_method_accessible() to DRY method visibility checks (#18995)
* Zend: Add `zend_check_method_accessible()` to DRY method visibility checks

* Zend: Add assertions verifying flags didn't change before `zend_check_method_accessible()`

* Try `zend_always_inline` for `zend_check_method_accessible`
2025-07-07 21:30:13 +02:00
DanielEScherzer
9225cb45ac
Make zend_register_*_constant() functions return pointers, use them (#19029)
Have each of the specialized methods for registering a constant return a
pointer to the registered constant the same way that the generic
`zend_register_constant()` function does, and use those in the generated
arginfo files to avoid needing to search for a constant that was just
registered in order to add attributes to it.
2025-07-07 12:23:52 -07:00
DanielEScherzer
b0aaa31702
Remove old exception class getters (#19043) 2025-07-07 11:43:07 -07:00
Peter Kokot
d154c7253e
Autoconf: Move getlogin check for HAVE_GETLOGIN to ext/posix (#19058)
This check is related only to ext/posix so it's more clear to have it
defined when ext/posix is enabled.
2025-07-07 17:43:36 +02:00
Ilija Tovilo
1039cebb87
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Add missing zlib dep to phar compression test
2025-07-07 16:28:58 +02:00
Ilija Tovilo
74784a0d52
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [skip ci] Add missing zlib dep to phar compression test
2025-07-07 16:28:49 +02:00
Dmitry Stogov
dd69b65638
Merge branch 'PHP-8.4'
* PHP-8.4:
  Update IR
2025-07-07 14:03:36 +03:00
Dmitry Stogov
e8ae27bf8a
Update IR
IR commit: af6dc83bcd91c3123f40efcdcbeba8794b9b2abf
2025-07-07 14:03:11 +03:00
Zheng Yu
b068ee307f
Fix unreachable code in URL output handler (#19056)
Since `ZSTR_LEN()` returns a `size_t` (unsigned integer), the value can only be either "not equal to 0" or "equal to 0". The third `else` branch was unreachable, making the `*handled_output = NULL;` assignment dead code.
2025-07-07 10:57:43 +01:00
Peter Kokot
3b45b9d74e
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix -Wuseless-escape warnings emitted by re2c (#19050)
2025-07-07 09:52:51 +02:00
Peter Kokot
ab6e73066b
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix -Wuseless-escape warnings emitted by re2c (#19050)
2025-07-07 09:51:50 +02:00
Peter Kokot
c2af281c0c
Use <winsock2.h> instead of legacy <winsock.h> (#19037)
This also omits defining unused HAVE_WINSOCK_H macro when building
ext/sockets.
2025-07-07 09:40:03 +02:00
Peter Kokot
aa366b5113
Update re2c minimum versions in Windows checks and docs (#19039) 2025-07-07 07:54:29 +02:00
Tim Düsterhus
c1ed6088a6
uri: Do not overwrite defaultMemoryManager (#19042)
The `defaultMemoryManager` is only available via a non-public
header and is not supposed to be used by users of the library [1].
It also has a very generic name, further indicating that it is not
supposed to be used.

Instead pass the memory manager explicitly, which is how the library is
supposed to be used.

[1] https://github.com/uriparser/uriparser/issues/52#issuecomment-453853700
2025-07-06 20:48:14 +02:00
Gina Peter Banyard
22f2a1d47b ext/pcntl: Pack module globals struct
This saves 8 bytes
2025-07-06 18:24:38 +01:00
Gina Peter Banyard
3de6695ae8 ext/pcntl: Use uint8_t type for num_signals module global 2025-07-06 18:24:38 +01:00
Gina Peter Banyard
89e4de8d7b ext/pcntl: Use bool type for some module globals
This clarifies intention and uses less bytes in the struct
2025-07-06 18:24:38 +01:00
Gina Peter Banyard
36358bad84 ext/session: get rid of sname_len field
This is unnecessary now that the session name is a zend_string
2025-07-06 17:21:00 +01:00
Gina Peter Banyard
c3dac0f8b6 ext/session: Minor code cleanups 2025-07-06 17:21:00 +01:00
Gina Peter Banyard
db01dbc4ee ext/session: Initialize variable with default value
To make it easier for IDEs to understand what is going on
2025-07-06 17:21:00 +01:00
Gina Peter Banyard
766ccc2210 ext/session: Use zend_string for some session globals 2025-07-06 17:21:00 +01:00
Gina Peter Banyard
f5166b3bb6 ext/session: convert global session_name to zstr 2025-07-06 17:21:00 +01:00
Gina Peter Banyard
b83484df97 ext/session: Use is_numeric_str helper 2025-07-06 17:21:00 +01:00
Gina Peter Banyard
ac3807ee8d ext/session: Use ZEND_STRL() 2025-07-06 17:21:00 +01:00
Gina Peter Banyard
c529e2f85b ext/session: Use smart_str_append when possible 2025-07-06 17:21:00 +01:00
Gina Peter Banyard
eaee504c4d ext/session: Concert save_path to zstr 2025-07-06 17:21:00 +01:00
Gina Peter Banyard
9c68853023 ext/session: copy zstr instead of initializing a new one 2025-07-06 17:21:00 +01:00
Gina Peter Banyard
43fe9fd171 ext/session: convert some globals to zend_string
This prevents some strlen computations
2025-07-06 17:21:00 +01:00
Gina Peter Banyard
677a1f80c8
ext/standard/stream: Use FCC instead of zval for notification callback (#19024)
Also check that the callable exists while setting the option
2025-07-06 01:30:07 +01:00
Gina Peter Banyard
c33805791d
sapi/fuzzer: Fetch function and call it directly instead of using a zval to hold the name (#19030) 2025-07-06 01:29:48 +01:00
Niels Dossche
5a2a150829
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix phar crash and file corruption with SplFileObject
2025-07-05 21:44:39 +02:00
Niels Dossche
2aeefb13be
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix phar crash and file corruption with SplFileObject
2025-07-05 21:44:34 +02:00
Niels Dossche
4d27420543
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix stream double free in phar
2025-07-05 21:32:29 +02:00
Niels Dossche
50a5a6f315
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix stream double free in phar
2025-07-05 21:31:50 +02:00
Máté Kocsis
5a9f5a6514
Add the Uri\Rfc3986\Uri class to ext/uri without wither support (#18836)
Relates to #14461 and https://wiki.php.net/rfc/url_parsing_api

Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
Co-authored-by: Tim Düsterhus <tim@tideways-gmbh.com>
2025-07-05 10:00:20 +02:00
DanielEScherzer
4560f7037d
EXTENSIONS: lexbor is since 2025 [skip ci] (#19031) 2025-07-04 15:10:16 -07:00
Niels Dossche
832dde9cb6
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix OSS-Fuzz #428983568 and #428760800
2025-07-04 23:58:41 +02:00
Niels Dossche
1af7d8e547
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix OSS-Fuzz #428983568 and #428760800
2025-07-04 23:58:33 +02:00
DanielEScherzer
4e42ad5bf2
ext/standard/string.c: don't use STR_EMPTY_ALLOC() (#19033)
This was the only remaining use of a compatibility alias from 10 years ago;
replace with `ZSTR_EMPTY_ALLOC()`.
2025-07-04 14:41:24 -07:00
DanielEScherzer
3558293ce8
Remove broken zend_get_zendleng() declaration (#19032)
Does not actually exist anywhere
2025-07-04 14:40:54 -07:00
DanielEScherzer
d43fbc0c0e
ReflectionParameter::allowsNull() - fix typo in description [skip ci] 2025-07-04 12:33:48 -07:00
DanielEScherzer
0cdb5d0aa1
release-process: update based on 8.5.0alpha1 announcement (#19028)
* Add reminder to replace outdated information in the announcements
* Add instruction for new RMs to subscribe to the lists they need to email
2025-07-04 11:30:31 -07:00
Remi Collet
75006cf21d
avoid false failure for long path (#18992) 2025-07-04 08:33:07 +02:00
Máté Kocsis
8bb6b81c60
Update uriparser to commit 8c06d 2025-07-04 08:20:27 +02:00
Gina Peter Banyard
50ddf6a68f ext/spl: Refactor ArrayObject sort methods 2025-07-03 21:50:45 +01:00
Gina Peter Banyard
faef004250 ext/spl: Add tests for disabled sort functions 2025-07-03 21:50:45 +01:00
Niels Dossche
aa0e8bf568 Use ZVAL_NULL() directly for Z_CLIENT_USE_PROXY_P()
This is just a `?int` property, no need to do anything fancy.
2025-07-03 20:37:10 +02:00
Niels Dossche
8fdd434bb5 Don't deref soap private properties
They are private and can't be made references.
2025-07-03 20:37:10 +02:00
Niels Dossche
e6e0887005 soap: Avoid redundant copying of http body string 2025-07-03 20:28:38 +02:00
Niels Dossche
32f0d24e1f soap: Get decompression function directly from function table and call it
The code is already looking up the entry in the function table anyway,
so might as well use it directly.
This simplifies the code and avoids a redundant lookup.
2025-07-03 20:28:38 +02:00
Ben Ramsey
568370827e
Merge branch 'PHP-8.4' 2025-07-03 10:36:08 -05:00
Ben Ramsey
2cb292de6b
Merge branch 'PHP-8.3' into PHP-8.4 2025-07-03 10:35:50 -05:00
Tim Düsterhus
f61ae0001c
Zend: constify various parameters in zend_object_handlers and zend_lazy_objects (#19019) 2025-07-03 16:32:10 +02:00
Remi Collet
840dc1981f
fix ldap.h detection without pkgconfig (#19005) 2025-07-03 15:24:35 +02:00
Saki Takamachi
7fcdf8369e
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-18873 - Free column->descid appropriately (#18957)
2025-07-03 21:25:22 +09:00
Saki Takamachi
f512cffcd0
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-18873 - Free column->descid appropriately (#18957)
2025-07-03 21:24:56 +09:00
Gina Peter Banyard
f91f80ca19
Zend: Return anonymous closure names in zend_get_callable_name_ex() (#19011)
This returns the usual `{closure:FILE_NAME/FUNCTION:LINE_NO}` for anonymous functions rather than `Closure::__invoke` this is visible for `is_callable()` and any Engine call that uses `zend_fcall_info_init()` to get the name of the callable.

Related to GH-18063.
2025-07-03 12:01:11 +01:00
Tim Düsterhus
4492a4219a
random: Remove useless zend_string allocation in randomizer_common_init() (#19007) 2025-07-03 08:48:49 +02:00
Niels Dossche
51149b65ad
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-18990, bug #81029, bug #47314: SOAP HTTP socket not closing on object destruction
  Fix leak when path is too long in ZipArchive::extractTo()
  curl: Remove incorrect string release on error
2025-07-02 18:47:53 +02:00
Niels Dossche
764154dc75
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-18990, bug #81029, bug #47314: SOAP HTTP socket not closing on object destruction
  Fix leak when path is too long in ZipArchive::extractTo()
  curl: Remove incorrect string release on error
2025-07-02 18:46:37 +02:00
Tim Düsterhus
1a4dfd5658
random: Fix error message formatting for Randomizer::getFloat() (#19008)
Error messages should not end with a `.`.
2025-07-02 13:58:05 +02:00
Tim Düsterhus
ec8b016d08
uri: Do not create new UrlValidationErrorType objects (#19009)
`zend_enum_new()` is not intended to be used “at runtime”, since it will create
a new object, breaking the singleton property. Instead
`zend_enum_get_case_cstr()` must be used.
2025-07-02 13:57:50 +02:00
DanielEScherzer
f906fad985
release-process: update based on 8.5.0alpha1 (#19004)
* Clarify that placeholders with `RCn` are not just for release candidates
* Only PHP `X.Y.0` has pre-GA releases, no need to use `X.Y.Z`
* Before `PHP-X.Y` has been created, `master` needs to be pushed for NEWS
2025-07-02 02:48:05 -07:00
Saki Takamachi
b8b0497697
Merge branch 'PHP-8.4'
* PHP-8.4:
  PHP-8.4 is now for PHP 8.4.11-dev
2025-07-02 11:40:35 +09:00
Saki Takamachi
d5fe1bce63
PHP-8.4 is now for PHP 8.4.11-dev 2025-07-02 11:39:33 +09:00
Peter Kokot
8a75b3c50c
Remove conditional checks for ssize_t type (#18996)
The ssize_t type is already used unconditionally in php-src code
everywhere except the main/s{n,p}printf.c files. On Windows ssize_t is
available as an alias to the SSIZE_T defined in BaseTsd.h (available in
affected files through the included windows.h in zend_config.w32.h).

This also makes the Autoconf macro PHP_CHECK_SIZEOF obsolete in favor of
the AC_CHECK_SIZEOF, which is more convenient to check for types without
the need to run the test program - omitting the cross-compilation
issues. AC_CHECK_SIZEOF once didn't provide including additional headers
(resolved in Autoconf versions after 2.13).
2025-07-02 01:45:40 +02:00
Daniel Scherzer
45c46504e2
[ci skip] Update NEWS for PHP 8.5.0 alpha2 2025-07-01 15:02:55 -07:00
DanielEScherzer
642d729847
release-process: update some confusing parts (#18934)
Update based on my training with Pierrick
* dates should correspond to when releases are released, not tagged
* qa.php.net is no longer used
* bugs.php.net is no longer used
* multiple commits to web-php can be combined
2025-07-01 13:24:44 -07:00
Ben Ramsey
607eec8532
Merge branch 'PHP-8.4' 2025-07-01 15:22:10 -05:00
Ben Ramsey
881ec133d9
Merge branch 'PHP-8.3' into PHP-8.4 2025-07-01 15:21:57 -05:00
Máté Kocsis
66376389fe
Update uriparser to commit 5f7c6d88c50f548d0c7f499c22d36f51d34775b3
While there, fix Windows build by adding UriResolve.c to the sources.
2025-07-01 21:53:33 +02:00
Tim Düsterhus
59dd0f8a48
Zend: Use zend_bad_method_call() when cloning from the wrong scope (#18999) 2025-07-01 20:24:11 +02:00
Sergey Panteleev
f71271dbaa
Merge branch 'PHP-8.4'
* PHP-8.4:
  PHP-8.2 is now for PHP 8.2.30-dev
  Update NEWS with entries for security fixes
  Fix GHSA-453j-q27h-5p8x
  Fix GHSA-hrwm-9436-5mv3: pgsql escaping no error checks
  Fix GHSA-3cr5-j632-f35r: Null byte in hostnames
2025-07-01 19:59:05 +03:00
Sergey Panteleev
7a3c0d3519
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  PHP-8.2 is now for PHP 8.2.30-dev
  Update NEWS with entries for security fixes
  Fix GHSA-453j-q27h-5p8x
  Fix GHSA-hrwm-9436-5mv3: pgsql escaping no error checks
  Fix GHSA-3cr5-j632-f35r: Null byte in hostnames
2025-07-01 19:58:36 +03:00
Niels Dossche
d706dc1f80
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix OSS-Fuzz #427814456
2025-07-01 18:52:44 +02:00
Niels Dossche
5d590a1e87
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix OSS-Fuzz #427814456
2025-07-01 18:52:39 +02:00
Niels Dossche
30662e4e2b
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-18979: DOM\XMLDocument::createComment() triggers undefined behavior with null byte
2025-07-01 18:51:31 +02:00
Niels Dossche
1d5089e574
Fix GH-18979: DOM\XMLDocument::createComment() triggers undefined behavior with null byte
Closes GH-18983.
2025-07-01 18:51:21 +02:00
Eric Mann
50e1b23efb
Merge branch 'PHP-8.4'
* PHP-8.4:
  Update NEWS with entries for security fixes
  Fix GHSA-453j-q27h-5p8x
  Fix GHSA-hrwm-9436-5mv3: pgsql escaping no error checks
  Fix GHSA-3cr5-j632-f35r: Null byte in hostnames
2025-07-01 09:41:14 -07:00
Eric Mann
7f5d491a05
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Update NEWS with entries for security fixes
  Fix GHSA-453j-q27h-5p8x
  Fix GHSA-hrwm-9436-5mv3: pgsql escaping no error checks
  Fix GHSA-3cr5-j632-f35r: Null byte in hostnames
2025-07-01 09:39:53 -07:00
Ilija Tovilo
927aecaf6d
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix missing HAVE_JIT guard
2025-07-01 17:50:48 +02:00
Ilija Tovilo
49d94cced0
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GHSA-453j-q27h-5p8x
  Fix GHSA-hrwm-9436-5mv3: pgsql escaping no error checks
  Fix GHSA-3cr5-j632-f35r: Null byte in hostnames
2025-07-01 17:48:00 +02:00
Ilija Tovilo
c57ec92eb6
Fix missing HAVE_JIT guard
Closes GH-18993
2025-07-01 17:44:11 +02:00
Ahmed Lekssays
a179e39c38
Fix GHSA-453j-q27h-5p8x
Libxml versions prior to 2.13 cannot correctly handle a call to
xmlNodeSetName() with a name longer than 2G. It will leave the node
object in an invalid state with a NULL name. This later causes a NULL
pointer dereference when using the name during message serialization.

To solve this, implement a workaround that resets the name to the
sentinel name if this situation arises.

Versions of libxml of 2.13 and higher are not affected.

This can be exploited if a SoapVar is created with a fully qualified
name that is longer than 2G. This would be possible if some application
code uses a namespace prefix from an untrusted source like from a remote
SOAP service.

Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
2025-07-01 23:01:17 +09:00
Jakub Zelenka
66bd809ac9
Fix GHSA-hrwm-9436-5mv3: pgsql escaping no error checks
This adds error checks for escape function is pgsql and pdo_pgsql
extensions. It prevents possibility of storing not properly escaped
data which could potentially lead to some security issues.
2025-07-01 23:01:16 +09:00
Jakub Zelenka
5ef0dc7666
Fix GHSA-3cr5-j632-f35r: Null byte in hostnames
This fixes stream_socket_client() and fsockopen().

Specifically it adds a check to parse_ip_address_ex and it also makes
sure that the \0 is not ignored in fsockopen() hostname formatting.
2025-07-01 23:01:16 +09:00
Niels Dossche
4a98b36416
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-18898: SEGV zend_jit_op_array_hot with property hooks and preloading
2025-06-30 18:38:30 +02:00
Niels Dossche
53f2aa93ae
Fix GH-18898: SEGV zend_jit_op_array_hot with property hooks and preloading
Property hooks were not handled for JIT+trait+preloading.
Split the existing functions that handle op arrays, and add iterations
for property hooks.

Closes GH-18923.
2025-06-30 18:38:11 +02:00
Daniil Gentili
f6f0aed9f3
Allow using fast destruction path when ASAN is in use (#18835) 2025-06-30 18:37:20 +02:00
Shivam Mathur
a1d4b18d8d
Merge branch 'PHP-8.4' 2025-06-30 20:03:10 +05:30
Shivam Mathur
cb4940051a
Merge branch 'PHP-8.3' into PHP-8.4 2025-06-30 20:02:45 +05:30
Tim Düsterhus
c9249e2d3a
Support every argument syntax for clone() (#18938)
* zend_language_parser: Support every argument syntax for `clone()`

* zend_language_parser: Adjust `clone()` grammar to avoid conflicts

* zend_language_parser: Add explanatory comment for `clone_argument_list`
2025-06-30 12:31:27 +02:00
Arnaud Le Blanc
bbc465efff
Merge branch 'PHP-8.4'
* PHP-8.4:
  Add FreeBSD ZTS nightly build
2025-06-30 11:48:07 +02:00
Arnaud Le Blanc
562660df9b
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Add FreeBSD ZTS nightly build
2025-06-30 11:48:01 +02:00
Niels Dossche
4a18c895ca
Fix OSS-Fuzz #428053935 (#18969)
Registering the constant may happen under another name due to
lowercasing. This will cause the lookup to the constant to fail.
Instead of looking it up, just change the Zend API to return a pointer
instead.
2025-06-30 09:09:55 +02:00
Peter Kokot
db157e3168
Remove redundant PCRE_STATIC definition (#18952)
Current minimum PCRE2 library in PHP is 10.30 (with bundled 10.45) and
none of these versions use PCRE_STATIC macro anymore in favor of
PCRE2_STATIC, which is defined in the generated config.w32.h on Windows.
2025-06-29 20:56:07 +02:00
Peter Kokot
93e3aca5fa
Remove HAVE_INTMAX_T and SIZEOF_INTMAX_T (#18971)
The intmax_t is a C99 standard type defined in `<stdint.h>` and widely
available on current platforms. On Windows they are available as of
Visual Studio 2013. Using it conditionally as in these occurrences is
not needed anymore.
2025-06-29 19:50:27 +02:00
David Carlier
9644ba6dcd
Merge branch 'PHP-8.4' 2025-06-29 16:59:04 +01:00
David Carlier
ef08bce645
Merge branch 'PHP-8.3' into PHP-8.4 2025-06-29 16:58:05 +01:00
Niels Dossche
1a5128f51e
[ci skip] Fix comment typo in opcache 2025-06-29 16:51:23 +02:00
David CARLIER
1d5da8660b
ext/sqlite3: relax sqlite3 explain test conditions (#18949) 2025-06-29 13:58:58 +01:00
Niels Dossche
8d116a4ba1
Implement GH-15483: Use C23 memset_explicit() for ZEND_SECURE_ZERO() if available (#18713) 2025-06-29 14:29:28 +02:00
Niels Dossche
761478a032
[ci skip] Update OSS-Fuzz link 2025-06-29 01:00:15 +02:00
Peter Kokot
fffe642d67
Remove HAVE_PTRDIFF_T and SIZEOF_PTRDIFF_T (#18968)
The ptrdiff_t is a C89 standard type defined in `<stddef.h>` and widely
available on current platforms. Using it conditionally as in these
occurrences is not needed anymore.
2025-06-28 20:16:12 +02:00
Niels Dossche
984bcb5d69
ext/mysqli: Get rid of calls to strcpy (#18970)
strcpy is a dangerous API that should be avoided.
2025-06-28 14:04:39 +02:00
Niels Dossche
737db4a7dc
Use hasThis() where appropriate (#18967)
This macro was introduced to solve false compilers warning about the getThis()
condition not making sense for the address-taken part of the ternary.
2025-06-28 10:12:43 +02:00
Niels Dossche
44955943f9
ext/intl: Use zval_get_tmp_string where possible (#18966) 2025-06-28 10:12:20 +02:00
Dmitrii Derepko
22e444c5c7
[skip ci] README: Add macos instruction + other tweaks (GH-18670) 2025-06-27 21:33:49 +02:00
Dmitrii Derepko
25e1674fbe
[skip ci] Add editor config dirs to gitignore (GH-18669) 2025-06-27 20:59:46 +02:00
Arnaud Le Blanc
e0ab056d0c
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix pcntl_rfork / pcntl_forkx with zend-max-execution-timers
2025-06-27 15:47:36 +02:00
Arnaud Le Blanc
dd1a07f207
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix pcntl_rfork / pcntl_forkx with zend-max-execution-timers
2025-06-27 15:47:21 +02:00
Niels Dossche
c7c6a79bd0
Add support for ParentNode::$children (#18908)
ParentNode::$children returns a HTMLCollection of all directly
descendant child elements of a container.

I had to move around some properties such that the ParentNode property
offsets are always at a fixed offset, to simplify the code.
This also adds the necessary code to deal with GC cycles in
HTMLCollections.
Furthermore, we also disable cloning a HTMLCollection as that never
worked and furthermore it also conflicts with the [[SameObject]] WebIDL
requirement of $children.
2025-06-27 09:03:50 +02:00
Gina Peter Banyard
1b7f4567cb
ext/date: Fix tests (#18891) 2025-06-26 22:38:08 +02:00
DanielEScherzer
171501b93f
Replace @deprecated with #[\Deprecated] for internal constants (#18780)
Only covers constants declared via stub files, others will be handled
separately in a later commit.

Does not include the intl extension, since that had some errors relating to the
cpp code; that extension will be updated separately.
2025-06-26 11:27:15 -07:00
DanielEScherzer
e98879f19c
main.c: fix a typo, add some capitalization [skip ci] (#18905) 2025-06-26 10:52:33 -07:00
Saki Takamachi
8b61c49987
Allowed the use of formats like @param array<> (#18924) 2025-06-25 18:36:20 +09:00
Ilija Tovilo
aab281546c
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix CI for windows-2022
2025-06-25 00:20:55 +02:00
Ilija Tovilo
86e5c67d6c
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix CI for windows-2022
2025-06-25 00:20:44 +02:00
Shivam Mathur
9adc94985f
Merge branch 'PHP-8.4' 2025-06-25 03:23:03 +05:30
Shivam Mathur
a8bd3ba1bb
Merge branch 'PHP-8.3' into PHP-8.4 2025-06-25 03:22:43 +05:30
Niels Dossche
be23be08dc
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix RCN violations in array functions
2025-06-24 23:30:08 +02:00
Niels Dossche
f77c04d007
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix RCN violations in array functions
2025-06-24 23:29:50 +02:00
David CARLIER
2965fb843d
ext/pcntl: following up #15921 rework SYS_pidfd_open configure detection. (#18931) 2025-06-24 21:55:00 +01:00
Shivam Mathur
720917f39a
Merge branch 'PHP-8.4' 2025-06-25 02:03:18 +05:30
Shivam Mathur
d2a30acf33
Merge branch 'PHP-8.3' into PHP-8.4 2025-06-25 02:01:59 +05:30
Niels Dossche
6d15475815 sqlite3: Split off column name cache generation
Also no need to reset the cache unconditionally in fetchAll().
2025-06-24 22:09:54 +02:00
Niels Dossche
e7678cdaa4 sqlite3: Use Z_TRY_ADDREF 2025-06-24 22:09:54 +02:00
DanielEScherzer
41d3440658
NEWS: add a missing backtick [skip ci] 2025-06-24 13:05:52 -07:00
Vladimir Vrzić
aea3ade74f
ext/pcntl: Added rusage parameter to pcntl_waitid
This functionality is not part of the POSIX interface.

- On FreeBSD, the wait6 system call provides it
- On Linux, the raw waitid system call provides it (glibc does not)

close GH-15921
2025-06-24 19:21:03 +01:00
Tim Düsterhus
ca49a7bec2
RFC: Turn clone() into a function (#18919)
RFC: https://wiki.php.net/rfc/clone_with_v2

Co-authored-by: Volker Dusch <volker@tideways-gmbh.com>
2025-06-24 20:14:40 +02:00
Niels Dossche
5ed8b2be55
Fix GH-18897: printf: empty precision is interpreted as precision 6, not as precision 0 (#18912)
Like in other languages, and especially C where printf originates from,
a missing precision should be treated as a 0 precision.
Because the ADJ_PRECISION flag was not set, the double formatting code
resetted the precision to the default float precision of 6.
2025-06-24 19:06:47 +02:00
Tim Düsterhus
39cf27689b
php_gdb: Print some numeric fields as hexadecimal (#18925)
* php_gdb: Print `zend_string*`’s `h` field as hexadecimal

A decimal representation of a hash value is not particularly meaningful and
makes it harder to compare hash values.

* php_gdb: Print `HashTable*`’s `nTableMask` field as hexadecimal
2025-06-24 15:22:25 +02:00
Saki Takamachi
537ae4f990
removed ZEND_IS_XDIGIT() (#18926) 2025-06-24 20:40:09 +09:00
Jakub Zelenka
fc04966c36
Add NEWS and UPGRADING for sendmail error handling changes 2025-06-24 12:30:35 +02:00
Jesse Hathaway
6a7561203d
mail: add logging on errors
Prior to this commit the exit code of the sendmail command, called by
the mail function was lost, since the mail function only returns true or
false. Add additional logging to the mail function to capture the exit
code when the sendmail command fails.
2025-06-24 11:55:45 +02:00
Jesse Hathaway
c5e7490963
mail: fix exit code handling of sendmail cmd
Prior to this commit the return code of the pclose function was assumed
to be the exit code of the process. However, the returned value as
specified in wait(2) is a bit packed integer and must be interpreted
with the provided macros. This has no effect in success cases as the
integer is still zero, but in failure cases the wrong value is used,
since the 8 least significant bits contain the status code. After this
commit we use the macros to obtain the status code, which fixes the
EX_TEMPFAIL conditional.

For WIN32 the TSRM popen_ex and pclose function are used. The return
value of TSRM's pclose is not bit packed so we only check if the return
value is non-zero, which should solve, #43327,
https://bugs.php.net/bug.php?id=43327
2025-06-24 11:55:34 +02:00
Tim Düsterhus
d6fc7430b9
zend_string: Simplify logic in zend_interned_strings_init() (#18922)
No need to manually init a `zend_string` to then intern it, we can directly
intern it while initializing, bypassing some of the safety checks that are
redundant in this case.
2025-06-24 08:50:47 +02:00
Peter Kokot
ecc602e3bb
Remove non-existing INI directive detect_unicode (#18909)
The detect_unicode was removed and zend.detect_unicode was added in PHP
5.4 (bbf3d43c1e).
2025-06-23 23:44:20 +02:00
Peter Kokot
29e94f89db
Autotools: Remove obsole Autoconf macros (#18914)
These Autoconf macros have been marked as obsolete in PHP-8.4 and now
also removed:
- PHP_AP_EXTRACT_VERSION
- PHP_BUILD_THREAD_SAFE
- PHP_DEF_HAVE
- PHP_OUTPUT
- PHP_TEST_BUILD
2025-06-23 23:43:52 +02:00
Niels Dossche
d8c48903c4
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-14082: Segmentation fault on unknown address 0x600000000018 in ext/opcache/jit/zend_jit.c
2025-06-23 22:29:00 +02:00
Niels Dossche
3664f4a859
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-14082: Segmentation fault on unknown address 0x600000000018 in ext/opcache/jit/zend_jit.c
2025-06-23 22:28:00 +02:00
Daniil Gentili
591b3249da
Do not use RTLD_DEEPBIND if dlmopen is available (#18612)
DL_LOAD now doesn't use RTLD_DEEPBIND deepbind anymore on platforms
where dlmopen with LM_ID_NEWLM is available:
this means shared library symbol isolation (if needed) must be enabled on
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.

Closes GH-10670.
2025-06-23 21:44:58 +02:00
Niels Dossche
6eed02bacc
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-18899: JIT function crash when emitting undefined variable warning and opline is not set yet
2025-06-23 20:10:27 +02:00
Niels Dossche
56c4ddfaf6
Fix GH-18899: JIT function crash when emitting undefined variable warning and opline is not set yet
The crash happens because EX(opline) is attempted to be accessed but
it's not set yet.

Closes GH-18904.
2025-06-23 20:10:09 +02:00
Niels Dossche
9b7252b8bd
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-18639: Internal class aliases can break preloading + JIT
2025-06-23 20:01:49 +02:00
Niels Dossche
ee2c0d7e7f
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-18639: Internal class aliases can break preloading + JIT
2025-06-23 20:01:40 +02:00
Niels Dossche
8493495361
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix misleading errors in printf()
  Unbreak PRINTF_DEBUG macro usages
2025-06-23 19:59:22 +02:00
Niels Dossche
eb78a0b53f
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix misleading errors in printf()
  Unbreak PRINTF_DEBUG macro usages
2025-06-23 19:59:16 +02:00
Ilija Tovilo
ddfa743aba
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix leak when creating cycle in hook
2025-06-23 17:48:36 +02:00
Ilija Tovilo
fe504d3357
Fix leak when creating cycle in hook
This is necessary because the VM frees operands with the nogc variants. We
cannot just call gc_possible_root() because the object may no longer exist at
that point.

Fixes GH-18907
Closes GH-18917
2025-06-23 17:48:07 +02:00
Gina Peter Banyard
c7f0ac1bf9
ext/random: Remove useless tests (#18920) 2025-06-23 13:59:05 +01:00
Gina Peter Banyard
7f80d4dc7d ext/session: Remove bool type coercions in tests 2025-06-23 14:57:13 +02:00
Gina Peter Banyard
4baecc1d4a ext/simplexml: Remove bool type coercions in tests 2025-06-23 14:57:05 +02:00
Gina Peter Banyard
40be5fa99f ext/sockets: Remove bool type coercions in tests 2025-06-23 14:56:53 +02:00
Gina Peter Banyard
4ff8d9f6b4
ext/uri: Remove bool type coercions in tests (#18921) 2025-06-23 13:49:20 +01:00
Gina Peter Banyard
c26105d22e ext/posix: Remove ZPP tests 2025-06-23 14:30:08 +02:00
Gina Peter Banyard
8cd4f95ea3 ext/pcntl: Remove bool type coercions in tests 2025-06-23 14:29:59 +02:00
Gina Peter Banyard
b068bef45d ext/dom: Remove bool type coercions in tests 2025-06-23 14:29:52 +02:00
Gina Peter Banyard
c7778641dd ext/mbstring: Remove ZPP tests 2025-06-23 13:58:31 +02:00
Gina Peter Banyard
c03f6065fa ext/calendar: Remove ZPP test 2025-06-23 13:58:19 +02:00
Gina Peter Banyard
67bbf9c961 ext/filter: Remove ZPP test 2025-06-23 13:58:10 +02:00
David Carlier
0f55c20afd
Merge branch 'PHP-8.4' 2025-06-23 11:47:10 +01:00
David Carlier
e3fe9a93c7
Merge branch 'PHP-8.3' into PHP-8.4 2025-06-23 11:46:45 +01:00
Tim Düsterhus
81865ec5bd
uri: Improve exceptions for Uri\WhatWg\Url (#18855)
A more specific exception message is used, while the code is simplified.
2025-06-23 12:14:00 +02:00
David Carlier
375316d0e2
ext/sqlite3: Sqlite3Result::fetchAll()
support associative and indexes arrays for results.

close GH-1884
2025-06-23 08:01:31 +01:00
David Carlier
22bd2ae63f
ext/sqlite3: explain statement support addition.
similar to what have been done for pdo/sqlite as having statement
explain support to simulate how a query would operate or
for more advanced users, analysing the VM routines used
for possible optimisations.

close GH-18853
2025-06-23 07:57:45 +01:00
Saki Takamachi
e9310171f7
[skip ci] Add myself to EXTENSIONS (#18918) 2025-06-23 15:29:20 +09:00
DanielEScherzer
ddd33fd7e4
Generated arginfo headers: combine preprocessor conditional blocks (2) (#18667)
When global constants' or class constants' availability is based on some
preprocessor condition, the generated arginfo header files wrap the
declarations in the preprocessor `#if` conditional blocks, one per declaration,
even if they are in the same conditional block based on comments in the stub
file. Instead of having multiple conditional blocks one after the other with
the same condition, combine them into a single conditional block.
2025-06-22 14:35:28 -07:00
DanielEScherzer
4dfba7a250
[RFC] Final Property Promotion
https://wiki.php.net/rfc/final_promotion
2025-06-22 12:29:26 -07:00
David CARLIER
01c3001eb7
ext/tidy: zend_parse_parameters_none -> ZEND_PARSE_PARAMETERS_NONE macro (#18913) 2025-06-22 19:47:36 +01:00
Peter Kokot
4f1b005522
Autotools: Enable tsrmls cache in hash extension on big endian (#15303)
When system is detected as big endian this enables the TSRM Local
Storage static cache with the ZEND_ENABLE_STATIC_TSRMLS_CACHE
compilation flag. Previously it was enabled only on little endian
systems.
2025-06-22 16:03:55 +02:00
Peter Kokot
3df665a888
[Windows build] Remove redundant flags definitions (#18890)
The /d2FuncCache1 compile option is already added by
toolset_setup_common_cflags() in confutils.js to all targets.

ZEND_DVAL_TO_LVAL_CAST_OK was removed in
3725717de1.
2025-06-22 15:19:08 +02:00
Niels Dossche
b727821c79
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-18901: integer overflow mb_split
2025-06-22 13:09:09 +02:00
Niels Dossche
2577e3a703
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-18901: integer overflow mb_split
2025-06-22 13:08:05 +02:00
David Carlier
a2461021b6
Merge branch 'PHP-8.4' 2025-06-22 11:46:16 +01:00
David Carlier
0afe0bb777
Merge branch 'PHP-8.3' into PHP-8.4 2025-06-22 11:43:40 +01:00
Niels Dossche
9b6df109c7
Don't use the obj_map cache for attributes (#18895) 2025-06-22 12:31:06 +02:00
Niels Dossche
479e9be45d Store hash table entry directly in dom_nnodemap_object
Splits the purpose of the baseobj_zv: now no longer either is an array
or an object. Stores the hash table pointer directly, if used.
2025-06-22 12:30:50 +02:00
Niels Dossche
8736342782 Pack dom_nnodemap_object fields together with a union that can't be active at the same time 2025-06-22 12:30:50 +02:00
Niels Dossche
26aea0ed37 Tweak sizes of some dom_nnodemap_object fields
We don't have to pack the bools, and the cached index would better be a
zend_long so we don't get implicit narrowing.
2025-06-22 12:30:50 +02:00
Niels Dossche
8526de84a5 Move common obj_map API functions to obj_map.c 2025-06-22 12:30:50 +02:00
Gina Peter Banyard
37549e4563 ext/gmp: Remove bool type coercions in tests 2025-06-21 22:19:37 +02:00
Gina Peter Banyard
fa81a23138 ext/exif: Remove bool type coercions in tests 2025-06-21 22:19:28 +02:00
Gina Peter Banyard
5f3e10de8b ext/bz2: Remove bool type coercions in tests 2025-06-21 22:19:19 +02:00
Gina Peter Banyard
8316ff2b0a ext/dba: Remove bool type coercions in tests 2025-06-21 22:19:11 +02:00
Gina Peter Banyard
091308cb3e ext/soap: Remove bool type coercions in tests 2025-06-21 22:19:03 +02:00
Gina Peter Banyard
0ab5f70b3c ext/spl: Remove bool type coercions in tests 2025-06-21 22:18:52 +02:00
Niels Dossche
ff0a2cff05 Refactor implementation of DOM nodelists, named maps, and iterators
The code was really messy with lots of checks and inconsistencies.
This splits everything up into different functions and now everything is
relayed to a handler vtable.
2025-06-21 22:17:33 +02:00
Niels Dossche
4fadf647d2 Refactor dom_nnodemap_objects_new()
- Use ecalloc() to not miss initializing any field.
- Merge declarations and assignments.
2025-06-21 22:17:33 +02:00
Jakub Zelenka
89934b405e
Merge branch 'PHP-8.4' 2025-06-21 20:17:15 +02:00
Jakub Zelenka
bbac59148c
Merge branch 'PHP-8.3' into PHP-8.4 2025-06-21 20:16:13 +02:00
Gina Peter Banyard
5bd18e3fdc
ext/zlib: Refactor tests (#18887)
- Use INI sections
- Use CGI sections
- Move data into a subfolder
- Remove ZPP tests
- Fix various bugs within tests
- Simplify some


Found while working on #18879
2025-06-21 18:03:50 +01:00
Niels Dossche
89be689f77
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix memory leaks when returning refcounted value from curl callback
2025-06-21 00:37:57 +02:00
Niels Dossche
ca487ae131
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix memory leaks when returning refcounted value from curl callback
2025-06-21 00:37:51 +02:00
Niels Dossche
9859d837ca
Implement request #61105: Support Soap 1.2 SoapFault Reason Text lang attribute
This is on the border line of a bugfix and a new feature.
Anyway, this is necessary to fix compatibility with .NET clients.

Closes GH-18701.
2025-06-21 00:18:08 +02:00
Ilija Tovilo
ed2bebd783
Merge branch 'PHP-8.4'
* PHP-8.4:
  Remove bug61371 test
2025-06-20 22:44:17 +02:00
Ilija Tovilo
a68f1e7adb
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Remove bug61371 test
2025-06-20 22:44:10 +02:00
Gina Peter Banyard
27e485d22e Merge branch 'PHP-8.4' 2025-06-20 19:09:02 +02:00
Gina Peter Banyard
940441106d ext/dom: Fix new MSVC compiler warning
Closes GH-18889
2025-06-20 19:08:33 +02:00
Saki Takamachi
edfd55c197
ext/bcmath: use vector in compare (#18859) 2025-06-21 01:34:42 +09:00
Ilija Tovilo
feb1d63771
Merge branch 'PHP-8.4'
* PHP-8.4:
  Track heap->real_size for USE_TRACKED_ALLOC
2025-06-20 14:51:29 +02:00
Ilija Tovilo
0ee73ccbe5
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Track heap->real_size for USE_TRACKED_ALLOC
2025-06-20 14:51:20 +02:00
Peter Kokot
be70f42de7
Add HAVE_MEMMOVE to ext/pcre (#18862)
The pcre2 library still needs HAVE_MEMMOVE defined to use the system
(C99 standard) memmove() function, otherwise emulation is used. On
Windows, this is already enabled.
2025-06-19 21:49:36 +02:00
Niels Dossche
2f55291ceb
Sync to lexbor/lexbor@0eac579f (#18882) 2025-06-19 21:18:18 +02:00
Peter Kokot
49dd61906a
Autotools: Move PHP_ODBC_* defines to configuration header (#15708)
The PHP_ODBC_* defines are remains of the PHP 2 and 3 era where the ODBC
functionality was part of the PHP core and was later moved to an
extension. This moves these defines to a regular PHP configuration
header (php_config.h) as done in other extensions.
2025-06-19 17:19:23 +02:00
Peter Kokot
3ff6874658
Remove HAVE_GETLOGIN from win32/config.w32.h.in template (#18865)
PHP once had getlogin() emulation implemented on Windows. This isn't the
case anymore since 2006 (dc34d34230),
neither Windows has getlogin() function.
2025-06-19 14:07:40 +02:00
David CARLIER
f129586459
ext/pdo_sqlite: fix minimal version for EXPLAIN feature support. (#18854) 2025-06-18 21:06:03 +01:00
Niels Dossche
bc7d00ea6d
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix use after free during shutdown destruction
2025-06-18 21:20:30 +02:00
Niels Dossche
bb6263af60
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix use after free during shutdown destruction
2025-06-18 21:20:25 +02:00
Niels Dossche
412d691f54
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix iconv tests skipped on windows
2025-06-18 20:47:40 +02:00
Niels Dossche
55b9d0a24a
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix iconv tests skipped on windows
2025-06-18 20:47:30 +02:00
Bogdan Ungureanu
5f67bace1b
ext/intl: Fix compile issues with ICU versions lower than 67 (#18868) 2025-06-18 09:21:31 +01:00
Eric Mann
ee1bbcf0bb
Merge branch 'PHP-8.4'
* PHP-8.4:
  PHP 8.3 is now for PHP 8.3.24-dev
  PHP-8.4 is now for PHP 8.4.10-dev
2025-06-17 08:13:20 -07:00
Eric Mann
4d303e76be
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  PHP 8.3 is now for PHP 8.3.24-dev
2025-06-17 08:08:11 -07:00
Saki Takamachi
a6749046f6
PHP-8.4 is now for PHP 8.4.10-dev 2025-06-17 21:05:02 +09:00
Ilija Tovilo
2e2494fbef
[skip ci] Fix whitespace in ext/pdo_sqlite/sqlite_statement.c 2025-06-14 16:00:13 +02:00
Ilija Tovilo
0a9697f5e1
Fix unused variable in pdo_sqlite_stmt_set_attribute() (GH-18851)
The indentation is also wrong (using spaces instead of tabs), but this should be
fixed in a separate commit.
2025-06-14 15:51:18 +02:00
Ilija Tovilo
7e59769b1f
Move pipe test with opcache dump to ext/opcache
This test breaks under file cache (because the opcodes are not dumped when ran
with a primed cache). run-tests.php --file-cache-* automatically skips all
ext/opcache tests, so move it there.
2025-06-14 15:00:49 +02:00
David CARLIER
7361a1206d
ext/pdo_sqlite: explain statement prefixing with its class for errors. (#18846) 2025-06-13 19:19:13 +01:00
Niels Dossche
43c18f3cfe
Fix GH-18823: setlocale's 2nd and 3rd argument ignores strict_types
Closes GH-18828.
2025-06-13 18:24:01 +02:00
David Carlier
058c0348fd
ext/sqlite3: adding busy() call.
checks if the prepared statement had been fetched but did not complete yet.

close GH-18843
2025-06-13 06:08:44 +01:00
David Carlier
71a254489c
ext/pdo_sqlite: EXPLAIN mode support for SQL statements.
available since 3.41.0 we can reprepare a statement in either
 explain, explain query plan or the usual prepared mode.

close GH-18829
2025-06-13 05:45:45 +01:00
Niels Dossche
5740038026
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-14551: PGO build fails with xxhash
2025-06-12 19:27:02 +02:00
Niels Dossche
f8e2adfe91
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-14551: PGO build fails with xxhash
2025-06-12 19:26:56 +02:00
Niels Dossche
42b9b2f5b3
[ci skip] Fix pipe optimization test wrt temps for observers 2025-06-12 18:48:43 +02:00
Niels Dossche
28a083bddc
Use zend_string_release_ex() in concat_function() (#18827)
The strings we encounter are either interned in which case the
persistent bool doesn't matter; or they're temporary as the code already
assumes that anyway.
This patch shrinks the function from 3332 bytes to 3173 bytes on x86-64
with GCC 15.1.1.
2025-06-12 17:49:38 +02:00
Niels Dossche
029a78813d
Simplify callers of zval_try_get_long() (#18830)
Since 2b383848 references are handled properly by the Zend API, so we
can simplify the callers by removing reference handling from there.
2025-06-12 17:49:22 +02:00
Gina Peter Banyard
def3a95b14 [skip ci] ext/standard/pack: Fix indentation to use tabs 2025-06-12 10:47:54 +01:00
Gina Peter Banyard
a297a44d2f ext/standard/pack: Remove unused header includes 2025-06-12 10:47:54 +01:00
Gina Peter Banyard
34e22c54bc ext/standard/pack: Reduce scope of variable 2025-06-12 10:47:54 +01:00
Gina Peter Banyard
e96a7f0dfb ext/standard/pack: Remove useless casts
And use char instead of widening to int for no reason
2025-06-12 10:47:54 +01:00
Gina Peter Banyard
2a77e282f8 ext/standard/pack: Inline constant single use variables
They serve no purpose and are just confusing
2025-06-12 10:47:54 +01:00
Niels Dossche
dbabbe180b
Remove dead code from openssl_spki_new() implementation (#18752)
If s is not NULL, the length can't be <= 0 because we at least append
`spkac` in the string, which is non-empty.
I noticed this condition because if it were actually possible to
execute, then it would leak memory.
2025-06-10 22:35:56 +02:00
Niels Dossche
559858c822
Improve performance of unpack() with nameless repetitions (#18803)
We can avoid creating temporary strings, and then reparsing them into
numbers with zend_symtable_update() by using zend_hash_index_update()
directly.

For the following benchmark on an i7-4790:
```php
$file = str_repeat('A', 100000);
for ($i=0;$i<100;$i++) unpack('C*',$file);
```

I get:
```
Benchmark 1: ./sapi/cli/php y.php
  Time (mean ± σ):      85.8 ms ±   1.8 ms    [User: 74.5 ms, System: 10.4 ms]
  Range (min … max):    83.8 ms …  92.4 ms    33 runs

Benchmark 2: ./sapi/cli/php_old y.php
  Time (mean ± σ):     318.3 ms ±   2.7 ms    [User: 306.7 ms, System: 9.9 ms]
  Range (min … max):   314.9 ms … 321.6 ms    10 runs

Summary
  ./sapi/cli/php y.php ran
    3.71 ± 0.08 times faster than ./sapi/cli/php_old y.php
```

On an i7-1185G7 I get:
```
Benchmark 1: ./sapi/cli/php test.php
  Time (mean ± σ):      60.1 ms ±   0.7 ms    [User: 47.8 ms, System: 12.0 ms]
  Range (min … max):    59.2 ms …  63.8 ms    48 runs

  Warning: Statistical outliers were detected. Consider re-running this benchmark on a quiet system without any interferences from other programs. It might help to use the '--warmup' or '--prepare' options.

Benchmark 2: ./sapi/cli/php_old test.php
  Time (mean ± σ):     220.8 ms ±   2.2 ms    [User: 209.6 ms, System: 10.7 ms]
  Range (min … max):   218.5 ms … 224.5 ms    13 runs

Summary
  ./sapi/cli/php test.php  ran
    3.67 ± 0.06 times faster than ./sapi/cli/php_old test.php
```
2025-06-10 22:33:33 +02:00
Niels Dossche
0a95b2f30c
Fix GH-18820: Windows compilation issue: php-src\Zend\zend_exceptions.h(75): error C2122: 'message': prototype parameter in name list illegal
INTERNAL_FUNCTION_PARAMETERS is defined in zend.h, but not included in
zend_exceptions.h (and it shouldn't). Expand the macro to fix the
compile issue.
2025-06-10 21:54:29 +02:00
Niels Dossche
7f3a2bc727
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix 'phpdbg --help' segfault on shutdown with USE_ZEND_ALLOC=0
2025-06-10 19:23:03 +02:00
Niels Dossche
6685414a77
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix 'phpdbg --help' segfault on shutdown with USE_ZEND_ALLOC=0
2025-06-10 19:22:56 +02:00
Tim Düsterhus
5740607806
Merge branch 'PHP-8.4'
* PHP-8.4:
  cli: Fix tests/bug80092.phpt expectation for `PHP_BUILD_PROVIDER` (#18824)
2025-06-10 19:16:28 +02:00
Niels Dossche
eb151e39b0
Properly handle reference return value from __toString()
It's possible to return a reference from __toString(), but this is not
handled and results in a (confusing) error telling that the return value
must be a string.
Properly handle this by unwrapping the reference.

Closes GH-18810.
2025-06-10 19:15:53 +02:00
Tim Düsterhus
594221fff2
cli: Fix tests/bug80092.phpt expectation for PHP_BUILD_PROVIDER (#18824)
see afc5738154
see 40d88cacc1
2025-06-10 19:15:35 +02:00
Niels Dossche
8f3e5553f3
Use zval_try_get_string_func() in concat_function() (#18815)
This allows a cheaper exception check and also does not need a release
call.
This shrinks concat_function() on x86-64 with GCC 15.1.1 from 3443 bytes
to 3332 bytes.
2025-06-10 17:33:42 +02:00
Tim Düsterhus
5f9a0b568b
gen_stub: Fix undefined variable warning (#18821)
> PHP Warning:  Undefined variable $code in build/gen_stub.php on line 5322

Introduced in php/php-src#18735.
2025-06-10 15:28:34 +02:00
Máté Kocsis
3399235bec
Add Uri\WhatWg classes to ext/uri (#18672)
Relates to #14461 and https://wiki.php.net/rfc/url_parsing_api

Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
Co-authored-by: Tim Düsterhus <tim@tideways-gmbh.com>
2025-06-10 10:18:22 +02:00
Máté Kocsis
7d24cce78a
Update Lexbor
Cherry-pick b2dbadcf16

Adding support for IDNA URL serialization.
2025-06-10 10:07:11 +02:00
Larry Garfield
1c09c0c832
RFC: Pipe operator (#17118)
Co-authored-by: Gina Peter Banyard <girgias@php.net>
Co-authored-by: Arnaud Le Blanc <arnaud.lb@gmail.com>
Co-authored-by: Tim Düsterhus <tim@tideways-gmbh.com>
2025-06-10 09:59:43 +02:00
Tim Düsterhus
2036c7158d
[skip ci] Add T_VOID_CAST constant to UPGRADING
see 8779e2a603
2025-06-10 09:12:32 +02:00
Tim Düsterhus
3e37bcedf4
[skip ci] Trim trailing whitespace in zend_compile.c
Introduced in 5544be7018. Trimming to simplify
the diff of the pipe operator RFC implementation.
2025-06-10 09:05:37 +02:00
Niels Dossche
32c6ac9133
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix technically incorrect sizeof
2025-06-09 22:05:26 +02:00
Niels Dossche
4f233e3ba2
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix technically incorrect sizeof
2025-06-09 22:05:21 +02:00
DanielEScherzer
e1181475e1
release-process: update pre-release cycle docs (#18805)
https://wiki.php.net/rfc/release_cycle_update
2025-06-09 12:22:07 -07:00
Niels Dossche
931ee4bf62
[ci skip] Re-add accidentally removed NEWS entry 2025-06-09 20:04:24 +02:00
David Carlier
53231a81dd
ext/pdo_sqlite: adding Pdo_Sqlite::ATTR_BUSY_STATEMENT
allow to check if a statement is still running before reusage.

close GH-18804
2025-06-09 18:24:35 +01:00
Niels Dossche
8a3201d91e
Merge branch 'PHP-8.4'
* PHP-8.4:
  zend_alloc: Fix compile with ZEND_MM_STAT=0
2025-06-09 17:28:11 +02:00
Niels Dossche
fc89d1968c
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  zend_alloc: Fix compile with ZEND_MM_STAT=0
2025-06-09 17:28:06 +02:00
Niels Dossche
5b85b1a539
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix test conflict between copy_variation2-win32-mb.phpt and copy_variation2-win32.phpt
2025-06-09 14:16:41 +02:00
Niels Dossche
d6258d60d6
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix test conflict between copy_variation2-win32-mb.phpt and copy_variation2-win32.phpt
2025-06-09 14:16:32 +02:00
Niels Dossche
7b6c0b99bb
zend_alloc: Fix compilation with ZEND_MM_CUSTOM=0 (#18808)
The poison feature relies on ZEND_MM_CUSTOM=1.
If ZEND_MM_CUSTOM=0, the build fails.
To fix this, move some `#endif`.
2025-06-09 12:44:41 +02:00
Niels Dossche
b41a8aaffd
[ci skip] Fix NEWS location 2025-06-09 11:55:39 +02:00
Niels Dossche
4f0554fa54
Properly handle __debugInfo() returning an array reference
Currently, this fails because the type is IS_REFERENCE instead of
IS_ARRAY, but this could be confusing because a function return value is
normally dereferenced automatically in a lot of cases.

Closes GH-18762.
2025-06-09 11:44:21 +02:00
Niels Dossche
4c7220322b
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-18743: Incompatibility in Inline TLS Assembly on Alpine 3.22
2025-06-09 11:41:08 +02:00
Niels Dossche
7a0beb4867
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-18743: Incompatibility in Inline TLS Assembly on Alpine 3.22
2025-06-09 11:41:02 +02:00
Niels Dossche
502c68264d
Merge branch 'PHP-8.4'
* PHP-8.4:
  pdo_odbc: Fix memory leak if WideCharToMultiByte() fails
  Fix memory leak on php_odbc_fetch_hash() failure
  Do not delete main chunk in zend_gc
2025-06-09 11:26:27 +02:00
Niels Dossche
5526301908
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  pdo_odbc: Fix memory leak if WideCharToMultiByte() fails
  Fix memory leak on php_odbc_fetch_hash() failure
  Do not delete main chunk in zend_gc
2025-06-09 11:25:41 +02:00
Niels Dossche
4852a2c5cc
pdo_dblib: Use stack local array instead of heap allocation (#18801) 2025-06-09 11:13:46 +02:00
Niels Dossche
c02f6fb3fe Output blocks of safe chars in php_filter_encode_html()
Fixes a long-standing TODO, and is faster.
2025-06-09 11:12:17 +02:00
Niels Dossche
31b4f39d3e Use ZVAL_NEW_STR() for new string in php_filter_encode_html() 2025-06-09 11:12:17 +02:00
Tim Düsterhus
1a18012be3
zend_vm_gen: Fix GET_OP*_OBJ_ZVAL_PTR_DEREF for ANY (#18746)
Fixes php/php-src#18745
2025-06-09 09:34:49 +02:00
David Carlier
e3cfa4bcae
ext/pdo_sqlite: PDO::sqliteCreateCollection return type strenghtening.
Is supposed to be Pdo_Sqlite::createCollation but behavior differs in
regard of return type checks.

close GH-18799
2025-06-08 13:29:26 +01:00
Niels Dossche
eac91d0453
[ci skip] Fix UPGRADING formatting 2025-06-08 13:25:56 +02:00
Niels Dossche
cb04226b4a
Avoid making a redundant copy in php_filter_callback() (#18794)
`call_user_function` already makes a copy to the call frame for its
arguments, there's no need to do this ourselves.
2025-06-08 11:23:31 +02:00
David CARLIER
ceffa70b97
ext/pdo_sqlite: Fix GH-18796 test exception message. (#18798) 2025-06-07 15:53:46 +01:00
David Carlier
b72dccb3e3
Merge branch 'PHP-8.4' 2025-06-07 14:29:13 +01:00
David Carlier
1044558b64
ext/pdo_sqlite: createCollation memory leaks fix.
coming from callback arguments when its return type is incorrect.

close GH-18796
2025-06-07 14:28:29 +01:00
NickSdot
d15c61e84c
ext/gettext: fixed typo in config.m4 (#18790) 2025-06-07 07:31:51 +01:00
David Carlier
cce0efdff8
Revert "ext/pdo_pgsql: Delete unused constants"
This reverts commit e549ccb32e.
2025-06-06 14:45:59 +01:00
NickSdot
01abca9852
[skip ci ] fix: deleted stray semicolon (GH-18782) 2025-06-06 14:25:19 +02:00
Jakub Zelenka
a8b7c65bca
Merge branch 'PHP-8.4' 2025-06-06 13:55:00 +02:00
Jakub Zelenka
c772963c9c
Merge branch 'PHP-8.3' into PHP-8.4 2025-06-06 13:54:25 +02:00
David Carlier
cc1f1c60ee
[skip ci] giving proper credits to last changes in ext/pdo_pgsql 2025-06-06 08:17:30 +01:00
Jakub Vrána
e549ccb32e
ext/pdo_pgsql: Delete unused constants
These constants were added by 6ed1819bf4 but they are not used anymore.

They are undocumented which is why I've stumbled upon this.

close GH-18358
2025-06-06 07:34:25 +01:00
Saki Takamachi
2751064692
use XSSE for bcmath (#18770) 2025-06-06 08:25:52 +09:00
DanielEScherzer
8f3cdf6236
gen_stub: Add support for attributes on constants in stubs (#18735)
Update to PHP-Parser 5.5.0 and add support for attributes on constants in
stubs. For now, I have only migrated over E_STRICT, once the support is in
place I'll do a larger migration of the existing deprecated constants.

In the process, fix the logic in `copy_zend_constant()` for copying attributes
when a constant is copied; just increase the reference count for the attributes
table rather than trying to duplicate the contents.
2025-06-05 14:46:46 -07:00
Niels Dossche
99d56248f8
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix compile without ZEND_MM_STORAGE
2025-06-05 21:51:44 +02:00
Niels Dossche
976143e365
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix compile without ZEND_MM_STORAGE
2025-06-05 21:51:38 +02:00
Gina Peter Banyard
19b1173577 ext/tidy: Add some const qualifiers 2025-06-05 19:46:04 +01:00
Gina Peter Banyard
d97a90acb8 ext/tidy: Use zend_result type instead of int type 2025-06-05 19:46:04 +01:00
Gina Peter Banyard
feff5381b4 ext/tidy: Reduce scope of variable and rename to prevent variable shadowing 2025-06-05 19:46:04 +01:00
Gina Peter Banyard
25057811a5 ext/tidy: Use RETURN_BOOL() where possible 2025-06-05 19:46:04 +01:00
Gina Peter Banyard
bf3d7d1f9a ext/tidy: Use RETURN_STR() instead of RETVAL_STR() + return; 2025-06-05 19:46:04 +01:00
Gina Peter Banyard
4fd91c6fa4 ext/tidy: Use RETURN_THROWS() macro 2025-06-05 19:46:04 +01:00
Gina Peter Banyard
b7db5c8129 ext/tidy: Remove TIDY_SET_CONTEXT macro 2025-06-05 19:46:04 +01:00
Gina Peter Banyard
d40e3200a7 ext/tidy: Use uint32_t and bool types instead of unsigned int type
On certain platform an unsigned int is 64bits, which is not needed.
2025-06-05 19:46:04 +01:00
Jakub Zelenka
688fed36ca
Merge branch 'PHP-8.4' 2025-06-05 18:05:51 +02:00
Jakub Zelenka
7a15d2a5c0
Merge branch 'PHP-8.3' into PHP-8.4 2025-06-05 18:05:24 +02:00
Niels Dossche
d15e119d07
Use cheaper functions to get member name in PDO (#18769) 2025-06-05 17:46:56 +02:00
David Carlier
91becb3042
ext/tidy: config options checks strengthening.
close GH-18751
2025-06-05 13:16:25 +01:00
Jakub Zelenka
9ae5b4e9be
Merge branch 'PHP-8.4' 2025-06-05 14:12:48 +02:00
Jakub Zelenka
086a470208
Merge branch 'PHP-8.3' into PHP-8.4 2025-06-05 14:10:57 +02:00
Niels Dossche
7f91462019
Remove nonsensical code from odbc_execute() (#18767)
strlen() operates on NUL-terminated strings, writing a NUL byte at the
strlen offset accomplishes nothing but wasting cycles.
2025-06-04 23:18:48 +02:00
David Carlier
1aae2ad91b
Merge branch 'PHP-8.4' 2025-06-04 20:35:50 +01:00
David Carlier
ecc9393b36
Merge branch 'PHP-8.3' into PHP-8.4 2025-06-04 20:35:17 +01:00
Niels Dossche
be17e9ed54
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix handling of references in zval_try_get_long()
2025-06-04 21:00:22 +02:00
Niels Dossche
2b383848a7
Fix handling of references in zval_try_get_long()
This API can't handle references, yet everyone keeps forgetting that it
can't and that you should DEREF upfront. Fix every type of this issue
once and for all by moving the reference handling to this Zend API.

Closes GH-18761.
2025-06-04 21:00:05 +02:00
Niels Dossche
307ff3bdea
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-18744: PHP 8.4 classList works not correctly if copy HTMLElement by clone keyword.
2025-06-04 18:59:21 +02:00
Niels Dossche
111072a9f0
Fix GH-18744: PHP 8.4 classList works not correctly if copy HTMLElement by clone keyword.
The $classList property is special in the sense that it's a cached
object instance per (HTML)Element instance. The reason for this design
is because it has the [[SameObject]] IDL attribute.
Cloning in PHP also clones the properties, so it also clones the cached
instance. To solve this, we undo this by resetting the backing storage.

Closes GH-18749.
2025-06-04 18:59:05 +02:00
Jakub Zelenka
2f5ef4d2b7
Use custom OpenSSL libctx in md and cipher handling code (#18516) 2025-06-04 18:46:00 +02:00
Niels Dossche
f46f42b2b2
Implement request #55503: Extend __getTypes to support enumerations (#18704)
Co-authored-by: datibbaw <datibbaw@php.net>
2025-06-04 17:46:57 +02:00
Ayesh Karunaratne
690cde6903
UPGRADING: minor typo fixes
Closes GH-18726
2025-06-04 18:08:39 +05:30
Remi Collet
6820a4de23
Fix GH-18579: --libdir option default value
Using PHP_LIBDIR for lib64 case
2025-06-04 11:56:12 +02:00
Marc Bennewitz
3a14ce19a5
Fix stubs of DateTimeZone->getTransitions (#17992)
The default value of `timestamp_end` is INT32_MAX and not ZEND_LONG_MAX
2025-06-03 22:42:05 -07:00
NickSdot
6eae466e32
Zend/tests/property_hooks: fix typo in file name (#18754)
[skip ci]
2025-06-03 21:36:03 -07:00
Niels Dossche
359bb6303d
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix memory leak of X509_STORE in php_openssl_setup_verify() on failure
2025-06-03 23:50:30 +02:00
Niels Dossche
87ff5479fc
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix memory leak of X509_STORE in php_openssl_setup_verify() on failure
2025-06-03 23:46:21 +02:00
Tim Düsterhus
4c5a6b0e8d
tree-wide: Remove stacktraces from tests testing throwing clones (#18748)
This is in preparation for the possible future transformation of `clone` into a
function call, but also meaningful on its own, since the purpose of the tests
is not to test the stack trace generation, but rather that an exception was
thrown. It also cleans up some unreachable code in the tests.
2025-06-03 20:08:47 +02:00
Taavi Eomäe
0a8961a0e2
Log a warning when opcache lock file permissions could not be changed
Closes GH-18742.
2025-06-03 19:22:58 +02:00
Niels Dossche
36891a6775
Move VM exception checks (#18730)
Checking the non-exception path without arguments first, this avoids a redundant check in the case without arguments. The exception path may become more expensive, but we don't optimize for exception flow, rather we optimize for the happy flow. The other paths are unaffected.
2025-06-02 23:35:42 +02:00
Niels Dossche
88f546b166
Fix missing empty string checks in ext/enchant
The library requires the tags to be non-empty, and also requires the
ordering to be non-empty. For the tags, otherwise, assertion failures
can be observed.

Closes GH-18733.
2025-06-02 19:49:48 +02:00
Андрей Ковалёв
b871261c10
ext/mysqlnd/mysqlnd_auth.c: Add error handling for invalid public key size (#18663)
Reported-by: Pavel Nekrasov <p.nekrasov@fobos-nt.ru>

Signed-off-by: Andrey Kovalev <ded@altlinux.org>
Co-authored-by: Andrey Kovalev <ded@altlinux.org>
2025-06-02 11:55:25 +02:00
Arnaud Le Blanc
f64e3d5d9e
Fix build (#18716) 2025-06-02 08:49:25 +02:00
Dmitry Stogov
baeb981746
Merge branch 'PHP-8.4'
* PHP-8.4:
  Update IR
2025-06-02 09:24:10 +03:00
Dmitry Stogov
81593cfc6a
Update IR
IR commit: e4343be0082897510c40a1b57baff427c6858878
2025-06-02 09:23:39 +03:00
Nikita Popov
910411f2f5 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix line assignment in zend_ast_create_va()
2025-06-01 20:36:01 +02:00
Nikita Popov
d66e87b02e Fix line assignment in zend_ast_create_va()
The intent here was to assign the first found line. Instead this
always fell back to CG(zend_lineno).

Not sure if this line matters for anything in php-src, but the
issue was observed in https://github.com/nikic/php-ast/issues/247.
2025-06-01 20:35:35 +02:00
Niels Dossche
58f55683c9
Fix GH-18729: 2 enchant test fails in masterfor alpine 2025-06-01 18:23:07 +02:00
Niels Dossche
f58adc4569
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix ext/enchant test SKIPIFs
2025-06-01 18:21:39 +02:00
Niels Dossche
2ebd1258b8
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix ext/enchant test SKIPIFs
2025-06-01 18:21:34 +02:00
Niels Dossche
25e9de9bfd
[ci skip] Update CODEOWNERS 2025-06-01 15:51:48 +02:00
Tim Düsterhus
88ef98961c
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix test failures in engine_unsafe_empty_string.phpt (#18727)
2025-06-01 15:46:14 +02:00
Tim Düsterhus
3141ad0e40
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix test failures in engine_unsafe_empty_string.phpt (#18727)
2025-06-01 15:45:57 +02:00
Niels Dossche
233e33fe68
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix memory leak in lookup_loc_range()
2025-06-01 11:39:03 +02:00
Niels Dossche
cb0b2a27e3
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix memory leak in lookup_loc_range()
2025-06-01 11:38:51 +02:00
Máté Kocsis
2a156572e8
Merge branch 'PHP-8.4'
* PHP-8.4:
  Backport relevant changes of https://github.com/php/php-src/pull/18719
2025-05-31 22:33:46 +02:00
Máté Kocsis
08b616e2f5
Backport relevant changes of https://github.com/php/php-src/pull/18719
These property writes may now throw exceptions because of property hooks, and this was not handled previously.
2025-05-31 22:31:48 +02:00
Máté Kocsis
c045ba3209
Fix exception constructor behavior after optimizations (#18719)
- Property hooks may now throw exceptions, that seem to be forgotten to be handled by https://github.com/php/php-src/pull/18442
- The $previous and $trace properties are private, and they were not accessible from the constructor of a child class
2025-05-31 22:16:55 +02:00
Niels Dossche
d2514e3969
Simplify SimpleXML code for checking if count() is overridden by a userland class (#18722) 2025-05-31 15:59:14 +02:00
Gina Peter Banyard
02ebda559d
Merge branch 'PHP-8.4'
* PHP-8.4:
  tests: Fix expectations
2025-05-31 14:46:32 +01:00
Gina Peter Banyard
f47a7e8056
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  tests: Fix expectations
2025-05-31 14:46:13 +01:00
Niels Dossche
4ebbc0bf67
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix reference type confusion and leak in user random engine
2025-05-31 15:38:33 +02:00
Niels Dossche
b83a8d5768
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix reference type confusion and leak in user random engine
2025-05-31 15:38:06 +02:00
Gina Peter Banyard
9e67d0baa3 ext/mysqli: Use zval_is_true() instead of converting to boolean 2025-05-31 14:25:43 +01:00
Gina Peter Banyard
340e139ea4 ext/mysqli: Add test for mysqli_object_has_property() object handler 2025-05-31 14:25:43 +01:00
Niels Dossche
a84cc91682
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix memory leak when curl_slist_append() fails
2025-05-31 11:14:19 +02:00
Niels Dossche
b2d107db4f
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix memory leak when curl_slist_append() fails
2025-05-31 11:14:13 +02:00
Jakub Zelenka
b64daf9b3f
Merge branch 'PHP-8.4' 2025-05-30 22:58:34 +02:00
Jakub Zelenka
39efe8ac1e
Merge branch 'PHP-8.3' into PHP-8.4 2025-05-30 22:57:34 +02:00
Niels Dossche
3cb7d1bd8a
Remove custom UTF-8 check function from ext/libxml
This was originally introduced as a workaround for a libxml2 bug [1].
This bug has been fixed for more than a decade [2], and we can use the
libxml2 API again. We bumped our version requirement for libxml2 beyond
that in 7.4 [3].

[1] 7e53511ec8
[2] 3ffe90ea1c
[3] 74235ca5f3

Closes GH-18706.
2025-05-30 10:40:23 +02:00
Niels Dossche
56abb316eb
Fix bug #70951: Segmentation fault on invalid WSDL cache
We mix in the endianness and the zend_long size to make sure cache files
can't be used on incompatible architectures.

Closes GH-18707.
2025-05-30 00:04:06 +02:00
Tim Düsterhus
90a9fb59ce
[skip ci] Remove NEWS for non-master change
see 6b95875dc5
2025-05-29 23:40:13 +02:00
Daniel Scherzer
6b95875dc5
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-18695: float numbers zero fraction is now preserved in zend_ast_export() (#18699)
2025-05-29 13:49:34 -07:00
Daniel Scherzer
e44c13cffe
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-18695: float numbers zero fraction is now preserved in zend_ast_export() (#18699)
2025-05-29 13:48:38 -07:00
Niels Dossche
615b9803bb
Get rid of redundant SOAP globals (#18702)
The copy doesn't make sense, remove it.
2025-05-29 20:14:57 +02:00
DanielEScherzer
f0fa9c748a
zend_ast.c: use smart_str_appendc for appending single characters (#18703)
Slightly more performant
2025-05-29 11:11:00 -07:00
Gina Peter Banyard
0cdd3c32de
ext/pgsql: Stop using useless convert_to_boolean() API (#18683)
There are better ways of handling this than casting the zval in place
2025-05-29 19:09:11 +01:00
Niels Dossche
c267caa542
Deduplicate XML parsing code for SOAP (#18700)
* Deduplicate XML parsing code for SOAP

* Apply suggestions from code review

Co-authored-by: Gina Peter Banyard <girgias@php.net>

---------

Co-authored-by: Gina Peter Banyard <girgias@php.net>
2025-05-29 18:35:19 +02:00
Niels Dossche
bd47c14c50
Also allow XSD_1999_NAMESPACE 2025-05-29 18:26:46 +02:00
Niels Dossche
5d2f0cb204
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix potential NULL deref
2025-05-29 16:58:25 +02:00
Niels Dossche
c44196143a
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix potential NULL deref
2025-05-29 16:57:47 +02:00
Niels Dossche
6399012cee
Fix namespace handling of WSDL and XML schema in SOAP
`attr_is_equal_ex` makes no sense: attributes never inherit the
namespace of their element. Yet this is wrongly used as a combo for
checking both the node namespace and attribute namespace.
Furthermore, not all nodes have the proper namespace check.
Fix all of this by reworking the helpers and auditing the calls to the
namespace helpers.

Closes GH-16320.
Closes bug #68576.
Closes GH-18697.
2025-05-29 16:55:41 +02:00
Gina Peter Banyard
2b22ea9630
Merge branch 'PHP-8.4'
* PHP-8.4:
  ext/pgsql: Fix warning not being emittedd when failure to cancel a query
2025-05-29 15:44:08 +01:00
Gina Peter Banyard
aae88ac799
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  ext/pgsql: Fix warning not being emittedd when failure to cancel a query
2025-05-29 15:43:52 +01:00
Gina Peter Banyard
c9e571560f
ext/soap: Refactor to_zval_bool() (#18696)
- Early return style
- Improve logic to get rid of unnecessary comparisons
- Do not use convert_to_boolean API
2025-05-29 15:29:55 +01:00
Gina Peter Banyard
407c9781f9
ext/soap: Replace single usage of CHECK_XML_NULL with FIND_XML_NULL (#18698)
This removes the implicit assumption about the variable name of the zval
Moreover, nearby the FIND_XML_NULL macro is used anyway.
2025-05-29 15:07:35 +01:00
Dmitrii Derepko
fdebad0b25
zend_ast: Add parentheses around IIFE in zend_ast_export() (#18688) 2025-05-29 15:47:47 +02:00
Niels Dossche
399cb4ca85
Fix misplaced endif in apprentice_sort() (#18686) 2025-05-29 12:04:07 +02:00
Niels Dossche
8b4edf0229 Remove unused function in soap 2025-05-29 10:02:43 +02:00
Niels Dossche
21691cb19b Remove uncommented init/cleanup code
This is irrelevant and is done by ext/libxml.
2025-05-29 10:02:43 +02:00
Niels Dossche
564df33ac1 Add FIXME 2025-05-29 10:02:43 +02:00
Niels Dossche
6723e88798 Add const qualifiers for php_xml 2025-05-29 10:02:43 +02:00
Niels Dossche
ba80d0be99 Fix indentation 2025-05-29 10:02:43 +02:00
Niels Dossche
9e01337a21 Remove unused soap macros 2025-05-29 10:02:43 +02:00
Niels Dossche
a63d0a49b0
Merge branch 'PHP-8.4'
* PHP-8.4:
  Update Lexbor patches for non-string attribute
2025-05-28 23:35:23 +02:00
Niels Dossche
9e9db0b22f
Update Lexbor patches for non-string attribute
This should fix the final sub-issue of GH-17687.

Closes GH-18691.
2025-05-28 23:34:08 +02:00
Ayesh Karunaratne
8e46d9a03a
ext/curl: format Caddyfile 2025-05-29 01:49:09 +05:30
Gina Peter Banyard
279983dc8d
ext/sockets: Use zval_is_true() instead of converting to boolean (#18681) 2025-05-28 20:06:47 +01:00
Niels Dossche
b05d50eac2 Avoid creating a zend_string twice in soap do_request 2025-05-28 21:04:06 +02:00
Niels Dossche
99bc0a56a6 Use function table directly in soap do_request
The function will exist, avoid creating a temporary string and
lowercasing it.
2025-05-28 21:04:06 +02:00
Niels Dossche
b156d37d7f
Use zend_array_is_list() in soap instead of own is_map() (#18684)
is_map() is just the inverse of zend_array_is_list().
2025-05-28 20:12:54 +02:00
Niels Dossche
3d51ba3479
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix ZEND_NONSTRING attribute for data_file.c
2025-05-28 19:50:06 +02:00
Niels Dossche
b8e734a24e
Fix ZEND_NONSTRING attribute for data_file.c
This broke in CI but not on my local machine because of the different
compiler version. This is because there was an issue in GCC [1] that
caused the attribute to not properly work on multidimensional arrays.
This has since been fixed in GCC 15.
Therefore, we guard the attribute with a version check.

[1] https://gcc.gnu.org/cgit/gcc/commit/?id=afb46540d3921e96c4cd7ba8fa2c8b0901759455
2025-05-28 19:48:59 +02:00
Dmitrii Derepko
a0f3879a1f
chore: remove todo (#18689)
[ci skip]
2025-05-28 19:48:25 +02:00
Niels Dossche
4b2a580015
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-18642: Signed integer overflow in ext/phar fseek
2025-05-28 18:54:20 +02:00
Niels Dossche
d6ed107510
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-18642: Signed integer overflow in ext/phar fseek
2025-05-28 18:54:15 +02:00
David CARLIER
c789e9c9f1
ext/sockets: socket_create_pair() simplify workflow. (#18679)
create the pair objects only on success.
2025-05-28 12:41:48 +01:00
Peter Kokot
25e8aa5cd2
Autotools: Fix ext/ldap shared build (#18673)
This fixes checks when building shared ldap library, or when ldap
installation directory is passed as argument:

    ./configure --with-ldap=shared
    ./configure --with-ldap=/path/to/ldap
    ./configure --with-ldap=shared,/path/to/ldap
2025-05-28 12:08:46 +01:00
Niels Dossche
c4fba3708c
Drop COMPILE_DL_LEXBOR (#18677)
This is always statically compiled into PHP, so remove this dead code.
2025-05-27 22:00:26 +02:00
Niels Dossche
cbe0cf6315
Merge branch 'PHP-8.4'
* PHP-8.4:
  Temporarily drop attribute for fileinfo
2025-05-27 21:08:11 +02:00
Niels Dossche
877663178c
Temporarily drop attribute for fileinfo
The error in CI doesn't reproduce on my system with GCC 15.1.1...
2025-05-27 21:07:15 +02:00
Niels Dossche
c2749e0a80
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix compile error for attribute
2025-05-27 21:01:39 +02:00
Niels Dossche
e4d2cd47c2
Fix compile error for attribute 2025-05-27 21:00:41 +02:00
Niels Dossche
12deb22f7f
Merge branch 'PHP-8.4'
* PHP-8.4:
  Backport fix for GH-17687
2025-05-27 20:42:20 +02:00
Niels Dossche
d5515577d5
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Backport fix for GH-17687
2025-05-27 20:42:12 +02:00
Niels Dossche
6d4824e02e
Add UPGRADING.INTERNALS entry for ZEND_NONSTRING
[ci skip]
2025-05-27 20:29:50 +02:00
Niels Dossche
ea69276fd5
Fix GH-17687: initializer-string for array of ... warnings
Starting with gcc 15 the warning `-Wunterminated-string-initialization`
is enabled by default. We make now use of the `nonstring` attribute to
silence the warning for the cases where this is intended.

Closes GH-18603.
2025-05-27 20:28:29 +02:00
Máté Kocsis
400b7b8c74
Add Lexbor files for URL handling (#18656)
Relates to #14461 and https://wiki.php.net/rfc/url_parsing_api
2025-05-27 13:06:02 +02:00
Máté Kocsis
d585a5609d
Add ext/uri skeleton along with uriparser (#18658)
Relates to https://github.com/php/php-src/pull/14461/ and https://wiki.php.net/rfc/url_parsing_api
2025-05-27 08:16:24 +02:00
Saki Takamachi
c0865ac013
[skip ci] UPGRADING for #18413 and #18626 2025-05-27 13:47:39 +09:00
DanielEScherzer
de785f9127
Fix bad upmerge from GH-18464 (#18666)
This led to recursion being added to but not removed from internal constants.
2025-05-26 12:40:11 -07:00
Niels Dossche
0a2f367e19
Fix date test 2025-05-26 20:43:44 +02:00
David Carlier
5a7920ba60
ext/sockets: socket_shutdown() having proper constants for mode.
close GH-18648
2025-05-26 18:48:21 +01:00
Niels Dossche
cec079ee72
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix memory leak in tidy output handler on error
  Fix leaks with multiple calls to DatePeriod iterator current()
2025-05-26 19:42:39 +02:00
Niels Dossche
06f592820d
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix memory leak in tidy output handler on error
  Fix leaks with multiple calls to DatePeriod iterator current()
2025-05-26 19:42:20 +02:00
Jessica Smith
042a975238
ext/session: Fix GH-18634 (#18653)
Show warning when saving session if a pipe character is used in one of the $_SESSION keys

Fixes #18634
2025-05-26 11:17:25 +01:00
Saki Takamachi
462fd4dffe
Small change SIMD codes (#18626)
* use zend_simd.h in zend_accelerator_util_funcs.c

* use zend_simd.h in mbstring

* Remove unnecessary SSE3 includes
2025-05-26 16:32:27 +09:00
Daniel Scherzer
04522cd1c4
Merge branch 'PHP-8.4'
* PHP-8.4:
  Reapply GH-17712 with a fix for internal class constants (#18464)
2025-05-25 16:51:18 -07:00
DanielEScherzer
cd751f98cb
Reapply GH-17712 with a fix for internal class constants (#18464)
Add recursion protection when emitting deprecation warnings for class
constants, since the deprecation message can come from an attribute that is
using the same constant for the message, or otherwise result in recursion.

But, internal constants are persisted, and thus cannot have recursion
protection. Otherwise, if a user error handler triggers bailout before the
recursion flag is removed then a subsequent request (e.g. with `--repeat 2`)
would start with that flag already applied. Internal constants can presumably
be trusted not to use deprecation messages that come from recursive attributes.

Fixes GH-18463
Fixes GH-17711
2025-05-25 16:43:36 -07:00
David CARLIER
7e956f879e
ext/soap: SoapServer::handle() reduce retval scope. (#18657)
might have been a relic of past modifications,
but pushing it down to the actual first case of error path.
2025-05-25 22:15:31 +01:00
Niels Dossche
c7db07eae8
Remove duplicated reflection test
[ci skip]

This is already tested in 016.phpt.
2025-05-25 14:24:53 +02:00
Niels Dossche
085abe932a
Pass hash table directly in tokenizer (#18650)
This avoids dereferences by Z_ARRVAL_P().
2025-05-25 14:23:50 +02:00
Máté Kocsis
7f59fccd52
Create separate lexbor extension (#18538)
An always enabled lexbor extension is added, containing the lexbor library that was separated from ext/dom extension in preparation of https://wiki.php.net/rfc/url_parsing_api. While at it, the lexbor library is upgraded to 2.5.0.

Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
Co-authored-by: Gina Peter Banyard <girgias@php.net>
2025-05-25 14:12:44 +02:00
David Carlier
4076324c6f
Merge branch 'PHP-8.4' 2025-05-25 12:53:54 +01:00
David Carlier
78f03cd5f2
Merge branch 'PHP-8.3' into PHP-8.4 2025-05-25 12:53:44 +01:00
Niels Dossche
b8fa1657ff
Avoid string copies in ext/intl after string conversion (#18636)
Introduces intl_convert_utf8_to_utf16_zstr() to convert a UTF-8 string
to a UTF-16 string zend_string* instance. This way we avoid a double
copy later from a UChar* into a zend_string*.
2025-05-25 12:29:36 +02:00
David CARLIER
16e154a2c4
ext/mbstring: mb_ereg*_replace remove unreachable code. (#18646) 2025-05-25 10:44:59 +01:00
David CARLIER
caf0a5352a
ext/tidy: simplify tidy_instantiate (#18647) 2025-05-25 10:41:16 +01:00
Máté Kocsis
ab80e092fb
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix build on Apple Clang 17+ (#18629)
2025-05-24 22:30:58 +02:00
Máté Kocsis
bc32d806dd
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix build on Apple Clang 17+ (#18629)
2025-05-24 22:30:02 +02:00
Niels Dossche
ac3eb678aa
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix memory leaks in php_http.c when call_user_function() fails
2025-05-24 21:54:50 +02:00
Niels Dossche
83755748fd
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix memory leaks in php_http.c when call_user_function() fails
2025-05-24 21:54:45 +02:00
Niels Dossche
25e60d6ab1
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix memory leak when calloc() fails in php_readline_completion_cb()
  Fix GH-18641: Accessing a BcMath\Number property by ref crashes
2025-05-24 20:39:59 +02:00
Niels Dossche
72127ffac5
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix memory leak when calloc() fails in php_readline_completion_cb()
2025-05-24 20:39:38 +02:00
Niels Dossche
64d511ef29
Fix GH-18641: Accessing a BcMath\Number property by ref crashes
The properties are virtual so we need a custom get_property_ptr_ptr
handler.

Closes GH-18637.
2025-05-24 20:38:33 +02:00
Niels Dossche
5187ff2d17
Fix GH-18566: [intl] Weird numeric sort in Collator
This aligns the behaviour with normal (non-intl) asort() by making the following changes:
  - Use the same trailing whitespace logic as Zend's is_numeric_ex()
  - Don't allow errors on trailing data

Targeting master because of the BC break.

Closes GH-18632.
2025-05-24 14:57:34 +02:00
Niels Dossche
5e21ffe09a
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix memory leak in intl_datetime_decompose()
2025-05-24 14:56:41 +02:00
Niels Dossche
7efe96d504
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix memory leak in intl_datetime_decompose()
2025-05-24 14:56:04 +02:00
Niels Dossche
2a9ea2c9f5
Drop FIXME in pcntl_signal_dispatch() (#18633) 2025-05-24 14:35:32 +02:00
David Carlier
dfff6ac852
Merge branch 'PHP-8.4' 2025-05-22 20:47:36 +01:00
David Carlier
c00d7e056a
Merge branch 'PHP-8.3' into PHP-8.4 2025-05-22 20:47:25 +01:00
David Carlier
4671f8510c
ext/sockets: UDP_SEGMENT support.
UDP segmentation offload is an optimisation attempt by sending multiple
large enough datagrams over UDP which reduces syscalls as by default,
they have to be broke down in small UDP packets, it is better if the
hardware supports it, other handed down to the software implementation.

close GH-18213
2025-05-22 20:32:29 +01:00
Gina Peter Banyard
ea2656277b
Fix INI setting requirements for test with opcache
Closes GH-18551
2025-05-22 14:18:41 +01:00
Niels Dossche
cd43536b27 Drop useless cast 2025-05-21 19:54:09 +02:00
Niels Dossche
2eaf319b45 Implement php_url_encode_to_smart_str() and use it in http_build_query()
This avoids temporary allocations and some copies.

For this benchmark:
```php
for ($i=0;$i<2000000;$i++) {
  http_build_query([999999 => 'foo', 'aaab' => 'def', 'aaaaa'=>1, 'aaaaaaaa' => 'a']);
}
```

On an i7-4790:
```
Benchmark 1: ./sapi/cli/php ../buildquery.php
  Time (mean ± σ):     298.9 ms ±   7.3 ms    [User: 295.6 ms, System: 2.3 ms]
  Range (min … max):   293.6 ms … 314.0 ms    10 runs

Benchmark 2: ./sapi/cli/php_old ../buildquery.php
  Time (mean ± σ):     594.8 ms ±   8.6 ms    [User: 590.8 ms, System: 2.4 ms]
  Range (min … max):   586.3 ms … 616.1 ms    10 runs

Summary
  ./sapi/cli/php ../buildquery.php ran
    1.99 ± 0.06 times faster than ./sapi/cli/php_old ../buildquery.php
```

For this benchmark:
```php
for ($i=0;$i<2000000;$i++) {
  http_build_query(['test' => 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa']);
}
```

On an i7-4790:
```
Benchmark 1: ./sapi/cli/php ../buildquery.php
  Time (mean ± σ):     188.4 ms ±   6.7 ms    [User: 184.6 ms, System: 2.9 ms]
  Range (min … max):   182.0 ms … 205.4 ms    14 runs

Benchmark 2: ./sapi/cli/php_old ../buildquery.php
  Time (mean ± σ):     323.9 ms ±   8.7 ms    [User: 319.8 ms, System: 2.7 ms]
  Range (min … max):   318.0 ms … 341.2 ms    10 runs

Summary
  ./sapi/cli/php ../buildquery.php ran
    1.72 ± 0.08 times faster than ./sapi/cli/php_old ../buildquery.php
```
2025-05-21 19:54:09 +02:00
Niels Dossche
1a23a411a1 Use zend_string_efree() for temporary strings
This avoids some assembly code bloat.
2025-05-21 19:54:09 +02:00
Niels Dossche
33ae76405f Use zend_string for arg_separators
This allows us to avoid a call to `zend_ini_str` which took 6% of the
profile on my i7-4790 for a call to `http_build_query`. Now we can just
grab the value from the globals.
In other files this can avoid some length recomputations.
2025-05-21 19:54:09 +02:00
Niels Dossche
ed3096913d
Merge branch 'PHP-8.4'
* PHP-8.4:
  Add missing filter cleanups on phar failure
2025-05-21 19:50:45 +02:00
Niels Dossche
f9785c230c
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Add missing filter cleanups on phar failure
2025-05-21 19:48:20 +02:00
Niels Dossche
9da2c24903
Fix Alpine build (#18616)
We're not allowed to include the sys/cdefs.h header on alpine, but it
seems we don't even need this in the first place. So drop it.
2025-05-21 19:39:02 +02:00
Jakub Zelenka
16a3fb1c3f
Merge branch 'PHP-8.4' 2025-05-21 00:42:10 +02:00
Jakub Zelenka
445472c2ad
Merge branch 'PHP-8.3' into PHP-8.4 2025-05-21 00:41:42 +02:00
Niels Dossche
efaae93e48
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-18597: Heap-buffer-overflow in zend_alloc.c when assigning string with UTF-8 bytes
2025-05-20 21:32:27 +02:00
Niels Dossche
40e667280b
Fix GH-18597: Heap-buffer-overflow in zend_alloc.c when assigning string with UTF-8 bytes
xmlSave() also can flush in some cases. When the encoding is not
available this can fail for short inputs, resulting in an empty string
which is interned but then wrongly tagged by RETURN_NEW_STR.
Fix this by checking the error condition and switching to RETURN_STR for
defense-in-depth.

This issue also exists on 8.3, but does not crash; however, due to the
different API usage internally I cannot easily fix it on 8.3. There it
gives a partial output.

Closes GH-18606.
2025-05-20 21:32:17 +02:00
Calvin Buckley
76791e90b9
Use win32 glob implementation on all platforms (#18164)
* Move glob to main/ from win32/

In preparation to make the Win32 reimplementation the standard
cross-platform one. Currently, it doesn't do that and just passes
through the original glob implementation. We could consider also having
an option to use the standard glob for systems that have a sufficient
one.

* Enable building with win32 glob on non-windows

Kind of broken. We're namespacing the function and struct, but not yet
the GLOB_* defines. There are a lot of places callers check if i.e.
NOMATCH is defined that would likely become redundant.

Currently it also has php_glob and #defines glob php_glob (etc.) - I
suspect doing the opposite and changing the callers would make more
sense, just doing MVP to geet it to build (even if it fails tests).

* Massive first pass at conversion to internal glob

Have not tested yet. the big things are:

- Should be invisible to userland PHP code.
- A lot of :%s/GLOB_/PHP_GLOB_/g; the diff can be noisy as a result,
  especially in comments.
- Prefixes everything with PHP_ to avoid conflicts with system glob in
  case it gets included transitively.
- A lot of weird shared definitions that were sprawled out to other
  headers are now included in php_glob.h.
- A lot of (but not yet all cases) of HAVE_GLOB are removed, since we
  can always fall back to php_glob.
- Using the system glob is not wired up yet; it'll need more shim
  ifdefs for each flag type than just glob_t/glob/globfree defs.

* Fix inclusion of GLOB_ONLYDIR

This is a GNU extension, but we don't need to implement it, as the GNU
implementation is flawed enough that callers have to manually filter it
anyways; just provide a stub definition for the constant.

We could consideer implementing this properly later. For now, fixes the
basic glob constant tests.

* Remove HAVE_GLOBs

We now always have a glob implementation that works. HAVE_GLOB should
only be used to check if we have a system implementation, for if we
decide to wrap the system implementation instead.

* We don't need to care about being POSIXly correct for internal glob

* Check for reallocarray

Ideally temporary until GH-17433.

* Forgot to move this file from win32/ to main/

* Check for issetugid (BSD function)

* Allow using the system glob with --enable-system-glob

* Style fix after removing ifdef

* Remove empty case for system glob
2025-05-20 16:20:59 -03:00
Calvin Buckley
4eef2bc6f8
Merge branch 'PHP-8.4'
* PHP-8.4:
  PHP 8.4 is now for PHP-8.4.9-dev
2025-05-20 14:50:36 -03:00
Calvin Buckley
3e0a4259a8
PHP 8.4 is now for PHP-8.4.9-dev 2025-05-20 13:13:34 -03:00
Niels Dossche
e2b47d8483
Merge branch 'PHP-8.4'
* PHP-8.4:
  Split off php_set_sock_blocking() and s.is_blocked to a separate function
  Fix missing checks against php_set_blocking() in xp_ssl.c
2025-05-20 08:08:46 +02:00
Niels Dossche
1e94f3423b
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Split off php_set_sock_blocking() and s.is_blocked to a separate function
  Fix missing checks against php_set_blocking() in xp_ssl.c
2025-05-20 08:08:39 +02:00
Niels Dossche
63657df6e1
Merge branch 'PHP-8.4'
* PHP-8.4:
  Backport accel_globals->key leak fix (8.3)
2025-05-19 22:28:22 +02:00
Niels Dossche
b14250a677
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Backport accel_globals->key leak fix (8.3)
2025-05-19 22:28:06 +02:00
Niels Dossche
5bbe3d71c2
Improve performance of instantiating exceptions/errors (#18442)
The class structure is fixed, so it makes no sense to go through all the
logic of looking up property info etc if there are no hooks.
This patch introduces a local function `zend_update_property_num_checked()` to
help with that.

For this benchmark:
```php
for ($i = 0; $i < 1000000; $i++)
   new Error;
```

On an i7-4790:
```
Benchmark 1: ./sapi/cli/php  x.php
  Time (mean ± σ):     141.6 ms ±   9.3 ms    [User: 138.7 ms, System: 2.0 ms]
  Range (min … max):   135.4 ms … 177.7 ms    20 runs

Benchmark 2: ../RELx64_old/sapi/cli/php x.php
  Time (mean ± σ):     214.1 ms ±   7.0 ms    [User: 207.6 ms, System: 5.0 ms]
  Range (min … max):   206.6 ms … 230.9 ms    13 runs

Summary
  ./sapi/cli/php  x.php ran
    1.51 ± 0.11 times faster than ../RELx64_old/sapi/cli/php x.php
```

For this benchmark:
```php
for ($i = 0; $i < 1000000; $i++)
    new Exception("message", 0, null);
```

On an i7-4790:
```
Benchmark 1: ./sapi/cli/php  x.php
  Time (mean ± σ):     184.3 ms ±   9.5 ms    [User: 181.2 ms, System: 1.8 ms]
  Range (min … max):   173.8 ms … 205.1 ms    15 runs

Benchmark 2: ../RELx64_old/sapi/cli/php x.php
  Time (mean ± σ):     253.7 ms ±   7.0 ms    [User: 247.6 ms, System: 4.6 ms]
  Range (min … max):   245.7 ms … 263.7 ms    11 runs

Summary
  ./sapi/cli/php  x.php ran
    1.38 ± 0.08 times faster than ../RELx64_old/sapi/cli/php x.php
```

For this benchmark:
```php
for ($i = 0; $i < 1000000; $i++)
    new ErrorException("message", 0, 0, "xyz", 0, null);
```

On an i7-4790:
```
Benchmark 1: ./sapi/cli/php  x.php
  Time (mean ± σ):     223.6 ms ±   7.7 ms    [User: 220.1 ms, System: 2.4 ms]
  Range (min … max):   216.9 ms … 242.5 ms    12 runs

Benchmark 2: ../RELx64_old/sapi/cli/php x.php
  Time (mean ± σ):     343.5 ms ±   8.1 ms    [User: 337.1 ms, System: 4.6 ms]
  Range (min … max):   337.3 ms … 362.8 ms    10 runs

Summary
  ./sapi/cli/php  x.php ran
    1.54 ± 0.06 times faster than ../RELx64_old/sapi/cli/php x.php
```
2025-05-19 20:24:44 +02:00
Niels Dossche
146157ddf0
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix leak of accel_globals->key
2025-05-19 19:34:27 +02:00
Niels Dossche
db3bf715e0
Fix leak of accel_globals->key
I don't know why this was guarded with ZTS, but it leaks on this test
(and a few more):
`./sapi/cli/php ./run-tests.php -c . --show-diff sapi/phpdbg/tests/stdin_001.phpt`

Closes GH-18593.
2025-05-19 19:34:16 +02:00
Niels Dossche
383aad8007
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-18534: FPM exit code 70 with enabled opcache and hooked properties in traits
2025-05-19 19:22:16 +02:00
Niels Dossche
6b795f64a5
Fix GH-18534: FPM exit code 70 with enabled opcache and hooked properties in traits
The trait handling for property hooks in preloading did not exist, we
add a check to skip trait clones and we add the necessary code to update
the op arrays.

Closes GH-18586.
2025-05-19 19:21:53 +02:00
Niels Dossche
94f5037ac3
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-18567: Preloading with internal class alias triggers assertion failure
2025-05-19 19:20:16 +02:00
Niels Dossche
43915b302c
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-18567: Preloading with internal class alias triggers assertion failure
2025-05-19 19:20:11 +02:00
Niels Dossche
a3fa5ae57b
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix deprecation warning for libxml SAX header (#18594)
2025-05-19 19:11:30 +02:00
Niels Dossche
9bf140afb4
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix deprecation warning for libxml SAX header (#18594)
2025-05-19 19:11:22 +02:00
Niels Dossche
0b48e2a267
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix OSS-Fuzz #418106144
  Fix OSS-Fuzz #417078295
  fix: dangling opline in ZEND_INIT_ARRAY (#18578)
2025-05-19 19:08:29 +02:00
Niels Dossche
08cba2dcc1
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix OSS-Fuzz #418106144
  Fix OSS-Fuzz #417078295
2025-05-19 19:07:17 +02:00
Levi Morrison
59e6165fa6
Merge branch 'PHP-8.3' into PHP-8.4 2025-05-19 09:53:15 -06:00
Arnaud Le Blanc
16ca097ef2
Do not exit to VM when setting undefined prop in constructor
JIT'ed ASSIGN_OBJ expressions will exit to VM when the prop is undef. However,
in a constructor it's very likely the case. Therefore most traces with `new`
expressions will exit to VM.

Here I ensure that we don't need to exit to VM when it's likely that the
prop will be undef.

In the function JIT we compile a slow path to handle such properties,
but not in the tracing JIT, assumingly to reduce code size. Here I enable
compilation of the slow path in the tracing JIT when it's likely the prop
will be undef. Quite conveniently we already record the prop type during
tracing, so I use that to make the decision.

This results in a 1.20% wall time improvement on the symfony demo benchmark
with 20 warmup requests.

Closes GH-18576
2025-05-19 12:42:11 +02:00
Arnaud Le Blanc
3cd0383d91
Adjust default value of opcache.jit_hot_loop to a prime number
Loops whose number of iterations + 1 is a factor of opcache.jit_hot_loop
will always be traced at the exact moment the loop condition evaluates
to false. As a result, these loops can never be JIT'ed successfully.

Here I adjust the default value of opcache.jit_hot_loop to a prime number,
so this can not happen (unless number of iterations+1 is opcache.jit_hot_loop).

Closes GH-18573
2025-05-19 12:21:33 +02:00
Tim Düsterhus
2d6b86945f
zend_vm: Add OPcode specialization for === [] (#18571)
* zend_vm: Add OPcode specialization for `=== []`

Checking whether an array is empty with a strict comparison against the empty
array is a common pattern in PHP. A GitHub search for `"=== []" language:PHP`
reveals 44k hits. From the set of `!$a`, `count($a) === 0`, `empty($a)` and
`$a === []` it however is also the slowest option.

A test script:

    <?php

    $variable = array_fill(0, 10, random_int(1, 2));

    $f = true;
    for ($i = 0; $i < 50_000_000; $i++) {
    	$isEmpty = $variable === [];
    	$f = $f && $isEmpty;
    }

    var_dump($f);

with the `$isEmpty = …;` statement appropriately replaced results in:

    Benchmark 1: sapi/cli/php -d zend_extension=modules/opcache.so -d opcache.enable_cli=1 count.php
      Time (mean ± σ):     467.6 ms ±   2.3 ms    [User: 463.3 ms, System: 3.4 ms]
      Range (min … max):   464.6 ms … 473.4 ms    10 runs

    Benchmark 2: sapi/cli/php -d zend_extension=modules/opcache.so -d opcache.enable_cli=1 empty.php
      Time (mean ± σ):     305.3 ms ±   0.3 ms    [User: 302.0 ms, System: 3.1 ms]
      Range (min … max):   304.9 ms … 305.7 ms    10 runs

    Benchmark 3: sapi/cli/php -d zend_extension=modules/opcache.so -d opcache.enable_cli=1 identical.php
      Time (mean ± σ):     630.3 ms ±   3.9 ms    [User: 624.8 ms, System: 3.8 ms]
      Range (min … max):   627.4 ms … 637.6 ms    10 runs

    Benchmark 4: sapi/cli/php -d zend_extension=modules/opcache.so -d opcache.enable_cli=1 not.php
      Time (mean ± σ):     311.8 ms ±   3.4 ms    [User: 307.9 ms, System: 3.6 ms]
      Range (min … max):   308.7 ms … 320.7 ms    10 runs

    Summary
      sapi/cli/php -d zend_extension=modules/opcache.so -d opcache.enable_cli=1 empty.php ran
        1.02 ± 0.01 times faster than sapi/cli/php -d zend_extension=modules/opcache.so -d opcache.enable_cli=1 not.php
        1.53 ± 0.01 times faster than sapi/cli/php -d zend_extension=modules/opcache.so -d opcache.enable_cli=1 count.php
        2.06 ± 0.01 times faster than sapi/cli/php -d zend_extension=modules/opcache.so -d opcache.enable_cli=1 identical.php

This patch adds another OPcode specialization for `ZEND_IS_IDENTICAL` that
specifically matches a comparison against the empty array. With this
specialization the `=== []` check becomes the fastest of them all, which is not
surprising given how specific it is:

    Benchmark 1: sapi/cli/php -d zend_extension=modules/opcache.so -d opcache.enable_cli=1 count.php
      Time (mean ± σ):     384.1 ms ±   2.3 ms    [User: 379.3 ms, System: 3.8 ms]
      Range (min … max):   382.2 ms … 389.8 ms    10 runs

    Benchmark 2: sapi/cli/php -d zend_extension=modules/opcache.so -d opcache.enable_cli=1 empty.php
      Time (mean ± σ):     305.8 ms ±   3.2 ms    [User: 301.7 ms, System: 3.8 ms]
      Range (min … max):   304.4 ms … 314.9 ms    10 runs

      Warning: Statistical outliers were detected. Consider re-running this benchmark on a quiet system without any interferences from other programs. It might help to use the '--warmup' or '--prepare' options.

    Benchmark 3: sapi/cli/php -d zend_extension=modules/opcache.so -d opcache.enable_cli=1 identical.php
      Time (mean ± σ):     293.9 ms ±   2.9 ms    [User: 289.7 ms, System: 3.3 ms]
      Range (min … max):   291.5 ms … 299.4 ms    10 runs

    Benchmark 4: sapi/cli/php -d zend_extension=modules/opcache.so -d opcache.enable_cli=1 not.php
      Time (mean ± σ):     306.8 ms ±   0.4 ms    [User: 303.8 ms, System: 2.7 ms]
      Range (min … max):   306.3 ms … 307.3 ms    10 runs

    Summary
      sapi/cli/php -d zend_extension=modules/opcache.so -d opcache.enable_cli=1 identical.php ran
        1.04 ± 0.01 times faster than sapi/cli/php -d zend_extension=modules/opcache.so -d opcache.enable_cli=1 empty.php
        1.04 ± 0.01 times faster than sapi/cli/php -d zend_extension=modules/opcache.so -d opcache.enable_cli=1 not.php
        1.31 ± 0.02 times faster than sapi/cli/php -d zend_extension=modules/opcache.so -d opcache.enable_cli=1 count.php

As a follow-up optimization it might be possible to transform the other
emptiness checks, such as `count($arr) === 0` into `$arr === []` if `$arr` is
known to be `MAY_BE_ARRAY` only.

* zend_vm: Add OPcode specialization for `!== []`

* UPGRADING
2025-05-19 09:36:30 +02:00
Remi Collet
8e2acc0df4
NEWS + UPGRADING 2025-05-19 07:46:40 +02:00
Remi Collet
e726d917e7
add more ldaps/tls tests with TLS_CACERTFILE 2025-05-19 07:40:12 +02:00
Remi Collet
1e6909d25e
allow ldap_get_option to retrieve global option 2025-05-19 07:40:09 +02:00
David CARLIER
00f0175ba9
[skip ci] IntlListFormatter UPGRADING fixes (#18590) 2025-05-18 16:52:30 +01:00
Bogdan Ungureanu
3f75452454
Intl: Add IntlListFormatter class
Allows to format a list of item with
- TYPE_AND/TYPE_OR/TYPE_UNITS operands.
- WIDTH_WIDE, WIDTH_SHORT, WIDTH_NARROW.

close GH-18519
2025-05-18 15:52:20 +01:00
Niels Dossche
06738fc051
Remove ZEND_ACC_USE_GUARDS from hooks (#18587)
This is no longer necessary since the hooks amendments removed guards
for recursion.
2025-05-18 15:01:24 +02:00
Chris Brown
49a60ec084
Correct typo in UPGRADING [skip ci] (#18584)
`--enable-sanitzer` -> `--enable-sanitizer`
2025-05-17 19:20:56 -07:00
David Carlier
419b9a7ff6
Merge branch 'PHP-8.4' 2025-05-17 12:46:51 +01:00
David Carlier
68abc19229
Follow-up on GH-18577, adjust new test due to change on nested objects. 2025-05-17 12:46:27 +01:00
David Carlier
e4e71215d6
Merge branch 'PHP-8.3' into PHP-8.4 2025-05-17 12:45:13 +01:00
David Carlier
90d2f8abfd
Merge branch 'PHP-8.4' 2025-05-17 11:21:02 +01:00
David Carlier
a7884250b1
Merge branch 'PHP-8.3' into PHP-8.4 2025-05-17 11:20:39 +01:00
Niels Dossche
05618e7e0b
Merge branch 'PHP-8.4'
* PHP-8.4:
  Backport lexbor/lexbor@814e0bce97 (#18574)
2025-05-16 20:28:16 +02:00
Niels Dossche
dbc7c5f34a
Backport lexbor/lexbor@814e0bce97 (#18574)
Co-authored-by: Alexander Borisov <lex.borisov@gmail.com>
2025-05-16 20:27:56 +02:00
Saki Takamachi
47354a7404
Added zend_simd.h (#18413) 2025-05-16 15:42:20 +09:00
George Wang
3367f17f60 Merge branch 'PHP-8.4' 2025-05-15 11:53:27 -04:00
George Wang
72efe6dcdf Merge branch 'PHP-8.3' into PHP-8.4 2025-05-15 11:53:07 -04:00
Remi Collet
2e70a8945a
Merge branch 'PHP-8.4'
* PHP-8.4:
  NEWS
  NEWS
  Fix GH-18529: ldap no longer respects TLS_CACERT from ldaprc in ldap_start_tls() Regresion introduced in fix for GH-17776
2025-05-15 09:22:52 +02:00
Remi Collet
73321e22d2
NEWS 2025-05-15 09:22:41 +02:00
Remi Collet
8647624261
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  NEWS
  Fix GH-18529: ldap no longer respects TLS_CACERT from ldaprc in ldap_start_tls() Regresion introduced in fix for GH-17776
2025-05-15 09:22:09 +02:00
Richard Schneeman
89dc8d79a7
cli: Fix swapped output in php --ini (#18557)
In #18527, I accidentally swapped the values. This is before my modification:

```
zend_printf("Configuration File (php.ini) Path: %s\n", PHP_CONFIG_FILE_PATH);
zend_printf("Loaded Configuration File:         %s\n", php_ini_opened_path ? php_ini_opened_path : "(none)");
zend_printf("Scan for additional .ini files in: %s\n", php_ini_scanned_path  ? php_ini_scanned_path : "(none)");
```

- "Loaded Configuration File" should be `php_ini_opened_path`
- "Scan for additional .ini files in" shoudl be `php_ini_scanned_path`
2025-05-14 21:36:20 +02:00
Arnaud Le Blanc
1de16c7f15
Merge branch 'PHP-8.4'
* PHP-8.4:
  Snapshotted poly_func / poly_this may be spilled
2025-05-14 12:30:36 +02:00
Arnaud Le Blanc
18276a8b42
Snapshotted poly_func / poly_this may be spilled
Polymorphic calls pass this and the function to side traces via snapshotting.
However, we assume that this/func are in registers, when in fact they may be
spilled.

Here I update snapshotting of poly_func/poly_this to support spilling:

 - In zend_jit_snapshot_handler, keep track of the C stack offset
   of the spilled register, in a way similar to how stack variables.
 - In zend_jit_start, do not pre-load the registers if they were spilled.
 - In zend_jit_trace_exit / zend_jit_trace_deoptimization, load from the
   stack if the register was spilled.
 - Store a reference to poly_func/poly_this in zend_jit_ctx so we can use that
   directly in the side trace.

Closes GH-18408
2025-05-14 12:27:57 +02:00
David CARLIER
4122daa494
ext/date: various array optimisations. (#18382) 2025-05-12 19:03:59 +01:00
Niels Dossche
ba4567a987
Fix OSS-Fuzz #416302790 (#18537)
The parser accepted invalid code: consts are only valid at the top
level, but because GH-16952 changed the grammar it was incorrectly
allowed at all places that allowed attributed statements.
Fix this by introducing a variant of attributed_statement for the top
level.
2025-05-12 18:45:01 +02:00
Tim Düsterhus
5e65d8e126
standard: Remove php_std_date() C API (#18522)
This function is unused and trivially replaced by `php_format_date()` (which is
already used to format date headers in the CLI server and ext/session). Remove
it to slim down the codebase, allowing to remove an entire header (and a source
file once the deprecated `strptime()` userland function is removed).
2025-05-12 10:53:51 +02:00
Tim Düsterhus
5626e65af2
Merge branch 'PHP-8.4'
* PHP-8.4:
  standard: Take `zend.assertions` into account for dynamic calls to `assert()` (#18521)
2025-05-12 08:45:37 +02:00
Tim Düsterhus
40edd58d36
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  standard: Take `zend.assertions` into account for dynamic calls to `assert()` (#18521)
2025-05-12 08:45:26 +02:00
Richard Schneeman
331ac35f58
Fix visibility of whitespace in config output (#18527)
When a config var has whitespace (especially trailing whitespace) it is hard to see. This commit wraps the values (if they exist) in double quotes, so the difference is visually observable:

Before:

```
$ export PHP_INI_SCAN_DIR="/opt/homebrew/etc/php/8.4/conf.d         "
$ ./sapi/cli/php --ini
Configuration File (php.ini) Path: /usr/local/lib
Loaded Configuration File:         /opt/homebrew/etc/php/8.4/conf.d         
Scan for additional .ini files in: (none)
Additional .ini files parsed:      (none)
```

> Note 
> The above output has trailing whitespace that is not visible, you can see it if you copy it into an editor:

After:

```
$ ./sapi/cli/php --ini
Configuration File (php.ini) Path: "/usr/local/lib"
Loaded Configuration File:         "/opt/homebrew/etc/php/8.4/conf.d         "
Scan for additional .ini files in: (none)
Additional .ini files parsed:      (none)
```

Above the whitespace is now visible `/opt/homebrew/etc/php/8.4/conf.d         `.

Close #18390
2025-05-11 14:53:56 +01:00
Jorg Adam Sowa
e11a702c05
ext/hash: tests for md5 and sha1 compatibility (#18525)
Add test cases to check compatibility between the `hash("algo")` and `md5()`/`sha1()` functions.
2025-05-09 13:08:58 +01:00
Tim Düsterhus
73c4e9f0b2
Merge branch 'PHP-8.4'
* PHP-8.4:
  gen_stub: Fix `ce_flags` generation for compatibility mode (#18507)
2025-05-09 13:33:58 +02:00
Tim Düsterhus
84f82d0a1c
gen_stub: Fix ce_flags generation for compatibility mode (#18507)
* gen_stub: Fix `ce_flags` generation for compatibility mode

Fixes php/php-src#18506

* gen_stub: Improve output for ce_flags compatibility
2025-05-09 13:33:09 +02:00
Daniel Scherzer
2b0cb760d4 gen_stub: move parseStubFile() into FileInfo
Reduce the number of global functions by moving it to static method
`FileInfo::parseStubFile()`. Additionally, make `FileInfo::handleStatements()`
private now that the only caller is part of the class.
2025-05-08 13:06:51 -07:00
Daniel Scherzer
05dbf0707a gen_stub: further reduce the number of public properties
The following properties are made private:
* `ArgInfo::$phpDocType`
* `ClassInfo::$flags`, `::$attributes`, `::$extends`, `::$implements`
* `FileInfo::$isUndocumentable`

The following are made protected:
* `VariableLike::$flags`
2025-05-08 13:06:51 -07:00
Daniel Scherzer
c89d7a7426 gen_stub: add and use FileInfo::getLegacyVersion()
Separate out the creation of a legacy version of a FileInfo object, which has
information for old versions of PHP discarded, from its subsequent use in
`processStubFile()`.

In the process, make `FileInfo::$legacyArginfoGeneration` private, and inline
the single use of `FileInfo::getAllClassInfos()`, removing that method.
2025-05-08 13:06:51 -07:00
Daniel Scherzer
bb555926c4 gen_stub: deduplicate and simplify DocCommentTag processing
For a lot of the structures, the parsing of doc comment tags is based on if a
specific tag is present, or the value that it has if it is. Add a new helper
method, `DocCommentTag::makeTagMap()`, that turns an array of tag instances
into a map from tag name to value (the last value, if there are multiple uses
of the same tag name). Then, for the simple cases where just a tag's presence
is all that is checked, or just the (last) value is used, check the map instead
of using a loop through all of the tags present.
2025-05-08 13:06:51 -07:00
Daniel Scherzer
d42bac2866 gen_stub: move parseDocComments() into DocCommentTag
Reduce the number of global functions by moving it to static method
`DocCommentTag::parseDocComments()`.
2025-05-08 13:06:51 -07:00
Daniel Scherzer
ce3990c1d3 gen_stub: move handlePreprocessorConditions() into FileInfo()
Reduce the number of global functions by moving it to static method
`FileInfo::handlePreprocessorConditions()`. Since it is only used by
`FileInfo::handleStatements()`, also make it private.
2025-05-08 13:06:51 -07:00
Daniel Scherzer
1c9b6b84df gen_stub: move handleStatements() into FileInfo
Reduce the number of global functions by moving it to instance method
`FileInfo::handleStatements()`.
2025-05-08 13:06:51 -07:00
Daniel Scherzer
ec3ecdc2c8 gen_stub: documentation updates
* Use `@param` instead of `@var` for parameters
* Fix type of `$attributeGroups` in `AttributeInfo::createFromGroups()`
* Remove extra documentation of `$allConstInfo` for
`ClassInfo::getClassSynopsisDocument()`, it is already documented under the
correct name `$allConstInfos`
* Remove unneeded `@throws`
2025-05-08 13:06:51 -07:00
Daniel Scherzer
722eba20ae gen_stub: drop unused parameters
The following parameters were either unused before this commit or became unused
as part of updating callers to stop passing unused parameters to other
functions updated in this commit:
* `FuncInfo::getMethodSynopsisDocument()` - `$funcMap`, `$aliasMap`
* `FuncInfo::getMethodSynopsisElement()` - `$funcMap`, `$aliasMap`
* `ConstInfo::getGlobalConstDeclaration()` - `$allConstInfos`
* `generateMethodSynopses()` - `$aliasMap`
* `replaceMethodSynopses()` - `$aliasMap`
2025-05-08 13:06:51 -07:00
Daniel Scherzer
4861391501 gen_stub: inline some single-use variables 2025-05-08 13:06:51 -07:00
Daniel Scherzer
39a6d6086e gen_stub: move funcInfoToCode() into FuncInfo
Reduce the number of global functions by moving it to instance method
`FuncInfo::toArgInfoCode()`.

In the process, make `FuncInfo::$numRequiredArgs` private.
2025-05-08 13:06:51 -07:00
Daniel Scherzer
b5361d75e0 gen_stub: add ReturnInfo::beginArgInfo()
The vast majority of the decisions about the use of `ZEND_BEGIN_ARG_INFO_EX` or
one of its variations are based on the return information of the function - is
the type builtin, is the return information tentative, does it include an
object mask, etc. Accordingly, move the logic into the `ReturnInfo` class.

The logic is actually moved into two methods, `ReturnInfo::beginArgInfo()`,
which needs to handle the case of tentative returns being used when PHP < 8.1
is supported, and `::beginArgInfoCompatible()`, which can assume that PHP 8.1+
is supported and thus make use of early returns and guard clauses. Further
improvements to the logic will be made in a subsequent commit.

In the process, make `ReturnInfo::$byRef` private.
2025-05-08 13:06:51 -07:00
Daniel Scherzer
24b7c7a365 gen_stub: add ArgInfo::toZendInfo()
Move the logic out of `funcInfoToCode()` and update it. In the process, make
`ArgInfo::getDefaultValueAsArginfoString()` private.
2025-05-08 13:06:51 -07:00
Daniel Scherzer
0d79039027 gen_stub: simplify ArgInfo::getDefaultValueAsMethodSynopsisString()
There is no need to add special handling for the default value of `null`, since
it is not loosely-equals to any of the strings 'UNKNOWN', 'false', 'true', or
'null' it will just be returned directly anyway.
2025-05-08 13:06:51 -07:00
Daniel Scherzer
45d313bbd7 gen_stub: simplify generateVersionDependentFlagCode()
* Return a string rather than an array, all callers just immediately used
`implode()` to join the elements in the array with nothing between them
* In the callers, inline some single-use variables with the template for the
version-dependent code
* Remove the callback to `array_filter` specifying that only items that are not
`empty()` be removed - this is the default behavior
2025-05-08 13:06:51 -07:00
Daniel Scherzer
bfa2b92ca6 gen_stub: add ExposedDocComment::getInitCode()
Deduplicates the setting up of the `zend_string_init_interned()` call, removes
the need for `ExposedDocComment::getLength()` and so that method is removed.
2025-05-08 13:06:51 -07:00
Daniel Scherzer
4527bafad0 gen_stub: break up closing tag in DOMCdataSection
Otherwise GitHub's syntax highlighting treats it as the end of the code and
stops highlighting
2025-05-08 13:06:51 -07:00
Jorg Adam Sowa
c6a9beebff
ext/standard/md5: Minor refactorings (#18518)
- Use size_t type instead of int type
- Use false instead of 0
- Remove wrapping comments
2025-05-08 12:00:50 +01:00
Remi Collet
e3715cddf0
Merge branch 'PHP-8.4'
* PHP-8.4:
  bump zip extension version to 1.22.6
2025-05-07 14:24:22 +02:00
Remi Collet
71ffa9596a
bump zip extension version to 1.22.6 2025-05-07 14:24:07 +02:00
Niels Dossche
168343d2e8
[RFC] Implement array_first() and array_last() (#18210) 2025-05-07 08:15:50 +02:00
Niels Dossche
50dc301f96
Merge branch 'PHP-8.4'
* PHP-8.4:
  Sync EXTENSIONS and extend maintenance time
2025-05-06 22:07:11 +02:00
Niels Dossche
11ad09e4bf
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Sync EXTENSIONS and extend maintenance time
2025-05-06 22:07:05 +02:00
Jakub Zelenka
cb4bafa4c0
Init OpenSSL libctx and use it for pkey (#18282) 2025-05-06 20:14:55 +02:00
Ilija Tovilo
905bba637a
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix missing include in win32/globals.c
2025-05-06 15:52:38 +02:00
Ilija Tovilo
14ff4b75a2
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix missing include in win32/globals.c
2025-05-06 15:52:30 +02:00
Niels Dossche
e0b73dc977
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-18494: PDO OCI segfault in statement GC
2025-05-05 19:30:47 +02:00
Niels Dossche
5825a6be83
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-18494: PDO OCI segfault in statement GC
2025-05-05 19:30:42 +02:00
Niels Dossche
3c84b01e02
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix leak+crash with sapi_windows_set_ctrl_handler()
2025-05-05 19:14:19 +02:00
Niels Dossche
d4a3e437ae
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix leak+crash with sapi_windows_set_ctrl_handler()
2025-05-05 19:14:13 +02:00
Niels Dossche
a9b84f9425
Use specialized functions/macros to reduce code size in ext/random (#18499)
On x86-64 with GCC 14.2.1:
zim_Random_Randomizer_getBytes goes from 514 to 418 bytes
zim_Random_Randomizer_getBytesFromString goes from 750 to 676 bytes
2025-05-05 19:12:39 +02:00
David CARLIER
be53902a13
ext/pgsql: globals data struct rework/size reduction (#18503) 2025-05-05 14:40:09 +01:00
Florian Moser
90da4821a2
ext/gmp: Add GMP ECC test (#18363)
Co-authored-by: Gina Peter Banyard <girgias@php.net>
2025-05-05 14:10:29 +01:00
David CARLIER
7855c52e81
ext/standard: gethostbyaddr/gethostbyname using *NEW_STR flavor. (#18502) 2025-05-05 13:58:15 +01:00
Niels Dossche
c91c6545fe
Drop name from mysqli_prop_handler (#18498)
It's just not necessary to store this, if we ever need this we can get
this from the hash table.
2025-05-05 12:36:26 +01:00
DanielEScherzer
940ee1a641
gen_stub: ZEND_ACC_NODISCARD is for PHP 8.5+ (#18465) 2025-05-04 15:08:37 -07:00
David CARLIER
9ac5b04487
ext/intl: use RETURN_NEW_STR for intl_get*id_windows_id(). (#18501)
for non interned return values.
2025-05-04 21:44:39 +01:00
Niels Dossche
af87ade8b8
Cleanup php_posix_group_to_array() (#18497)
This function can be static, and the error checks are pointless:
1. It's guaranteed that the return value is an array by now,
   as it is always preceded by array_init(return_value).
2. The null check for g is pointless as every callee already
   handles that in a better way.
2025-05-04 20:07:14 +02:00
Niels Dossche
1fa076e187
Cleanup php_posix_passwd_to_array() (#18496)
This function can be static, and the error checks are pointless:
1. It's guaranteed that the return value is an array by now, as it is
   always preceded by array_init(return_value).
2. The null check for pw is pointless as every callee already handles
   that in a better way.
2025-05-04 20:07:06 +02:00
David Carlier
e80d9535d7
Merge branch 'PHP-8.4' 2025-05-04 14:15:32 +01:00
David Carlier
2e2077172d
Merge branch 'PHP-8.3' into PHP-8.4 2025-05-04 14:15:05 +01:00
Niels Dossche
4152ca5c8a
Fix fuzzer support after CALL VM changes (#18491) 2025-05-04 13:25:42 +02:00
Tim Düsterhus
4e23d3d49f
[skip ci] Do not interpret PHP version in bug_report.yml as markdown (#18492) 2025-05-04 13:14:47 +02:00
Niels Dossche
b6667c471c
Merge branch 'PHP-8.4'
* PHP-8.4:
  Backport lexbor/lexbor#274
2025-05-04 12:58:07 +02:00
Niels Dossche
42ad1c64bf
Backport lexbor/lexbor#274
Co-authored-by: Alex Peattie <alexpeattie@gmail.com>

Closes GH-18490.
2025-05-04 12:57:54 +02:00
David Carlier
c0371d3965
Merge branch 'PHP-8.4' 2025-05-03 19:40:28 +01:00
David Carlier
a7b78a5091
Fix ext/date: date_sunrise() new tests.
close GH-18489
2025-05-03 19:40:16 +01:00
David Carlier
0f6e18df8f
Merge branch 'PHP-8.4' 2025-05-03 16:56:55 +01:00
David Carlier
004d7cd290
Merge branch 'PHP-8.3' into PHP-8.4 2025-05-03 16:56:32 +01:00
David CARLIER
bbac6f5c20
GH-18344 add Locale::addLikelySubtags/Locale::minimizeSubtags support. (#18487)
from a minimized locale, addLikelySubtags augments it with likely
subtags so no changes is the locale is already maximized e.g.
`en_Latn_US`, minimizeSubtags on the other hand does the opposite
operation.
2025-05-03 16:20:18 +01:00
David Carlier
07959fc007
Merge branch 'PHP-8.4' 2025-05-02 21:33:02 +01:00
David Carlier
351face053
Merge branch 'PHP-8.3' into PHP-8.4 2025-05-02 21:32:20 +01:00
Niels Dossche
60e9fb5a1b
Avoid potential integer overflow (#18485) 2025-05-02 15:50:24 +02:00
Ilija Tovilo
59056937bf
Fix use-of-uninitialized-value with exception on deprecated const access
Closes GH-18478
2025-05-02 11:57:16 +02:00
Saki Takamachi
f1d259a07b
ext/intl: Fix for the issue where strlen could potentially become negative (#18477) 2025-05-02 15:10:16 +09:00
Jakub Zelenka
dd5733202d
Document contributor certification in CONTRIBUTING.md [skip ci] (#18356) 2025-05-01 16:30:48 +01:00
Ilija Tovilo
178fc2db82
[skip ci] Fix var count in opcache test for i386 2025-05-01 12:00:26 +02:00
Niels Dossche
a1e1a7a721
Merge branch 'PHP-8.4'
* PHP-8.4:
  Update NEWS for the intl reference fixes
  Fix reference handling of IntlTimeZone::getCanonicalID/intltz_get_canonical_id
  Fix reference handling of grapheme_extract()
  Fix numfmt_parse_currency() reference handling
2025-05-01 10:42:30 +02:00
Niels Dossche
8d6e377ed8
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Update NEWS for the intl reference fixes
  Fix reference handling of IntlTimeZone::getCanonicalID/intltz_get_canonical_id
  Fix reference handling of grapheme_extract()
  Fix numfmt_parse_currency() reference handling
2025-05-01 10:42:25 +02:00
Niels Dossche
b2876117f0
Update return types of transliterator_get_error_code(), transliterator_get_error_message(), TransLiterator::getErrorCode(), and TransLiterator::getErrorMessage() (#18470)
Returning false is impossible.
2025-05-01 10:35:43 +02:00
Ilija Tovilo
156d034d3d
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Remove NEWS entry for reverted fix
2025-04-30 22:38:40 +02:00
Ilija Tovilo
d991215a8e
[skip ci] Remove NEWS entry for reverted fix 2025-04-30 22:38:12 +02:00
Ilija Tovilo
182ec003cc
Merge branch 'PHP-8.4'
* PHP-8.4:
  Revert "Fix infinite recursion on deprecated attribute evaluation"
2025-04-30 20:54:31 +02:00
Ilija Tovilo
386ab1dad2
Revert "Fix infinite recursion on deprecated attribute evaluation"
This reverts commit 272f7f75e2.

Reverts GH-17712 for the PHP-8.4 branch. This will be reapplied later
with a fix for GH-18463 (GH-18464).
2025-04-30 20:52:56 +02:00
Levi Morrison
6406d5f792
zlib: use zend_string_{extend,truncate} over *_realloc (#18462)
These cases seemed obvious enough to me to confidently change as an
outsider to zlib.
2025-04-30 08:18:04 -06:00
Niels Dossche
39a56a1687
Fix opcode length of ZEND_DECLARE_ATTRIBUTED_CONST in JIT-IR component (#18457)
Introduced in 3f03f7ed.
2025-04-30 08:17:56 +02:00
Saki Takamachi
c5f3281446
ext/bcmath: Improving bcpow() performance (#18099) 2025-04-30 08:05:28 +09:00
David Carlier
26dbcb7640
Merge branch 'PHP-8.4' 2025-04-29 22:48:52 +01:00
David Carlier
e18498ee27
Merge branch 'PHP-8.3' into PHP-8.4 2025-04-29 22:48:43 +01:00
David Carlier
ad65698a48
ext/curl: CURLOPT_FOLLOWLOCATION option handling.
it had been considered as boolean for years but since 8.13, it can
accept values beyond 1L, respectively CURLFOLLOW_OBEYCODE and
CURLFOLLOW_FIRSTONLY.

close GH-18444
2025-04-29 21:53:38 +01:00
Niels Dossche
82e09db0e9
Use reverse-unwinding goto-style error-handling in grapheme_levenshtein (#18451)
This reduces repetition and makes it harder to accidentally miss
cleaning up something.
2025-04-29 22:48:08 +02:00
Tim Düsterhus
272abc2fb7
Optimize match(true) (#18423)
* Optimizer: Optimize `IS_IDENTICAL` with true/false/null to `TYPE_CHECK`

This optimization is already happening in the compiler for explicit `===`
expressions, but not for `match()`, which also compiles to `IS_IDENTICAL`.

* Optimizer: Optimize `T = BOOL(X) + TYPE_CHECK(T, true)` to just `BOOL`

Resolves php/php-src#18411
2025-04-29 21:39:12 +02:00
DanielEScherzer
3f03f7ed3d
[RFC] Add support for attributes on compile-time constants
https://wiki.php.net/rfc/attributes-on-constants
2025-04-29 11:53:09 -07:00
Arnaud Le Blanc
2fea4efa8f
Fix merge error (#18453) 2025-04-29 17:06:59 +02:00
Arnaud Le Blanc
0eea5d31e0
run-tests.php: Remove extra env vars in the generated .sh file (#18306) 2025-04-29 10:59:10 +02:00
Arnaud Le Blanc
3737e0aa6f
Merge branch 'PHP-8.4'
* PHP-8.4:
  JIT: Check exception on exit
2025-04-29 10:55:38 +02:00
Arnaud Le Blanc
978c01ce15
JIT: Check exception on exit
Add a new exit flag (ZEND_JIT_EXIT_CHECK_EXCEPTION) that enables exception
checking during exit/deoptimization.

We already checked for exceptions during exit/deoptimization, but only when
ZEND_JIT_EXIT_FREE_OP1 or ZEND_JIT_EXIT_FREE_OP2 were set (presumably to
handle exceptions thrown during dtor). The new flag makes it possible to request
it explicitly.

This also fixes two issues in zend_jit_trace_exit():

- By returning 1, we were telling the caller (zend_jit_trace_exit_stub()) to
  execute the original op handler of EG(current_execute_data)->opline, but in
  reality we want to execute EX(opline), which should be EG(exception_op).

- EX(opline) is set to the value of %r15 in zend_jit_trace_exit_stub() before
  calling zend_jit_trace_exit(), but this may be the address of a
  zend_execute_data when the register is being reused to cache EX(call).

Fixes GH-18262
Closes GH-18297
2025-04-29 10:55:31 +02:00
Niels Dossche
f1b73353e4
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-18417: Windows SHM reattachment fails when increasing memory_consumption or jit_buffer_size
2025-04-28 19:52:28 +02:00
Niels Dossche
c620fee404
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-18417: Windows SHM reattachment fails when increasing memory_consumption or jit_buffer_size
2025-04-28 19:52:22 +02:00
Ilija Tovilo
21260754b1
Merge branch 'PHP-8.4'
* PHP-8.4:
  Use --ignore-platform-req=php+ in community build
2025-04-28 17:11:39 +02:00
Ilija Tovilo
8fe5a443e2
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Use --ignore-platform-req=php+ in community build
2025-04-28 17:11:30 +02:00
tekimen
bdcea111f3
Add grapheme_levenshtein function. (#18087)
Measure levenshtein for grapheme cluster unit
2025-04-28 16:22:52 +09:00
Kamil Tekiela
6fa669a125
Improve PDO entry in UPGRADING file (#18446) 2025-04-27 20:05:57 +01:00
George Wang
2336aa684d Merge branch 'PHP-8.4' 2025-04-27 12:00:31 -04:00
George Wang
c08c5ded1a Merge branch 'PHP-8.3' into PHP-8.4 2025-04-27 12:00:12 -04:00
George Wang
78370689b8 Merge branch 'PHP-8.4' 2025-04-27 11:53:33 -04:00
George Wang
39a8e5e041 Merge branch 'PHP-8.3' into PHP-8.4 2025-04-27 11:53:14 -04:00
George Wang
7cc7ae9d24 Merge branch 'PHP-8.4' 2025-04-27 11:47:52 -04:00
George Wang
e961488d98 Update SAPI_LITESPEED_PATH to sapi/litespeed/lsphp 2025-04-27 11:47:35 -04:00
George Wang
c9aba7c7ca Merge branch 'PHP-8.3' into PHP-8.4 2025-04-27 11:46:27 -04:00
Niels Dossche
5f97728780
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix IntlDateFormatter::parseToCalendar() reference type system breaks
  datefmt_parse/datefmt_localtime references type system fixes
  Fix GH-18438: Handling of empty data and errors in ZipArchive::addPattern
2025-04-27 11:33:33 +02:00
Niels Dossche
173dccb646
Fix IntlDateFormatter::parseToCalendar() reference type system breaks
Closes GH-18440.
2025-04-27 11:33:21 +02:00
Niels Dossche
d00adca199
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  datefmt_parse/datefmt_localtime references type system fixes
  Fix GH-18438: Handling of empty data and errors in ZipArchive::addPattern
2025-04-27 11:32:57 +02:00
Niels Dossche
1ec9041bf8
Fix reference handling in cancel callback (#18439)
Broke in 8765e9f5e7
2025-04-27 11:27:18 +02:00
Gina Peter Banyard
c919ab4bdf
[skip ci] Update UPGRADING regarding libxml signature change 2025-04-26 13:59:38 +01:00
Gina Peter Banyard
3932d9b660 ext/libxml: Get rid of useless php_libxml_func_handler abstraction 2025-04-26 13:57:17 +01:00
Gina Peter Banyard
dc036016a3 ext/libxml: Minor code nits 2025-04-26 13:57:17 +01:00
Gina Peter Banyard
d1917c918e ext/libxml: libxml_set_external_entity_loader() always returns true 2025-04-26 13:57:17 +01:00
Gina Peter Banyard
c5aa03c8b9 ext/libxml: Use bool type instead of int type 2025-04-26 13:57:17 +01:00
Gina Peter Banyard
1f1cd5c4bc ext/libxml: Add some const qualifiers 2025-04-26 13:57:17 +01:00
Gina Peter Banyard
e59c7f887b ext/libxml: Reduce scope of variables 2025-04-26 13:57:17 +01:00
Niels Dossche
a7cc447b28
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-18431: Registering ZIP progress callback twice doesn't work
2025-04-26 14:27:15 +02:00
Niels Dossche
5b8db66227
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-18431: Registering ZIP progress callback twice doesn't work
2025-04-26 14:23:54 +02:00
Niels Dossche
d36b02927f
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-18400: http_build_query type error is inaccurate
2025-04-26 14:17:35 +02:00
Niels Dossche
7a2bef02c0
Fix GH-18400: http_build_query type error is inaccurate
Objects are also accepted still, so the error message is misleading.

Closes GH-18434.
2025-04-26 14:17:24 +02:00
Niels Dossche
4f10973853
Remove always-false intern checks (#18433) 2025-04-26 14:11:37 +02:00
Tim Düsterhus
61d15870aa
random: Mark mt_getrandmax() as @compile-time-eval (#18425) 2025-04-25 22:57:04 +02:00
Niels Dossche
e3433fdaef
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-18421: Integer overflow with large numbers in LimitIterator
2025-04-25 20:06:24 +02:00
Niels Dossche
4ff41cfb4b
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-18421: Integer overflow with large numbers in LimitIterator
2025-04-25 20:06:18 +02:00
Derick Rethans
0029d2b08b Turn off font ligatures in code in documentation 2025-04-25 10:30:43 +01:00
Derick Rethans
681ef77734 Convert https://qa.php.net/running-tests.php 2025-04-25 10:09:52 +01:00
Derick Rethans
eb048ce0c6 Add samples from original QA site 2025-04-25 10:09:52 +01:00
Derick Rethans
ec288b1b07 Convert https://qa.php.net/write-test.php and https://qa.php.net/phpt_details.php 2025-04-25 10:09:52 +01:00
Saki Takamachi
6c09c167ef
removed <mmintrin.h> (#18414) 2025-04-25 08:26:51 +09:00
Niels Dossche
6c0578d31c
Improve performance of urldecode() and rawurldecode()
There are two hot spots on my machines:
1. We copy the string because the internal PHP API works in-place.
2. The conversion of hex characters is slow due to going through the C
   locale handling.

This patch resolves the first hot spots by introducing 2 new internal
APIs that avoid the redundant copy and allocate an empty string upfront.
The second hotspot is resolved by having a specialised htoi handler.

For the following benchmark:
```php
$encoded = "Hello%20World%21+This%20is%20a%20test%3A%20%40%23%24%25%5E%26*%28%29";
for ($i=0;$i<2000000;$i++) {
  rawurldecode($encoded);
  urldecode($encoded);
}
```

On an i7-4790:
```
Benchmark 1: ./sapi/cli/php x.php
  Time (mean ± σ):     364.8 ms ±   3.7 ms    [User: 359.9 ms, System: 3.3 ms]
  Range (min … max):   359.9 ms … 372.0 ms    10 runs

Benchmark 2: ./sapi/cli/php_old x.php
  Time (mean ± σ):     565.5 ms ±   4.9 ms    [User: 561.8 ms, System: 2.5 ms]
  Range (min … max):   560.7 ms … 578.2 ms    10 runs

Summary
  ./sapi/cli/php x.php ran
    1.55 ± 0.02 times faster than ./sapi/cli/php_old x.php
```

On an i7-1185G7:
```
Benchmark 1: ./sapi/cli/php x.php
  Time (mean ± σ):     708.8 ms ±   6.1 ms    [User: 701.4 ms, System: 6.3 ms]
  Range (min … max):   701.9 ms … 722.3 ms    10 runs

Benchmark 2: ./sapi/cli/php_old x.php
  Time (mean ± σ):      1.311 s ±  0.019 s    [User: 1.300 s, System: 0.008 s]
  Range (min … max):    1.281 s …  1.348 s    10 runs

Summary
  ./sapi/cli/php x.php ran
    1.85 ± 0.03 times faster than ./sapi/cli/php_old x.php
```

Closes GH-18378.
2025-04-24 22:14:55 +02:00
Niels Dossche
c0da1bc44d
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17403: Potential deadlock when putenv fails
2025-04-24 20:22:35 +02:00
Niels Dossche
c6ed104e91
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17403: Potential deadlock when putenv fails
2025-04-24 20:22:30 +02:00
Sergey Panteleev
090b1cf229
[ci skip] Update PHP Release Process (#18342) 2025-04-24 18:53:11 +03:00
Ilija Tovilo
9306c9584b
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Increase tolerance for cve-2014-3538 tests
2025-04-24 11:28:47 +02:00
Ilija Tovilo
303610154b
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [skip ci] Increase tolerance for cve-2014-3538 tests
2025-04-24 11:27:32 +02:00
Niels Dossche
4f3244351d
Merge branch 'PHP-8.4'
* PHP-8.4:
  Revert "Port XML_GetCurrentByteIndex to public APIs"
2025-04-23 22:10:13 +02:00
Niels Dossche
40894bcc49
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Revert "Port XML_GetCurrentByteIndex to public APIs"
2025-04-23 22:08:10 +02:00
Tim Düsterhus
7831f65f83
fileinfo: Stop calling finfo_close() in tests (#18405)
This function is a noop and will be proposed for deprecation. This patch
removes the useless calls.
2025-04-23 18:57:32 +02:00
Derick Rethans
0e1bbf9259
Add PHP 8.4 to the list 2025-04-23 17:44:17 +01:00
Niels Dossche
285c9f0dca
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix DOM tests for upcoming libxml2 serializer changes
2025-04-23 18:30:05 +02:00
Niels Dossche
94b58239e8
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix DOM tests for upcoming libxml2 serializer changes
2025-04-23 18:30:00 +02:00
Tim Düsterhus
00affe43aa
fileinfo: Show libmagic version with . in PHPInfo output (#18399)
This makes the output in PHPInfo a little more readable.
2025-04-23 16:21:13 +02:00
Tim Düsterhus
7e15a07fea
fileinfo: Remove php_fileinfo struct (#18398)
* fileinfo: Remove `php_fileinfo` struct

This is just a needless layer of indirection and requires an additional
allocation.

* fileinfo: Remove options field from `finfo_object`

This was only required to restore the original options when options are given
for `finfo_file()` or `finfo_buffer()`. This can more reliably be achieved
using `magic_getflags()` and is therefore redundant.

* fileinfo: Preserve error for uninitialized `finfo` objects
2025-04-23 12:04:10 +02:00
Saki Takamachi
acd4b81cc9
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] NEWS for #18317
2025-04-23 18:36:53 +09:00
Saki Takamachi
2bba3dc3b5
[skip ci] NEWS for #18317 2025-04-23 18:36:45 +09:00
Ilija Tovilo
d36699624b
Merge branch 'PHP-8.4'
* PHP-8.4:
  backporting C++17 detection support for recent icu4c releases.
  Drop tidyp from FreeBSD build
2025-04-23 11:01:48 +02:00
Ilija Tovilo
f2db594567
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  backporting C++17 detection support for recent icu4c releases.
  Drop tidyp from FreeBSD build
2025-04-23 11:01:40 +02:00
Saki Takamachi
7ac1b0c917
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] NEWS for #18317
2025-04-23 09:32:11 +09:00
Saki Takamachi
8f8accf9fb
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [skip ci] NEWS for #18317
2025-04-23 09:31:56 +09:00
David CARLIER
5189450500
ext/intl: Locale::* methods using param as path whenever relevant. (#18365)
close GH-18365
2025-04-22 23:39:05 +01:00
Tim Düsterhus
6adbe84120
Merge branch 'PHP-8.4'
* PHP-8.4:
  fileinfo: Fix cleanup in ext/fileinfo/tests/cve-2014-1943-mb.phpt (#18397)
2025-04-22 22:25:43 +02:00
Tim Düsterhus
d5717d25cd
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  fileinfo: Fix cleanup in ext/fileinfo/tests/cve-2014-1943-mb.phpt (#18397)
2025-04-22 22:25:04 +02:00
Tim Düsterhus
b6bbd80212
[skip ci] Formatting in UPGRADING 2025-04-22 20:33:03 +02:00
Tim Düsterhus
54a0a7924a
fileinfo: Change return type of finfo_close() to true (#18395)
This function is a noop and always returns `true`.
2025-04-22 20:18:08 +02:00
Niels Dossche
68794e074b Use RETURN_NEW_STR() in url.c
This avoids an extra branch.
2025-04-22 18:41:45 +02:00
Niels Dossche
1b4bca605c Add assertion as optimization hint in php_url_encode_impl()
This avoids the code bloat induced by zend_string_truncate().
2025-04-22 18:41:45 +02:00
Derick Rethans
7e1c8efa02
Merge branch 'PHP-8.4' 2025-04-22 17:11:32 +01:00
Derick Rethans
d54aee5b0c
Merge branch 'PHP-8.3' into PHP-8.4 2025-04-22 17:11:15 +01:00
Pierrick Charron
c29daa63ae
Merge branch 'PHP-8.4'
* PHP-8.4:
  PHP-8.4 is now for PHP 8.4.8-dev
2025-04-22 12:08:10 -04:00
Pierrick Charron
aa7aafa5d9
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  PHP-8.3 is now for PHP 8.3.22-dev
2025-04-22 12:05:31 -04:00
Ilija Tovilo
03d2226f45
Fix self inheritance type checks for traits
Fixes GH-18295
Closes GH-18296
2025-04-22 17:52:43 +02:00
Ilija Tovilo
c97bdce962
Evaluate const expression cast at ct if possible
Related to GH-18264
Closes GH-18347
2025-04-22 17:49:33 +02:00
Eric Mann
27b83e3095
Change RC downloads scp instructions as per the new jump box documentation 2025-04-22 06:26:19 -07:00
Saki Takamachi
33b977e36b
PHP-8.4 is now for PHP 8.4.8-dev 2025-04-22 22:23:08 +09:00
Eric Mann
73bfd3d0eb
Merge branch 'PHP-8.3' 2025-04-22 06:11:16 -07:00
David CARLIER
32a45769d1
ext/calendar: array optimisations. (#18388)
turn arrays to packed when applied/pre-allocate sizes.
2025-04-21 20:49:21 +01:00
David CARLIER
b233c55b12
ext/curl: curl_getinfo, curl_multi_get_handles and curl_multi_setopt array optimisations. (#18389)
mainly change to packed arrays.
2025-04-21 17:13:57 +01:00
David CARLIER
3b387ef274
ext/standard: stream_get_filters() user filters list as packed arrays. (#18384) 2025-04-21 17:03:35 +01:00
Niels Dossche
c15cacc902
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix uouv in pg_put_copy_end()
2025-04-21 17:47:55 +02:00
Niels Dossche
4621423e5e
Fix uouv in pg_put_copy_end()
Closes GH-18383.
2025-04-21 17:47:37 +02:00
David CARLIER
bd8c770439
ext/sqlite3: querySingle amd fetchArray methods optimisations. (#18385)
pre-allocated size for the former and packed array.
2025-04-21 16:37:34 +01:00
David CARLIER
df39586a88
ext/zlib: gzfile() files list as packed array (#18380) 2025-04-21 14:47:52 +01:00
David CARLIER
0c2025cdc4
ext/tidy: array optimisations, children node arrays as packed. (#18375) 2025-04-21 13:47:53 +01:00
David CARLIER
8f6bc97a36
ext/pgsql: pg_fetch_all_columns/pg_copy_to arrays optimisations. (#18374)
changes to packed arrays for output userland values.
2025-04-21 13:43:44 +01:00
Niels Dossche
23e9d8bd88
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix some leaks in php_scandir
2025-04-21 13:21:18 +02:00
Niels Dossche
29a5adc6af
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix some leaks in php_scandir
2025-04-21 13:21:12 +02:00
Niels Dossche
864ad1b5bb
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-18136: tracing JIT floating point register clobbering on Windows and ARM64
2025-04-21 13:15:50 +02:00
Niels Dossche
1a1a83f1fc
Fix GH-18136: tracing JIT floating point register clobbering on Windows and ARM64
On win64, xmm6-xmm15 are preserved registers, but the prologues and
epilogues of JITted code don't handle these. The issue occurs when
calling into the JIT code again via an internal handler
(like call_user_func). Therefore, we want to save/restore xmm registers
upon entering/leaving execute_ex. Since MSVC x64 does not support inline
assembly, we create an assembly wrapper around the real execute_ex
function.
The alternative is to always save/restore these xmm registers into the
fixed call frame, but this causes unnecessary overhead.
The same issue occurs for ARM64 platforms for floating point register
8 to 15. However, there we can use inline asm to fix this.

Closes GH-18352.
2025-04-21 13:15:43 +02:00
David CARLIER
158181ff37
ext/pcntl: pcntl_sigprocmask/pcntl_getcpuaffinity to packed arrays. (#18369) 2025-04-20 23:23:56 +01:00
David CARLIER
b385e0dd2b
ext/posix: preallocate arrays and/or change to packed ones. (#18370) 2025-04-20 23:23:43 +01:00
David CARLIER
68d54030a1
ext/sockets: using array optimisations. (#18367)
mostly explicit packed arrays.
2025-04-20 19:34:11 +01:00
David CARLIER
2c3a2da48a
ext/gd: array supplied to user optimisations. (#18366)
explictly allocate packed arrays when it applies.
2025-04-20 17:30:12 +01:00
Niels Dossche
eeaa60f6fa
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix reference support for intltz_get_offset()
2025-04-20 14:24:02 +02:00
Niels Dossche
affffe1122
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix reference support for intltz_get_offset()
2025-04-20 14:23:56 +02:00
Niels Dossche
e9b01f202b Use pre-allocated array sizes and packed where possible in intl 2025-04-20 12:18:15 +02:00
Niels Dossche
68b904884b Factor out duplicated code 2025-04-20 12:17:50 +02:00
Niels Dossche
dc9039086c Avoid pointless refcounting in php_intl_idn_to_46() 2025-04-20 12:17:50 +02:00
Niels Dossche
f39c07a3bb DOM/XPath: Use RETURN_NEW_STR
These strings are newly allocated and can't be interned, so we can use
RETURN_NEW_STR.
2025-04-19 18:00:00 +02:00
Niels Dossche
35e96f621b DOM/XPath: Use ZSTR_LEN abstraction instead of direct member access 2025-04-19 18:00:00 +02:00
Niels Dossche
91a310e603
Get rid of separate DOM HashPosition member (#18354)
Besides the fact that this is only used for DOM_NODESET and thus makes
no sense of being on the iterator itself, it's also redundant now that
we have the index member.
2025-04-19 17:59:48 +02:00
David CARLIER
2e7df9e423
ext/gd: imagefilter* using overflow checks. (#18283)
Accept up to UINT_MAX * sizeof(int) colors.
2025-04-19 16:27:14 +01:00
Kamil Tekiela
25f4f7982c
Drop unused variables (#18023) 2025-04-19 13:26:09 +01:00
David Carlier
fcd0f72cdd
GH-18345: adding Locale::isRightToLeft.
Checks is the locale is written left to right.
It makes sure all the needed likely subtags are included (maximization)
then determines the direction by known matches.

close GH-18351
2025-04-19 10:23:03 +01:00
David CARLIER
ba83d5daeb
sapi/litespeed and ext/standard: Fix few build warnings. (#18265) 2025-04-19 10:18:53 +01:00
Saki Takamachi
23687672f3
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fixed GH-17383 - pdo_firebird: PDOException has wrong code and message since PHP 8.4 (#18072)
2025-04-19 14:11:35 +09:00
Saki Takamachi
685baf77df
Fixed GH-17383 - pdo_firebird: PDOException has wrong code and message since PHP 8.4 (#18072)
Closes #18072
Fixes #17383
2025-04-19 14:11:20 +09:00
Niels Dossche
8376904aeb
Implement GH-17321: Add setAuthorizer to Pdo\Sqlite (#17905) 2025-04-18 00:34:46 +02:00
Ilija Tovilo
87499e44f2
Fix use of magic const within const expr cast (GH-18338)
Fixes OSS-Fuzz #410939023
2025-04-16 20:00:40 +02:00
Niels Dossche
66d5cf8d2d
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix memory leak on error return of collation callback in pdo_sqlite
2025-04-16 13:52:34 +02:00
Niels Dossche
ce7304f909
Fix memory leak on error return of collation callback in pdo_sqlite
We should destroy it when it's not IS_LONG, not when it's IS_LONG.

Closes GH-18332.
2025-04-16 13:52:23 +02:00
Niels Dossche
2d3ac4e2ed
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix NULL deref on high modification key
2025-04-16 11:41:33 +02:00
Niels Dossche
bfa2cfc9ed
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix NULL deref on high modification key
2025-04-16 11:38:38 +02:00
Niels Dossche
b50f7c22c3
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix memory leak when handling a too long path in ZipArchive::addGlob()
  Fix uouv when handling empty options in ZipArchive::addGlob()
2025-04-16 10:46:23 +02:00
Niels Dossche
ecd2872cf4
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix memory leak when handling a too long path in ZipArchive::addGlob()
  Fix uouv when handling empty options in ZipArchive::addGlob()
2025-04-16 10:46:17 +02:00
Niels Dossche
ea387fcfb7
Avoid useless initializations of fci/fcc in array functions (#18273)
These cause cache misses due to global access, in phpstan
(notably the array_map).
Initializing these isn't necessary because ZPP initializes it for us.
Only for optional arguments do we need to be careful; for `array_filter`
we still reset the `fci` but not `fci_cache` because `fci` is not
necessarily set by ZPP but is conditionally used to access `fci_cache`.
2025-04-15 23:08:12 +02:00
Máté Kocsis
93a3256da8 Fix GH-18108 gen_stub: Using $this when not in object context 2025-04-15 20:56:11 +02:00
Arnaud Le Blanc
76d7c616bb
Pass opline as argument to opcode handlers in CALL VM
This changes the signature of opcode handlers in the CALL VM so that the opline
is passed directly via arguments. This reduces the number of memory operations
on EX(opline), and makes the CALL VM considerably faster.

Additionally, this unifies the CALL and HYBRID VMs a bit, as EX(opline) is now
handled in the same way in both VMs.

This is a part of GH-17849.

Currently we have two VMs:

 * HYBRID: Used when compiling with GCC. execute_data and opline are global
   register variables
 * CALL: Used when compiling with something else. execute_data is passed as
   opcode handler arg, but opline is passed via execute_data->opline
   (EX(opline)).

The Call VM looks like this:

    while (1) {
        ret = execute_data->opline->handler(execute_data);
        if (UNEXPECTED(ret != 0)) {
            if (ret > 0) { // returned by ZEND_VM_ENTER() / ZEND_VM_LEAVE()
                execute_data = EG(current_execute_data);
            } else {       // returned by ZEND_VM_RETURN()
                return;
            }
        }
    }

    // example op handler
    int ZEND_INIT_FCALL_SPEC_CONST_HANDLER(zend_execute_data *execute_data) {
        // load opline
        const zend_op *opline = execute_data->opline;

        // instruction execution

        // dispatch
        // ZEND_VM_NEXT_OPCODE():
        execute_data->opline++;
        return 0; // ZEND_VM_CONTINUE()
    }

Opcode handlers return a positive value to signal that the loop must load a
new execute_data from EG(current_execute_data), typically when entering
or leaving a function.

Here I make the following changes:

 * Pass opline as opcode handler argument
 * Return next opline from opcode handlers
 * ZEND_VM_ENTER / ZEND_VM_LEAVE return opline|(1<<0) to signal that
   execute_data must be reloaded from EG(current_execute_data)

This gives us:

    while (1) {
        opline = opline->handler(execute_data, opline);
        if (UNEXPECTED((uintptr_t) opline & ZEND_VM_ENTER_BIT) {
            opline = opline & ~ZEND_VM_ENTER_BIT;
            if (opline != 0) { // ZEND_VM_ENTER() / ZEND_VM_LEAVE()
                execute_data = EG(current_execute_data);
            } else {           // ZEND_VM_RETURN()
                return;
            }
        }
    }

    // example op handler
    const zend_op * ZEND_INIT_FCALL_SPEC_CONST_HANDLER(zend_execute_data *execute_data, const zend_op *opline) {
        // opline already loaded

        // instruction execution

        // dispatch
        // ZEND_VM_NEXT_OPCODE():
        return ++opline;
    }

bench.php is 23% faster on Linux / x86_64, 18% faster on MacOS / M1.

Symfony Demo is 2.8% faster.

When using the HYBRID VM, JIT'ed code stores execute_data/opline in two fixed
callee-saved registers and rarely touches EX(opline), just like the VM.

Since the registers are callee-saved, the JIT'ed code doesn't have to
save them before calling other functions, and can assume they always
contain execute_data/opline. The code also avoids saving/restoring them in
prologue/epilogue, as execute_ex takes care of that (JIT'ed code is called
exclusively from there).

The CALL VM can now use a fixed register for execute_data/opline as well, but
we can't rely on execute_ex to save the registers for us as it may use these
registers itself. So we have to save/restore the two registers in JIT'ed code
prologue/epilogue.

Closes GH-17952
2025-04-15 18:51:54 +02:00
Arnaud Le Blanc
49891d89fc
Merge branch 'PHP-8.4'
* PHP-8.4:
  Save opline in zend_jit_hot_func()
2025-04-15 14:11:53 +02:00
Florian Engelhardt
061b46e09d
Save opline in zend_jit_hot_func()
Closes GH-18289
2025-04-15 14:11:32 +02:00
Arnaud Le Blanc
b24addddb4
run-tests.php: Save STDIN section into a file (#18305)
When a test has an --STDIN-- or --PHPDBG-- section, save the section's content into a file, like we do for the other sections.

This makes it bit easier to reproduce these tests outside of run-tests.php.

This doesn't update the .sh file to pass the file as stdin to the program, yet. 

When using gdb, we can pass the file as stdin like this:

    gdb --args php
    (gdb) r test.php < test.stdin
2025-04-15 14:02:08 +02:00
Ilija Tovilo
16c4c066f4
Make empty_fcall_info and empty_fcall_info_cache macros
See https://github.com/php/php-src/pull/18273, a constant may cause
unnecessary cache misses.

Closes GH-18326
2025-04-15 12:51:10 +02:00
Saki Takamachi
3b87093bff
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fixed GH-18276 - persistent connection - "zend_mm_heap corrupted" with setAttribute() (#18280) Closes #18280 Fixes #18276
2025-04-15 09:07:06 +09:00
Saki Takamachi
0f5372dbaa
followup in master for #18280 (#18302)
Closes #18302
2025-04-15 09:06:38 +09:00
Saki Takamachi
bd9f03a336
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fixed GH-18276 - persistent connection - "zend_mm_heap corrupted" with setAttribute() (#18280) Closes #18280 Fixes #18276
2025-04-15 09:04:39 +09:00
hanshenrik
0a10f6db26
ext/pdo_sqlite - throw on null bytes / resolve GH-13952 (#18320)
fix a corruption issue where PDO::quote for SQLite would silently truncate
strings with null bytes in them, by throwing.

Fixes #13952
Closes #18320
2025-04-15 08:52:31 +09:00
Máté Kocsis
93ad8e8db2
Merge branch 'PHP-8.4'
* PHP-8.4:
  Mark ob_start callback parameter nullable
2025-04-14 22:36:51 +02:00
Máté Kocsis
691e009f97
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Mark ob_start callback parameter nullable
2025-04-14 22:36:14 +02:00
Tim Düsterhus
9ac8820fc9
zend_compile: Allow (void) in for’s initializer and loop expression (#18303)
* zend_compile: Allow `(void)` in for’s initializer and loop expression

The initializer and loop expression of a `for()` loop only accept expressions,
but they act like statements in spirit - their results are completely ignored.
Allow `(void)` there to allow suppressing `#[\NoDiscard]`, since there is no
semantic ambiguity of what `(void)` returns anyways.

Fixes php/php-src#18301

* zend_language_parser: Simplify `for()` grammar
2025-04-14 15:36:51 +02:00
Niels Dossche
89e5f6ca53
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-18322: SplObjectStorage debug handler mismanages memory
2025-04-14 14:11:40 +02:00
Niels Dossche
fc63a98f17
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-18322: SplObjectStorage debug handler mismanages memory
2025-04-14 14:11:35 +02:00
Niels Dossche
a142f10aa1
Don't evaluate GMP comparison multiple times (#18321)
ZEND_THREEWAY_COMPARE evaluates its operands multiple times.
2025-04-14 11:19:14 +02:00
Gina Peter Banyard
4eb8839037 ext/iconv: Use RETURN_BOOL() instead of if/else 2025-04-14 10:15:55 +01:00
Gina Peter Banyard
e1686aabf7 ext/iconv: Hardcode 0 for PHP_ICONV_ERR_SUCCESS value
Instead of relying on the zend_result SUCCESS value which doesn't have much to do with it here.
2025-04-14 10:15:55 +01:00
Gina Peter Banyard
2d3db4b594 ext/iconv: Use bool type instead of int type 2025-04-14 10:15:55 +01:00
Gina Peter Banyard
bba44fc3fe ext/iconv: Add const specifier 2025-04-14 10:15:55 +01:00
Gina Peter Banyard
ef180f1623 ext/iconv: Reduce scope of variables 2025-04-14 10:15:55 +01:00
Carlos Buenosvinos
c8b3328996
[skip ci] 8.2 branch is security fixes only (GH-18319)
Based on the explanation on https://www.php.net/supported-versions.php, 8.2 moved into security fixes only on 31 Dec 2024.
2025-04-13 16:29:33 +02:00
Niels Dossche
1684c52a88
Fix GlobIterator without constructor breaks count() (#18314)
As reported by OpenAI AARDVARK.
2025-04-12 09:59:56 +02:00
Niels Dossche
fd7ebd4d15
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix sxe test
2025-04-11 23:57:03 +02:00
Niels Dossche
7415dc4649
Fix sxe test 2025-04-11 23:56:57 +02:00
Gina Peter Banyard
c5edf94003
ext/gmp: Use zend_result type instead of int type 2025-04-11 22:53:20 +01:00
Niels Dossche
3ba725a556
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-18309: ipv6 filter integer overflow
  Fix GH-18304: Changing the properties of a DateInterval through dynamic properties triggers a SegFault
2025-04-11 23:36:42 +02:00
Niels Dossche
a019fbd970
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-18309: ipv6 filter integer overflow
  Fix GH-18304: Changing the properties of a DateInterval through dynamic properties triggers a SegFault
2025-04-11 23:36:12 +02:00
Niels Dossche
8c685faa64
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix potential leaks when writing to BIO fails
2025-04-11 21:04:24 +02:00
Niels Dossche
8a927c284d
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix potential leaks when writing to BIO fails
2025-04-11 21:02:59 +02:00
Niels Dossche
14853ea2f2
Fix reproducibility of test GH-17190
The test failure did not trigger for me when playing with the JIT code.
From the original issue report some INI settings were not set properly.
2025-04-11 17:54:28 +02:00
Niels Dossche
4a12a9f3e9
Fix GH-18294: assertion failure zend_jit_ir.c
The JIT helper `zend_jit_assign_op_to_typed_ref` expects a `zval*` as an
argument, so we have to store to the stack if OP1_DATA(=op3) is in a
register.

Closes GH-18299.
2025-04-11 17:54:19 +02:00
Niels Dossche
2f6c069296
Implement GH-18261: Allow cast to be used in constant expressions (#18264) 2025-04-11 17:53:43 +02:00
Niels Dossche
e11a47f18b
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix reproducibility of test GH-17190
  Fix GH-18294: assertion failure zend_jit_ir.c
2025-04-11 17:54:35 +02:00
Saki Takamachi
c927d24af6
ext/bcmath: Use const qualifiers appropriately (#18284) 2025-04-11 12:39:31 +09:00
DanielEScherzer
10b2754056
UPGRADING: fix typos and duplicated words 2025-04-10 12:04:50 -07:00
Remi Collet
f2cbc9b7c5
Merge branch 'PHP-8.4'
* PHP-8.4:
  [ci skip] fix news
  [ci skip] fix news
2025-04-10 17:22:03 +02:00
Remi Collet
94681850a1
[ci skip] fix news 2025-04-10 17:21:50 +02:00
Remi Collet
e41d1e4862
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [ci skip] fix news
2025-04-10 17:21:26 +02:00
Remi Collet
e65fbe1bb8
Merge branch 'PHP-8.4'
* PHP-8.4:
  NEWS for GH-17940
  NEWS for GH-17940
  Fix #17776 LDAP_OPT_X_TLS_REQUIRE_CERT can't be overridden
2025-04-10 17:14:21 +02:00
Remi Collet
b3a43ca7a4
NEWS for GH-17940 2025-04-10 17:14:03 +02:00
Remi Collet
bcee2af398
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  NEWS for GH-17940
  Fix #17776 LDAP_OPT_X_TLS_REQUIRE_CERT can't be overridden
2025-04-10 17:13:37 +02:00
Ayesh Karunaratne
787f26c882
UPGRADING: Add notice for the new NumberFormatter::CURRENCY constants 2025-04-09 14:20:45 +07:00
Ayesh Karunaratne
895905b85a ext/curl: Add CURLOPT_INFILESIZE_LARGE to UPGRADING 2025-04-09 14:12:14 +07:00
Ayesh Karunaratne
7fd51535a4 ext/curl: add tests for CURLOPT_INFILESIZE(_LARGE) 2025-04-09 14:12:14 +07:00
Oskar Stark
195467f014 [ext-curl] Add \CURLOPT_INFILESIZE_LARGE
This is my first PR on this repository and is based on:
* https://github.com/symfony/symfony/pull/59654/files#r1935358570

So feel free to close it :-)
2025-04-09 14:12:14 +07:00
Ayesh Karunaratne
c20b429a90 ext/intl: Add NumberFormatter::CURRENCY_ISO, PLURAL, STANDARD and CASH_CURRENCY
ICU 54 and 56 adds the following formatters[^1] for currency formatting:

 - `CURRENCY_ISO`[^2]: ISO currency code, e.g., "USD1.00"
 - `CURRENCY_PLURAL`[^3]: pluralized currency name, e.g., "1.00 US dollar" and "3.00 US dollars"
 - `CASH_CURRENCY`[^4]: currency symbol given CASH usage, e.g., "NT$3" instead of "NT$3.23"
 - `CURRENCY_STANDARD`[^5]: currency symbol, e.g., "$1.00", using non-accounting style for negative values (e.g. minus sign)

Ref: https://unicode-org.github.io/icu-docs/apidoc/dev/icu4c/unum_8h.html

This adds support for all four of them to ext/intl, along with tests.

[^1]: https://unicode-org.github.io/icu-docs/apidoc/dev/icu4c/unum_8h.html
[^2]: https://unicode-org.github.io/icu-docs/apidoc/dev/icu4c/unum_8h.html#a4eb4d3ff13bd506e7078b2be4052266daae232c48e579c727525855cd21571033
[^3]: https://unicode-org.github.io/icu-docs/apidoc/dev/icu4c/unum_8h.html#a4eb4d3ff13bd506e7078b2be4052266da3916bb92d0784396ea2331d4f04c03f5
[^4]: https://unicode-org.github.io/icu-docs/apidoc/dev/icu4c/unum_8h.html#a4eb4d3ff13bd506e7078b2be4052266da8da9eba1a27d5734599709c137c3b82f
[^5]: https://unicode-org.github.io/icu-docs/apidoc/dev/icu4c/unum_8h.html#a4eb4d3ff13bd506e7078b2be4052266dac57cfff1b245d11774e8b109b98eedc2
2025-04-09 05:39:20 +07:00
David CARLIER
2d39c7855a
Fixed GH-18267 finfo_file() crashing on invalid URL protocol. (#18269)
Close GH-18267
2025-04-08 22:43:11 +01:00
Ilija Tovilo
aa0c54dade
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix prop info fetching from prop slot with added hooks
2025-04-08 18:46:01 +02:00
Ilija Tovilo
6d458caefe
Fix prop info fetching from prop slot with added hooks
Fixes GH-18268
Closes GH-18271
2025-04-08 18:45:26 +02:00
Jakub Zelenka
2194ad81f4
Make further OpenSSL 1.0.2 clean up
Closes GH-18133
2025-04-08 18:06:56 +02:00
Tim Düsterhus
f14697416e
ext/standard: Remove #[\NoDiscard] from flock() (#18255)
Co-authored-by: Volker Dusch <volker@tideways-gmbh.com>
2025-04-08 14:23:03 +02:00
Niels Dossche
a32f491855
Remove cache slot from ZEND_VERIFY_TYPE and arg RECV opcodes (#18258) 2025-04-07 19:50:48 +02:00
acc987
bd4333447e
Add OffsetTime* Exif tags
Closes GH-18237.
2025-04-07 18:47:06 +02:00
Gina Peter Banyard
213949dc34
Merge branch 'PHP-8.4'
* PHP-8.4:
  ext/libxml: Fixed custom external entity loader returning an invalid resource leading to a confusing TypeError message
2025-04-07 13:01:52 +01:00
Gina Peter Banyard
1e9e397122
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  ext/libxml: Fixed custom external entity loader returning an invalid resource leading to a confusing TypeError message
2025-04-07 12:59:57 +01:00
Gina Peter Banyard
71da944c82 Zend: Add MUTABLE zend_type foreach macros and const qualifiers
The motivation for this is that types should be considered immutable.
The only times this is not valid is during compilation, optimizations (opcache), or destruction.

Therefore the "normal" type foreach macros are marked to take const arguments and we add mutable version that say so in the name.
Thus add various const qualifiers to communicate intent.
2025-04-07 12:52:40 +01:00
Tim Düsterhus
ea6f2fbe92
[skip ci] Request the output of php -v in the bug_report.yml issue template (#18230)
The output of `php -v` immediately shows whether OPcache is loaded and whether
PHP is a NTS/ZTS and Debug/Release build.
2025-04-07 10:51:30 +02:00
Tim Düsterhus
633400bb56
mysqlnd: Make st_mysqlnd_stats.values a dynamic struct member (#18246)
This avoids another separate allocation.
2025-04-06 18:56:57 +02:00
David Carlier
ac9392b855
Merge branch 'PHP-8.4' 2025-04-05 18:33:12 +01:00
David Carlier
fed948dbd4
Fixed GH-18247: dba_popen() memory leak on invalid path.
and a handful more error code paths.

close GH-18250
2025-04-05 18:29:24 +01:00
Gina Peter Banyard
7a7b388401 ext/gd: Move FREETYPE defines into the ifdef 2025-04-05 18:12:21 +01:00
Gina Peter Banyard
b647716199 ext/gd: Use RETURN_BOOL() where applicable
Instead of an if/else
2025-04-05 18:12:21 +01:00
Gina Peter Banyard
be93f29f2f ext/gd: Reduce scope of variables 2025-04-05 18:12:21 +01:00
Gina Peter Banyard
9491c6850b ext/gd: Use uint32_t type instead of int type 2025-04-05 18:12:21 +01:00
Gina Peter Banyard
80ea28e918 ext/gd: Remove useless ext/standard header include 2025-04-05 18:12:21 +01:00
Gina Peter Banyard
b535a54f5f ext/gd: Mark return types as true instead of bool 2025-04-05 18:12:21 +01:00
Niels Dossche
404059f018
[ci skip] UPGRADING: Performance updates 2025-04-05 17:04:14 +02:00
David Carlier
abf6f8be71
Merge branch 'PHP-8.4' 2025-04-05 15:57:59 +01:00
David Carlier
471995c5f7
Merge branch 'PHP-8.3' into PHP-8.4 2025-04-05 15:57:26 +01:00
Gina Peter Banyard
462b170a30 Zend/zend_inheritance: Use bool instead of uint32_t 2025-04-05 15:47:51 +01:00
Gina Peter Banyard
dcf664963f Zend/zend_inheritance: Add some const modifiers 2025-04-05 15:47:51 +01:00
Gina Peter Banyard
10c9e4decf Zend/zend_inheritance: Reduce scope of variables
Fix some types at the same time
2025-04-05 15:47:51 +01:00
Gina Peter Banyard
1304719aae Zend/zend_inheritance: Prevent variable shadowing 2025-04-05 15:47:51 +01:00
Niels Dossche
d80682e753
Avoid allocation in zend_enum_get_case_cstr() (#18239)
Future uses of this internal API are planned, and we can easily avoid an
allocation by factoring out the common code.
2025-04-04 18:02:47 +02:00
Gina Peter Banyard
bda9ff8338
ext/gd: Flip size and nb arguments for safe_emalloc()
The size should be the second one
2025-04-04 15:12:06 +01:00
Gina Peter Banyard
68665d3cb5 ext/standard/dir.c: Use new PHP_Z_PARAM_STREAM_OR_NULL() ZPP specifier 2025-04-03 23:18:21 +01:00
Gina Peter Banyard
4101a8c099 ext/standard/dir.c: Refactor implementation of Directory and dir functions 2025-04-03 23:18:21 +01:00
Gina Peter Banyard
2c326d8222 ext/standard: Add Directory test with messed up internal state 2025-04-03 23:18:21 +01:00
Gina Peter Banyard
8033b058a9 ext/ftp: Remove output field of ftpbuf_t struct
It was only used once, and removing it reduces the size of a userland FTP object by 4096 bytes
2025-04-03 22:47:13 +01:00
Gina Peter Banyard
1dd788acdc ext/ftp: Change return type of ftp_set_option() to true
It either returns true or throws an Error
2025-04-03 22:47:13 +01:00
Gina Peter Banyard
c8559648fa [skip ci] ext/ftp: Fix typos 2025-04-03 22:47:13 +01:00
Gina Peter Banyard
96cf1b5a9f ext/ftp: Use size_t type instead of int type 2025-04-03 22:47:13 +01:00
Gina Peter Banyard
7fcdf1cfa2 ext/ftp: Use zend_result type instead of int type 2025-04-03 22:47:13 +01:00
Gina Peter Banyard
169573bcb5 ext/ftp: Use bool type instead of int type 2025-04-03 22:47:13 +01:00
Gina Peter Banyard
114a8ffb9d ext/ftp: Mark static functions as such
Removing missleading comment
2025-04-03 22:47:13 +01:00
Gina Peter Banyard
51fa97fb44 ext/ftp: Normalize coding style 2025-04-03 22:47:13 +01:00
Gina Peter Banyard
7fb8db014e ext/ftp: Voidify ftp_close() 2025-04-03 22:47:13 +01:00
Gina Peter Banyard
fabee4e244 ext/fileinfo: Separate implementations of functions
Instead of relying on a "god" function
2025-04-03 19:06:47 +01:00
Gina Peter Banyard
3d41cb012a ext/fileinfo: Use magic_setflags() directly
The only way this function returns -1 is if:
> magic_setflags() returns -1 on systems that don't support utime(3), or utimes(2) when MAGIC_PRESERVE_ATIME is set.

This is extremely unlikely and if this would happen we currently have a return type violation.
2025-04-03 19:06:47 +01:00
Ilija Tovilo
8c266e8f3c
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Restrict on-push freebsd build to main repo
2025-04-03 13:03:46 +02:00
Ilija Tovilo
90fd764cd8
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [skip ci] Restrict on-push freebsd build to main repo
2025-04-03 13:03:34 +02:00
Ilija Tovilo
8f67130e9e
[skip ci] Move opcode dumping test to ext/opcache/tests
This test breaks with file cache, because the file isn't compiled. Tests
in ext/opcache/tests are automatically skipped with file cache, hence
circumventing this issue.
2025-04-03 12:58:55 +02:00
Ilija Tovilo
ec35f534c6
[skip ci] Fix varying tmps count in nodiscard test 2025-04-03 12:50:57 +02:00
Niels Dossche
f4954df0c9
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix resource leak in iptcembed() on error
2025-04-02 21:06:35 +02:00
Niels Dossche
f4c594bfc6
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix resource leak in iptcembed() on error
2025-04-02 21:06:28 +02:00
Niels Dossche
5a19e25347
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix inverted call to php_openssl_store_errors()
  Fix openssl_random_pseudo_bytes() always setting strong_result to true
2025-04-02 20:30:44 +02:00
Niels Dossche
a6e76ac010
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix inverted call to php_openssl_store_errors()
  Fix openssl_random_pseudo_bytes() always setting strong_result to true
2025-04-02 20:25:32 +02:00
Niels Dossche
a39725b793
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix memory leak in openssl_sign() when passing invalid algorithm
2025-04-02 20:24:13 +02:00
Niels Dossche
d689ff63e8
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix memory leak in openssl_sign() when passing invalid algorithm
2025-04-02 20:18:57 +02:00
Niels Dossche
c10afa9643
Simplify curl gc handlers (#18227)
Since these objects are final and have no dynamic properties, we don't
have to build a property table.
2025-04-02 17:33:02 +02:00
Ilija Tovilo
1f6fdde646
Implement asymmetric visibility for static properties
https://wiki.php.net/rfc/static-aviz

Optimally, this would be moved to zend_fetch_static_property_address(). However,
this isn't currently effective for opcache, because R and RW/W/UNSET cache slots
are merged. This will circumvent the visibility check if the cache is primed by
a R instruction.

Closes GH-16486
2025-04-02 16:56:11 +02:00
Dmitry Stogov
cb3bca249a
Merge branch 'PHP-8.4'
* PHP-8.4:
  Update IR
2025-04-02 16:20:49 +03:00
Dmitry Stogov
79dc7a2d26
Update IR
IR commit: 8d17022fb61ebfed9f6be81a8182ea31202697ed
2025-04-02 16:20:09 +03:00
David Carlier
8846e9376c
Merge branch 'PHP-8.4' 2025-04-02 12:36:17 +01:00
David Carlier
dc93f28381
Merge branch 'PHP-8.3' into PHP-8.4 2025-04-02 12:36:08 +01:00
Luis Carilla Ternero
02d58faad4
GDB: replace match statements with if statements in gdb debug script so it works with lower versions (#18226) 2025-04-02 11:56:16 +02:00
Tim Düsterhus
a9d4b49252
Fix path for main/debug_gdb_scripts.c in .gitattributes
The previous path `main/gdb_inlined_script.c` never existed in any commit
merged to master.

see 46b6ad6dae
2025-04-02 10:38:28 +02:00
Tim Düsterhus
169a6c63f0
zend_execute: Remove useless refcounting in get_deprecation_suffix_from_attribute() (#18229) 2025-04-02 09:37:00 +02:00
Tim Düsterhus
5544be7018
RFC: Marking return values as important (#[\NoDiscard]) (#17599)
RFC: https://wiki.php.net/rfc/marking_return_value_as_important

Co-authored-by: Volker Dusch <volker@tideways-gmbh.com>
2025-04-02 09:35:29 +02:00
Gina Peter Banyard
f11c22ae30 ext/filter: Use bool instead of int where applicable
This makes it easier to reason about the code
2025-04-02 02:20:16 +01:00
Gina Peter Banyard
fa511dff45 ext/filter: Mark literal as static const 2025-04-02 02:20:16 +01:00
Gina Peter Banyard
7cc47082d6 ext/filter: Use zend_string* instead of a char* + size_t pair 2025-04-02 02:20:16 +01:00
Gina Peter Banyard
0e682ad692 ext/filter: Add const qualifiers 2025-04-02 02:20:16 +01:00
Gina Peter Banyard
53bced39fb ext/filter: Reduce scope of variables 2025-04-02 02:20:16 +01:00
Gina Peter Banyard
5cbfb6966a ext/filter: Remove unused parameters 2025-04-02 02:20:16 +01:00
Gina Peter Banyard
38ecfc54c6 ext/filter: Remove dead code about session globals 2025-04-02 02:20:16 +01:00
Ilija Tovilo
011795bcbe
Bind traits before parent class
This more accurately matches the "copy & paste" semantics described in
the documentation. Abstract trait methods diverge from this behavior,
given that a parent method can satisfy trait methods used in the child.
In that case, the method is not copied, but the check is performed after
the parent has been bound.

Fixes GH-15753
Fixes GH-16198
Close GH-15878
2025-04-01 18:20:02 +02:00
Ilija Tovilo
2ede200967
[skip ci] Drop Zend/tests/traits/error_001.phpt
The test doesn't test what it says it does. And depending on what it is
actually trying to test, it is redundant with either
Zend/tests/traits/error_009.phpt, Zend/tests/traits/error_010.phpt or
Zend/tests/traits/language015.phpt.
2025-04-01 17:11:58 +02:00
Ilija Tovilo
e4e663ced4
Merge branch 'PHP-8.4'
* PHP-8.4:
  Use-after-free in extract() with EXTR_REFS
2025-04-01 16:34:41 +02:00
Ilija Tovilo
3ffb310fbd
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Use-after-free in extract() with EXTR_REFS
2025-04-01 16:34:33 +02:00
John Bampton
4e44efaccb
docs: fix spelling in stubs.rst (GH-18220) 2025-04-01 12:51:02 +02:00
Niels Dossche
13e0fb92b4
Merge branch 'PHP-8.4'
* PHP-8.4:
  Add missing EXTENSIONS section to intl test
2025-03-31 23:05:29 +02:00
Niels Dossche
93826d9556
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Add missing EXTENSIONS section to intl test
2025-03-31 23:05:23 +02:00
Ilija Tovilo
a6aacd851b
Remove static __invoke() handling in zend_std_get_closure()
Static __invoke() is disallowed since PHP 8.0.

Closes GH-18171
2025-03-31 22:14:13 +02:00
DanielEScherzer
ce3d1cd5cb
Fix typo in ReflectionParameter::getName() description [skip ci] 2025-03-31 11:15:26 -07:00
Niels Dossche
3aebbc5330
Merge branch 'PHP-8.4'
* PHP-8.4:
  Address deprecated PHP 8.4 session options to prevent test failures
2025-03-31 20:07:39 +02:00
William Varmus
aa7c8a9de0
Address deprecated PHP 8.4 session options to prevent test failures
Closes GH-18179.
2025-03-31 20:05:27 +02:00
Michael Voříšek
355700c904
Remove PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK from pcre compile options
This option is semi-deprecated [1] and shouldn't influence much anyway.
The anticipated BC break is low.

[1] https://github.com/PCRE2Project/pcre2/issues/736#issuecomment-2753974366
[2] https://github.com/PCRE2Project/pcre2/issues/736#issuecomment-2754110610

Closes GH-18150.
2025-03-31 20:01:45 +02:00
Niels Dossche
d20e3e6cb1
Simplify handling of inheritance in SplFixedArray
After the loop, `parent` will for sure be ce_SplFixedArray, and
inherited will be true; for inherited cases.
2025-03-31 19:39:32 +02:00
Niels Dossche
9e52d1698a
Use specialised functions in SplFixedArray dimension handlers
This is more efficient than manually dealing with a garbage copy.
2025-03-31 19:38:40 +02:00
Gina Peter Banyard
5a4c460329 ext/ffi: Add comment about why a function was manually optimized 2025-03-31 17:03:48 +01:00
Gina Peter Banyard
f7a7e1c9ad ext/ffi: Add const specifiers 2025-03-31 17:03:48 +01:00
Gina Peter Banyard
4059df0f2f ext/ffi: Reduce scope of variables 2025-03-31 17:03:48 +01:00
Gina Peter Banyard
e579477490 ext/ffi: Prevent variable shadowing 2025-03-31 17:03:48 +01:00
Gina Peter Banyard
2ca0c2fd10 ext/ffi: Use 64bit integer to hold array length 2025-03-31 17:03:48 +01:00
Gina Peter Banyard
73a31979e2 ext/ffi: Prevent signed to unsigned comparisons 2025-03-31 17:03:48 +01:00
Gina Peter Banyard
6cd3863cf6 ext/ffi: Remove duplicate assignment 2025-03-31 17:03:48 +01:00
Arnaud Le Blanc
cb245411b0
Add runtime-enabled heap debugging capabilities (#18172)
Debugging memory corruption issues in production can be difficult when it's not possible to use a debug build or ASAN/MSAN/Valgrind (e.g. for performance reasons).

This change makes it possible to enable some basic heap debugging helpers without rebuilding PHP. This is controlled by the environment variable ZEND_MM_DEBUG. The env var takes a comma-separated list of parameters:

- poison_free=byte: Override freed blocks with the specified byte value (represented as a number)
- poison_alloc=byte: Override newly allocated blocks with the specified byte value (represented as a number)
- padding=bytes: Pad allocated blocks with the specified amount of bytes (if non-zero, a value >= 16 is recommended to not break alignments) 
- check_freelists_on_shutdown=0|1: Enable checking freelist consistency [1] on shutdown

Example:

    ZEND_MM_DEBUG=poison_free=0xbe,poison_alloc=0xeb,padding=16,check_freelists_on_shutdown=1 php ...

This is implemented by installing custom handlers when ZEND_MM_DEBUG is set.

This has zero overhead when ZEND_MM_DEBUG is not set. When ZEND_MM_DEBUG is set, the overhead is about 8.5% on the Symfony Demo benchmark.

Goals:

 - Crash earlier after a memory corruption, to extract a useful backtrace
 - Be usable in production with reasonable overhead
 - Having zero overhead when not enabled

Non-goals:

 - Replace debug builds, valgrind, ASAN, MSAN or other sanitizers

[1] https://github.com/php/php-src/pull/14054

Co-authored-by: Tim Düsterhus <timwolla@googlemail.com>
2025-03-31 17:24:42 +02:00
David Carlier
334d9bbc09
ext/pgsql: adding pg_service() alongside other connection infos.
returns the ongoing name of the service, if there is.
available since postgres 18

close GH-18198
2025-03-30 21:45:16 +01:00
Gina Peter Banyard
2244810dcf main/streams: Add a new helper function to get a php_stream from a zval without errors
This is intended to replace the few manual usages of zend_fetch_resource2_ex() to fetch a php_stream from a zval.
This will simplify the conversion from resource to object for streams when this actually happens.
2025-03-30 19:35:05 +01:00
Gina Peter Banyard
908490764b main/streams: Add a helper macro to retrieve default context 2025-03-30 19:35:05 +01:00
Gina Peter Banyard
5544a77f77 Move definition of php_le_stream_context
From ext/standard/file.h to main/streams/php_stream_context.h
This reduces some dependency of main/ on ext/standard
2025-03-30 19:35:05 +01:00
Niels Dossche
e034b69fa6
Optimize SplFixedArray::fromArray() for packed arrays (#18196)
If the array is packed, then we don't have to loop to get the highest
index.

For this script:
```php
$array = range(1, 100);
for ($i=0;$i<1000000;$i++) {
    SplFixedArray::fromArray($array);
}
```

On an i7-4790:
```
Benchmark 1: ./sapi/cli/php spl.php
  Time (mean ± σ):     376.5 ms ±   2.0 ms    [User: 372.1 ms, System: 2.6 ms]
  Range (min … max):   373.7 ms … 379.5 ms    10 runs

Benchmark 2: ./sapi/cli/php_old spl.php
  Time (mean ± σ):     511.6 ms ±   1.9 ms    [User: 508.0 ms, System: 2.3 ms]
  Range (min … max):   509.2 ms … 515.1 ms    10 runs

Summary
  ./sapi/cli/php spl.php  ran
    1.36 ± 0.01 times faster than ./sapi/cli/php_old spl.php
```

On an i7-1185G7:
```
Benchmark 1: ./sapi/cli/php spl.php
  Time (mean ± σ):     250.4 ms ±   3.5 ms    [User: 246.6 ms, System: 2.6 ms]
  Range (min … max):   247.0 ms … 258.5 ms    11 runs

Benchmark 2: ./sapi/cli/php_old spl.php
  Time (mean ± σ):     328.4 ms ±   1.0 ms    [User: 324.4 ms, System: 3.8 ms]
  Range (min … max):   327.5 ms … 331.0 ms    10 runs

Summary
  ./sapi/cli/php spl.php  ran
    1.31 ± 0.02 times faster than ./sapi/cli/php_old spl.php
```

Bonus: this also decreases the code size of the function.
2025-03-30 20:07:49 +02:00
Niels Dossche
f056636086
Avoid rebuilding the property table when possible in SplFixedArray's gc handler (#18195)
If there is not yet a dynamic property, and there are no class properties,
then we know that we don't have to build a properties table.

For this (micro-bench) script:
```php
function x() {
    $fa = new SplFixedArray(1);
    $fa[0] = $fa;
}
for ($i=0;$i<1000000;$i++)
    x();
```

On an i7-4790:
```
Benchmark 1: ./sapi/cli/php spl.php
  Time (mean ± σ):     140.9 ms ±   1.2 ms    [User: 137.5 ms, System: 2.7 ms]
  Range (min … max):   138.9 ms … 144.9 ms    21 runs

Benchmark 2: ./sapi/cli/php_old spl.php
  Time (mean ± σ):     162.0 ms ±   3.8 ms    [User: 157.7 ms, System: 3.2 ms]
  Range (min … max):   158.5 ms … 175.0 ms    17 runs

Summary
  ./sapi/cli/php spl.php  ran
    1.15 ± 0.03 times faster than ./sapi/cli/php_old spl.php
```
2025-03-30 18:36:38 +02:00
Niels Dossche
24fbe2d61e
Micro-optimizations to str_increment() and str_decrement() (#18193)
Since it's a new string we're returning we can use RETURN_NEW_STR() and
we can also use zend_string_efree() for the strings that we replace
because they have RC1.
2025-03-30 18:09:21 +02:00
Niels Dossche
ce5d2f6d01
Make SplFixedArray::jsonSerialize() an implementation alias of SplFixedArray::toArray() (#18191)
This reduces code duplication and can then use the optimized version.
2025-03-30 18:09:11 +02:00
Niels Dossche
d13d9b3c24
Optimize SplFixedArray::toArray() (#18190)
We can use the optimized packed filling code instead of going through
all the logic of the zend_hash update APIs.

For this script:
```php
$test = new SplFixedArray(4);
$test[0] = 0;
$test[1] = 1;
$test[2] = 2;
$test[3] = 3;

for ($i = 0 ; $i< 5000000; $i++)
	$test->toArray();
```

On an i7-4790:
```
Benchmark 1: ./sapi/cli/php toarray.php
  Time (mean ± σ):     170.0 ms ±   1.8 ms    [User: 167.3 ms, System: 2.2 ms]
  Range (min … max):   166.9 ms … 173.0 ms    17 runs

Benchmark 2: ./sapi/cli/php_old toarray.php
  Time (mean ± σ):     215.7 ms ±   3.6 ms    [User: 211.9 ms, System: 3.0 ms]
  Range (min … max):   211.3 ms … 222.0 ms    13 runs

Summary
  ./sapi/cli/php toarray.php ran
    1.27 ± 0.02 times faster than ./sapi/cli/php_old toarray.php
```

On an i7-1185G7:
```

Benchmark 1: ./sapi/cli/php toarray.php
  Time (mean ± σ):     112.6 ms ±   1.4 ms    [User: 109.6 ms, System: 2.9 ms]
  Range (min … max):   111.1 ms … 116.4 ms    25 runs

Benchmark 2: ./sapi/cli/php_old toarray.php
  Time (mean ± σ):     145.3 ms ±   2.8 ms    [User: 141.8 ms, System: 3.4 ms]
  Range (min … max):   142.6 ms … 151.8 ms    20 runs

Summary
  ./sapi/cli/php toarray.php  ran
    1.29 ± 0.03 times faster than ./sapi/cli/php_old toarray.php
```
2025-03-30 18:09:01 +02:00
David CARLIER
07470c3dd0
ext/pgsql: fix pg_close_stmt() signature. (#18194) 2025-03-30 15:38:10 +01:00
Niels Dossche
335c0b39a2
Optimize SplFixedArray dimension performance (#18184)
This patch optimizes reading and writing from SplFixedArray with the
dimension operators. It accomplishes this due to the following
optimizations:
* Fast-path for long keys (inlined).
* Optimization hints (UNEXPECTED + assertion)
* Using an unsigned index so we can do a single length comparison

For the following script:
```php
$test = new SplFixedArray(4);

for ($i = 0 ; $i< 5000000; $i++)
	$test[1] += $i;
```

On an i7-4790:
```
Benchmark 1: ./sapi/cli/php x.php
  Time (mean ± σ):      95.4 ms ±   1.6 ms    [User: 91.5 ms, System: 3.2 ms]
  Range (min … max):    93.7 ms … 100.8 ms    31 runs

Benchmark 2: ./sapi/cli/php_old x.php
  Time (mean ± σ):     119.1 ms ±   1.3 ms    [User: 114.7 ms, System: 3.6 ms]
  Range (min … max):   117.6 ms … 123.1 ms    24 runs

Summary
  ./sapi/cli/php x.php ran
    1.25 ± 0.03 times faster than ./sapi/cli/php_old x.php
```

On an i7-1185G7:
```
Benchmark 1: ./sapi/cli/php x.php
  Time (mean ± σ):      67.9 ms ±   1.1 ms    [User: 64.8 ms, System: 3.2 ms]
  Range (min … max):    66.6 ms …  72.8 ms    43 runs

Benchmark 2: ./sapi/cli/php_old x.php
  Time (mean ± σ):      84.8 ms ±   1.1 ms    [User: 81.0 ms, System: 3.9 ms]
  Range (min … max):    82.6 ms …  88.0 ms    34 runs

Summary
  ./sapi/cli/php x.php  ran
    1.25 ± 0.03 times faster than ./sapi/cli/php_old x.php
```
2025-03-30 13:16:33 +02:00
Niels Dossche
6e0b60cc8f
Remove pointless ZVAL_UNDEF() in isset path (#18187)
This will already be set to UNDEF by zend_call_function.
2025-03-30 13:00:09 +02:00
Niels Dossche
4a7332f4c6
Remove pointless operations from zend_user_serialize() (#18188)
We don't have to call zval_ptr_dtor() on IS_NULL, and we only have to
check for the UNDEF type.
Reduces code size from 231 to 199 on x86-64.
2025-03-30 11:18:15 +02:00
Ilija Tovilo
0607c22f8e
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Fix valgrind benchmark diff output
2025-03-30 00:45:09 +01:00
Ilija Tovilo
20324388a4
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [skip ci] Fix valgrind benchmark diff output
2025-03-30 00:45:03 +01:00
Niels Dossche
0733e453c7
Remove useless operations in namespace_compat (#18182)
We never use the return value, so we can avoid a double lookup and a
return.
2025-03-29 22:46:18 +01:00
Niels Dossche
d456d25a1c
Get rid of temporary in array_push (#18181)
This only makes a very very small improvement in performance, but the
code size on x86-64 decreases from 357 bytes to 296 bytes.
2025-03-29 22:46:08 +01:00
Niels Dossche
73c2e3cadc
Avoid pointless refcounting in array_reduce (#18180)
For this script:
```php
for ($i=0;$i < 100; $i++)
    array_reduce(range(1, 100000), fn ($a,$b)=>$a+$b,1);
```

On an i7-4790:
```
Benchmark 1: ./sapi/cli/php reduce_bench.php
  Time (mean ± σ):     272.0 ms ±   3.7 ms    [User: 268.9 ms, System: 2.1 ms]
  Range (min … max):   268.9 ms … 281.3 ms    11 runs

Benchmark 2: ./sapi/cli/php_old reduce_bench.php
  Time (mean ± σ):     288.2 ms ±   3.5 ms    [User: 284.5 ms, System: 2.7 ms]
  Range (min … max):   285.0 ms … 295.9 ms    10 runs

Summary
  ./sapi/cli/php reduce_bench.php  ran
    1.06 ± 0.02 times faster than ./sapi/cli/php_old reduce_bench.php
```

On an i7-1185G7:
```
Benchmark 1: ./sapi/cli/php test.php
  Time (mean ± σ): 189.6 ms ± 3.5 ms [User: 178.5 ms, System: 10.7 ms]
  Range (min … max): 187.3 ms … 201.6 ms 15 runs

Benchmark 2: ./sapi/cli/php_old test.php
  Time (mean ± σ): 204.2 ms ± 2.9 ms [User: 190.1 ms, System: 13.6 ms]
  Range (min … max): 200.6 ms … 210.2 ms 14 runs

Summary
  ./sapi/cli/php test.php ran
    1.08 ± 0.02 times faster than ./sapi/cli/php_old test.php
```
2025-03-29 22:45:57 +01:00
Tim Düsterhus
5dd9b0dcef
Add php_build_provider() (#18168)
* Add `ZEND_ATTRIBUTE_CONST` to php_version() and php_version_id()

* Add `php_build_provider()`

* Use `php_build_provider()` internally
2025-03-29 13:29:40 +01:00
Niels Dossche
314219387e
Improve performance of user-callbacked sort functions (#18166) 2025-03-29 01:02:17 +01:00
Gina Peter Banyard
50b976d716 ext/exif: Refactor implementation of exif_scan_FILE_header() 2025-03-28 18:39:15 +00:00
Gina Peter Banyard
aa92c70134 ext/exif: Reduce scope of variable 2025-03-28 18:39:15 +00:00
Gina Peter Banyard
64569d3b8a ext/exif: Add some const qualifiers 2025-03-28 18:39:15 +00:00
Gina Peter Banyard
96d41a67c5 ext/exif: Remove useless char* cast 2025-03-28 18:39:15 +00:00
Gina Peter Banyard
a04a5dbfb1 ext/exif: Use zend_str_has_nul_byte() API 2025-03-28 18:39:15 +00:00
Gina Peter Banyard
fbc84dd056 ext/exif: Voidify exif_discard_imageinfo()
This always returned true, and the return value was never checked anyway
2025-03-28 18:39:15 +00:00
Gina Peter Banyard
8a713c1e90 ext/exif: Voidify exif_file_sections_free()
This always returned true, and the return value was never checked anyway
2025-03-28 18:39:15 +00:00
David CARLIER
a5196bf3d6
ext/pdo_pgsql: updating copy from according to pgsql extension workflow. (#18175)
mainly using zend_string instead.
2025-03-28 18:24:45 +00:00
Niels Dossche
b6becada17 Implement packed fast-path for array_map() 2025-03-28 19:09:49 +01:00
Niels Dossche
fca36515b9 Improve performance of array_map()
The refcounting and destruction is not necessary because zend_call_function
will make a copy anyway. And zend_call_function only returns FAILURE if
EG(active) is false in which case array_map shouldn't have been called
in the first place.
2025-03-28 19:09:49 +01:00
David Carlier
18102ec708
Merge branch 'PHP-8.4' 2025-03-28 17:31:50 +00:00
David Carlier
3a5c87f964
Merge branch 'PHP-8.3' into PHP-8.4 2025-03-28 17:31:13 +00:00
Gina Peter Banyard
6ff9ca12d6 ext/date: Pack php_interval_obj
This reduces the size of the struct from 88 to 80 bytes.
2025-03-28 16:55:37 +00:00
Gina Peter Banyard
77c2fcf147 ext/date: Remove unused parameter 2025-03-28 16:55:37 +00:00
Gina Peter Banyard
8a3dbb0401 ext/date: Change return type of check_id_allowed from int to bool 2025-03-28 16:55:37 +00:00
Gina Peter Banyard
a4685d8b54 ext/date: Add const qualifiers 2025-03-28 16:55:37 +00:00
Gina Peter Banyard
c67e12e718 ext/date: Use Z_PARAM_ARRAY_HT instead of Z_PARAM_ARRAY 2025-03-28 16:55:37 +00:00
Niels Dossche
0943b8b7eb
Improve performance of array_find() etc (#18157)
This avoids destruction logic for the common case, avoids some copy, and
adds an optimization hint.

For this script:
```php
$array = range(1, 10000);

$result = 0;
for ($i = 0; $i < 5000; $i++) {
    $result += array_find($array, static function ($item) {
            return $item === 5000;
    });
}
var_dump($result);
```

On an intel i7 1185G7:
```
Benchmark 1: ./sapi/cli/php x.php
  Time (mean ± σ): 543.7 ms ± 3.8 ms [User: 538.9 ms, System: 4.4 ms]
  Range (min … max): 538.4 ms … 552.9 ms 10 runs

Benchmark 2: ./sapi/cli/php_old x.php
  Time (mean ± σ): 583.0 ms ± 4.2 ms [User: 578.4 ms, System: 3.4 ms]
  Range (min … max): 579.3 ms … 593.9 ms 10 runs

Summary
  ./sapi/cli/php x.php ran
    1.07 ± 0.01 times faster than ./sapi/cli/php_old x.php
```

On an intel i7 4790:
```
Benchmark 1: ./sapi/cli/php x.php
  Time (mean ± σ):     828.6 ms ±   4.8 ms    [User: 824.4 ms, System: 1.6 ms]
  Range (min … max):   822.8 ms … 839.0 ms    10 runs

Benchmark 2: ./sapi/cli/php_old x.php
  Time (mean ± σ):     940.1 ms ±  26.4 ms    [User: 934.4 ms, System: 2.5 ms]
  Range (min … max):   918.0 ms … 981.1 ms    10 runs

Summary
  ./sapi/cli/php x.php ran
    1.13 ± 0.03 times faster than ./sapi/cli/php_old x.php
```
2025-03-27 23:52:54 +01:00
Jakub Zelenka
370f24290f
[ci skip] Fix example and add NEWS merging info to release process (#18159) 2025-03-27 22:38:52 +01:00
Dmitry Stogov
fd454300b6
Merge branch 'PHP-8.4'
* PHP-8.4:
  Update IR
2025-03-27 22:25:11 +03:00
Dmitry Stogov
2b9840894d
Update IR
IR commit: dd228777b67334d8ed51de44f427d66d4ac99c08
2025-03-27 22:24:46 +03:00
Tim Düsterhus
cff76a98ae
zend_smart_string: Add smart_string_append_printf() (#18160)
This is for API parity with `smart_str_append_printf()`.
2025-03-27 20:15:25 +01:00
Arnaud Le Blanc
a519a03f63
Merge branch 'PHP-8.4'
* PHP-8.4:
  GDB: Import gdb.printing
2025-03-27 16:35:17 +01:00
Arnaud Le Blanc
9b96ea1a99
GDB: Import gdb.printing
gdb.printing is not imported by default since version 16, for some reason
2025-03-27 16:31:28 +01:00
Arnaud Le Blanc
6ab5a5b159
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix lazy proxy calling magic methods twice
2025-03-27 16:29:17 +01:00
Tim Düsterhus
3e8677e7e3
Add missing RFC link in UPGRADING [skip ci]
see 14fc50e732
2025-03-27 16:22:03 +01:00
Arnaud Le Blanc
26f5009e91
Fix lazy proxy calling magic methods twice
Fixes GH-18038
Closes GH-18039
2025-03-27 16:17:13 +01:00
Arnaud Le Blanc
14fc50e732
Add get_error_handler(), get_exception_handler() functions
RFC: https://wiki.php.net/rfc/get-error-exception-handler

Closes GH-17693
2025-03-27 16:11:46 +01:00
Jakub Zelenka
5e56c3e7bf
Merge branch 'PHP-8.4' 2025-03-27 12:12:28 +01:00
Jakub Zelenka
b6b9e475fa
Merge branch 'PHP-8.3' into PHP-8.4 2025-03-27 11:58:04 +01:00
Jakub Zelenka
916528e3f5
Merge branch 'PHP-8.4' 2025-03-27 11:38:17 +01:00
Jakub Zelenka
6cf24cd47c
Merge branch 'PHP-8.3' into PHP-8.4 2025-03-27 11:37:12 +01:00
Tim Düsterhus
45d1acf916
Zend: Fix reference counting for Closures in const-expr (#17853)
* Clean up closure static variable handling

* Zend: Fix reference counting for Closures in const-expr

Fixes php/php-src#17851

---------

Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com>
2025-03-27 10:11:44 +01:00
DanielEScherzer
0006522211
Reflection: optimize smart_str building
- When appending a single character to the string, use `smart_str_appendc()`
- When appending a C-string without printf use, use `smart_str_appends()`
- When appending just a `zend_string`, use `smart_str_append()`
2025-03-26 16:00:34 -07:00
Ilija Tovilo
99f72fa499
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix infinite recursion on deprecated attribute evaluation
2025-03-26 23:40:58 +01:00
Ilija Tovilo
272f7f75e2
Fix infinite recursion on deprecated attribute evaluation
Fixes GH-17711
Fixes GH-18022
Closes GH-17712
2025-03-26 23:39:38 +01:00
Ilija Tovilo
ab6e464ae2
Merge branch 'PHP-8.4'
* PHP-8.4:
  Implement benchmark diff commit fallback
2025-03-26 23:35:51 +01:00
Ilija Tovilo
5ea386d698
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Implement benchmark diff commit fallback
2025-03-26 23:35:44 +01:00
DanielEScherzer
36ae82b73e
NEWS/UPGRADING for GH-15956 2025-03-26 14:17:25 -07:00
Daniel Scherzer
4233394e8f ReflectionClass: show enums differently from classes
While internally enums are mostly the same as classes, their output in
`ReflectionClass::__toString()` should show the enum as the developer wrote it,
rather than as the engine stored it. Accordingly

- Say that the enum is an enum, not a final class

- Include the backing type, if any, in the declaration line

- List enum cases separately from constants, and show the underlying values, if
any

GH-15766
2025-03-26 13:45:25 -07:00
Daniel Scherzer
6c81f708c5 ReflectionClass: test enum output
In preparation for improving it, GH-15766
2025-03-26 13:45:25 -07:00
David Carlier
50bffd3284
Merge branch 'PHP-8.4' 2025-03-26 17:46:38 +00:00
David Carlier
9c6fe6b0ff
Fix GH-18148: pg_copy_from() wrong \n offset check.
Close GH-18149
2025-03-26 17:44:01 +00:00
Saki Takamachi
1ce79eb219
ext/bcmath: In the arm processor environment, NEON is used to use SIMD. (#18130) 2025-03-26 07:48:02 +09:00
Jakub Zelenka
b19a0a5dc3
Merge branch 'PHP-8.4' 2025-03-25 22:12:33 +01:00
Jakub Zelenka
e28f78ac55
Merge branch 'PHP-8.3' into PHP-8.4 2025-03-25 22:10:17 +01:00
Niels Dossche
7acce8a724
Avoid allocating temporaries on the call frame for property hook trampolines (#16287)
As pointed out in https://github.com/php/php-src/pull/16252#issuecomment-2396745309
2025-03-25 20:49:27 +01:00
Calvin Buckley
9d0c492d30
Bump for 8.4.7-dev 2025-03-25 16:38:46 -03:00
Daniel Scherzer
5c3cff2f25
Merge branch 'PHP-8.4'
* PHP-8.4:
  Add myself as ext/reflection codeowner [skip ci]
2025-03-25 11:23:29 -07:00
Daniel Scherzer
87d75328b2
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Add myself as ext/reflection codeowner [skip ci]
2025-03-25 11:21:17 -07:00
Jakub Zelenka
5ff8d6d0d2
Fix GH-17645: FPM with httpd ProxyPass does not decode script path
This changes make FPM always decode SCRIPT_FILENAME when Apache
ProxyPass or ProxyPassMatch is used. It also introduces a new INI
option fastcgi.script_path_encoded that allows using the previous
behavior of not decoding the path. The INI is introduced because
there is a chance that some users could use encoded file paths in
their file system as a workaround for the previous behavior.

Close GH-17896
2025-03-25 19:19:55 +01:00
Gina Peter Banyard
e1845365ea ext/enchant: Remove useless char* casts 2025-03-25 06:59:57 +00:00
Gina Peter Banyard
1fa11f17ff
ext/dba: Add const modifier for argument to php_dba_make_key() 2025-03-25 04:01:40 +00:00
Gina Peter Banyard
fec4f7f389 ext/standard/file: clarify fclose() warning 2025-03-24 22:54:34 +00:00
Gina Peter Banyard
556e4d9008 streams: Indicate which argument fails the stream ZPP check 2025-03-24 22:54:34 +00:00
DanielEScherzer
efa9e5fdd0
Add myself as ext/reflection maintainer [skip ci] 2025-03-24 11:49:26 -07:00
Tim Düsterhus
0e95233aa2 NEWS/UPGRADING 2025-03-24 19:35:30 +01:00
Tim Düsterhus
8779e2a603 Add (void) cast
RFC: https://wiki.php.net/rfc/marking_return_value_as_important
2025-03-24 19:35:30 +01:00
Ilija Tovilo
58968f6a22
Merge branch 'PHP-8.4'
* PHP-8.4:
  Backport intl test changes for ICU 77
2025-03-24 15:07:57 +01:00
Ilija Tovilo
72dab4a041
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Backport intl test changes for ICU 77
2025-03-24 15:07:49 +01:00
Derick Rethans
2d30c2e1ad
Updated to version 2025.2 (2025b) 2025-03-24 10:06:36 +00:00
Derick Rethans
bc3d56e7fd
Empty merge 2025-03-24 10:06:35 +00:00
Derick Rethans
22b2a579ba
Updated to version 2025.2 (2025b) 2025-03-24 10:06:34 +00:00
Derick Rethans
9e2593a7de
Empty merge 2025-03-24 10:06:33 +00:00
Gina Peter Banyard
345d229385
ext/dba: Reduce scope of dba_handler variables 2025-03-23 20:39:34 +00:00
Ilija Tovilo
076811af68
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix segfault when evaluating const expr default value of child prop with added hooks
2025-03-23 16:35:21 +01:00
Ilija Tovilo
d5bdf8f508
Fix segfault when evaluating const expr default value of child prop with added hooks
Introduced by GH-17870. Not adding a NEWS entry since this is fixed in
the same version.

Fixes oss-fuzz #403816122
Closes GH-18098
2025-03-23 16:35:04 +01:00
Ilija Tovilo
7d4ed8af03
Fix "expecting token" error for ampersand
Currently, this is only handled for the "unexpected token" part of the
message, but not the "expected" part.

Fixes GH-18026
Closes GH-18101
2025-03-23 16:26:30 +01:00
Tim Düsterhus
a28fb52719
zend_vm_def: Use FREE_OP1() in ZEND_FREE handler (#18131)
This is for consistency with other opcode handlers. It does not
have an effect on the generated VM.
2025-03-22 16:34:26 +01:00
Peter Kokot
8622362394
Remove unused strcasecmp definition (#17050)
The strcasecmp usage was removed via
dc5f3b9562.
2025-03-21 18:30:22 +01:00
Niels Dossche
19a8e69476
Merge branch 'PHP-8.4'
* PHP-8.4:
  [ci skip] Make sure opcache can output in these tests
2025-03-21 16:36:02 +01:00
Niels Dossche
7d1a2d03e4
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [ci skip] Make sure opcache can output in these tests
2025-03-21 16:35:57 +01:00
Niels Dossche
8d7cdbf427
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix intl tests for icu 77 (#18125)
2025-03-21 14:25:23 +01:00
Niels Dossche
fe7f9571d2
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix intl tests for icu 77 (#18125)
2025-03-21 14:25:18 +01:00
Gina Peter Banyard
484d528b40
ext/standard: Use usual not empty error for proc_open() (#18083) 2025-03-21 13:13:25 +00:00
Niels Dossche
bb265d2700
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-18107: Opcache CFG jmp optimization with try-finally breaks the exception table
2025-03-21 13:58:54 +01:00
Niels Dossche
d765b60778
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-18107: Opcache CFG jmp optimization with try-finally breaks the exception table
2025-03-21 13:57:16 +01:00
Niels Dossche
b233ed7e03
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17836: zend_vm_gen.php shouldn't break on Windows line endings
2025-03-21 11:51:11 +01:00
Niels Dossche
8d7cb8cc21
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17836: zend_vm_gen.php shouldn't break on Windows line endings
2025-03-21 11:51:05 +01:00
Niels Dossche
3dcf36c701
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fixed bug GH-13193 again
2025-03-21 11:48:22 +01:00
Niels Dossche
e98e4e39a3
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fixed bug GH-13193 again
2025-03-21 11:48:16 +01:00
Remi Collet
b17df7a07c
Merge branch 'PHP-8.4'
* PHP-8.4:
  NEWS for #66049
  NEWS for #66049
  Fix #66049 Typemap can break parsing in parse_packet_soap leading to a segfault
2025-03-21 08:26:04 +01:00
Remi Collet
58e4adcd63
NEWS for #66049 2025-03-21 08:25:49 +01:00
Remi Collet
1c230c27ec
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  NEWS for #66049
  Fix #66049 Typemap can break parsing in parse_packet_soap leading to a segfault
2025-03-21 08:25:23 +01:00
Niels Dossche
c4a79617a9
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix memory leak when destroying PDORow
2025-03-20 23:14:37 +01:00
Niels Dossche
0ef57501d9
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix memory leak when destroying PDORow
2025-03-20 23:14:14 +01:00
Niels Dossche
ead36985b3
Merge branch 'PHP-8.4'
* PHP-8.4:
  [ci skip] Fix NEWS order
2025-03-20 19:14:44 +01:00
Niels Dossche
7d8e1c6e0c
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [ci skip] Fix NEWS order
2025-03-20 19:14:14 +01:00
Niels Dossche
38d6d8542b
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-18112: NULL access with preloading and INI option
2025-03-20 19:12:53 +01:00
Niels Dossche
66498152f1
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-18112: NULL access with preloading and INI option
2025-03-20 19:12:47 +01:00
Niels Dossche
8598e55370
Merge branch 'PHP-8.4'
* PHP-8.4:
  Add test for GH-18113
2025-03-19 23:49:56 +01:00
Niels Dossche
9488684703
Add test for GH-18113
Fixed in https://github.com/dstogov/ir/pull/110 and merged via b932c267.

Closes GH-18113.
2025-03-19 23:49:43 +01:00
Niels Dossche
e1eeb483ef
Fix GH-18114: pdo lazy object crash (#18116)
Since 0537968, the properties are no longer initialized.
So we call object_properties_init to handle that correctly.
Lower branches have a memory leak, but that requires a separate fix.
2025-03-19 23:43:30 +01:00
Dmitry Stogov
7b069790ca
Merge branch 'PHP-8.4'
* PHP-8.4:
  Update IR
2025-03-20 01:11:33 +03:00
Dmitry Stogov
b932c267f8
Update IR
IR commit: 3d0124a06ee4321e1305f893b74840033d939e88
2025-03-20 01:10:56 +03:00
David CARLIER
d5251513b1
ext/pgsql: get_field_name helper, remove unused precaution for pg_type request. (#18025)
it is an internal table and oid is a real Oid (uint32_t) value.
2025-03-19 21:56:00 +00:00
Saki Takamachi
fb07c62f2c
ext/bcmath: Extracted common logic into function and macro (#18103) 2025-03-19 18:10:12 +09:00
Niels Dossche
b450a9c826
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix xinclude destruction of live attributes
2025-03-18 22:04:29 +01:00
Niels Dossche
2c45d67ad3
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix xinclude destruction of live attributes
2025-03-18 22:04:13 +01:00
Gina Peter Banyard
6329248217
Zend/hash: Add yet more const qualifiers (#18084) 2025-03-18 17:36:40 +00:00
Ilija Tovilo
57efcb9854
Fix new opcache dump format in test expectation 2025-03-18 14:22:14 +01:00
Ilija Tovilo
081ba38707
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix IN_ARRAY optimization
2025-03-18 13:43:12 +01:00
Ilija Tovilo
56841998de
Fix IN_ARRAY optimization
in_array() calls are compiled to frameless calls. Adjust the
optimization appropriately. Luckily, frameless opcodes simplify the
optimization quite a bit.

Fixes GH-18050
Closes GH-18066
2025-03-18 13:42:53 +01:00
Tim Düsterhus
747851724e
[skip ci] Update ext/random year for myself in EXTENSIONS 2025-03-17 20:41:10 +01:00
Niels Dossche
25f4510914
Merge JMP_FRAMELESS cache slots in Optimizer/compact_literals (#18093)
This avoids repeated lookups in the function table for the same
function name.
Although this optimization is observable, i.e. defining a function via
an include in between 2 JMP_FRAMELESS for the same function, this cannot
be relied on already as far as I know if the optimizer runs.
2025-03-17 20:11:39 +01:00
Niels Dossche
d7e2f288ed
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-18090: DOM: Svg attributes and tag names are being lowercased
2025-03-17 19:46:04 +01:00
Niels Dossche
647baec5a4
Fix GH-18090: DOM: Svg attributes and tag names are being lowercased
Closes GH-18091.
2025-03-17 19:45:50 +01:00
Niels Dossche
86a67fef48
Fix GH-12231: SimpleXML xpath should warn when returning other return types than node lists
Closes GH-18073.
2025-03-17 19:37:59 +01:00
Arnaud Le Blanc
53eaead824
Merge branch 'PHP-8.4'
* PHP-8.4:
  Disable ZEND_RC_MOD_CHECK() while loading shared extension in FPM
2025-03-17 17:40:38 +01:00
Arnaud Le Blanc
995f11adb1
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Disable ZEND_RC_MOD_CHECK() while loading shared extension in FPM
2025-03-17 17:40:23 +01:00
Jakub Zelenka
aa9d140a2a
Merge branch 'PHP-8.4' 2025-03-17 14:52:33 +01:00
Jakub Zelenka
d4eb6a41b7
Merge branch 'PHP-8.3' into PHP-8.4 2025-03-17 14:52:04 +01:00
Tim Düsterhus
6962540662
zend_get_callable_name: Return underlying callable’s name for fake closures (#18063)
Fixes php/php-src#18062
2025-03-17 13:55:24 +01:00
Daniel Scherzer
81ef122ca9 gen_stub: move findEquivalentFuncInfo() into FuncInfo
Reduce the number of global functions by moving it to instance method
`FuncInfo::findEquivalent()`.
2025-03-16 21:04:27 +01:00
Daniel Scherzer
3177180af2 gen_stub: simplify getFileDocComments() with array_filter 2025-03-16 21:04:27 +01:00
Daniel Scherzer
6d2c1edc76 gen_stub: move createAttributes() into AttributeInfo
Reduce the number of global functions by moving it to
`AttributeInfo::createFromGroups()`. In the process, fix the documentation for
the return type, the result is an array of `AttributeInfo` objects, not
`Attribute` objects.
2025-03-16 21:04:27 +01:00
Daniel Scherzer
2d185e42ec gen_stub: merge parseDocComment() into parseDocComments()
Reduce the number of global functions merging `parseDocComment()` into its only
caller
2025-03-16 21:04:27 +01:00
Daniel Scherzer
d154603074 gen_stub: move createExposedDocComment() into ExposedDocComment
Reduce the number of global functions by moving it to
`ExposedDocComment::extractExposedComment()`
2025-03-16 21:04:27 +01:00
Daniel Scherzer
8485a804ab gen_stub: stop cloning Type objects
They are immutable
2025-03-16 21:04:27 +01:00
Daniel Scherzer
cecbcd9f3f gen_stub: add reportFilePutContents() helper
Deduplicate reporting out each time a file is saved
2025-03-16 21:04:27 +01:00
Daniel Scherzer
2490cb67a2 gen_stub: remove FuncInfo::getFramelessDeclaration() parameter
Unused, only caller passes in the same FuncInfo object that the method is
called on.
2025-03-16 21:04:27 +01:00
Daniel Scherzer
2af71d7266 gen_stub: add FileInfo constructor
Move the logic from `parseStubFile()` to `FileInfo::__construct()`, and in the
process inline and remove `FileInfo::setMinimumPhpVersionIdCompatibility()`.
2025-03-16 21:04:27 +01:00
Daniel Scherzer
2df4ade39b gen_stub: reduce the number of public properties
The following properties are made private:
* `ArrayType::$keyType`, `::$valueType`
* `ArginfoType::$builtinTypes`
* `ConstName::$const`
* `ClassConstName::$const`
* `PropertyName::$property`
* `FuncInfo::$classFlags`, `::$isDeprecated`, `::$supportsCompileTimeEval`,
`::$minimumPhpVersionIdCompatibility`, `::$framelessFunctionInfos`,
`::$exposedDocComment`
* `VariableLike::$link`
* `ConstInfo::$isDeprecated`, `::$valueString`, `::$isFileCacheAllowed`
* `PropertyInfo::$classFlags`, `::$defaultValue`,
`::$defaultValueString`, `::$isDocReadonly`, `::$isVirtual`
* `EnumCaseInfo::$name`, `::$value`
* `AttributeInfo::$args`
* `ClassInfo::$enumBackingType`, `::$isDeprecated`, `::$exposedDocComment`,
`::$isStrictProperties`, `::$isNotSerializable`, `::$propertyInfos`,
`::$enumCaseInfos`

The following are made protected:
* `VariableLike::$exposedDocComment`, `::$phpVersionIdMinimumCompatibility`
2025-03-16 21:04:27 +01:00
Niels Dossche
6d6ac81d41
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-18082: Memory leaks in fuzzer SAPI error paths
2025-03-16 16:39:01 +01:00
Niels Dossche
a67f351b67
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-18082: Memory leaks in fuzzer SAPI error paths
2025-03-16 16:38:55 +01:00
Ilija Tovilo
798e27286e
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix mysql test date flakiness
2025-03-16 14:26:38 +01:00
Ilija Tovilo
45fc03c190
Fix mysql test date flakiness
Separate date() calls can lead to diverging results.

Closes GH-18080
2025-03-16 14:26:04 +01:00
Niels Dossche
e4be679780
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix OSS-Fuzz #403308724
2025-03-16 13:45:33 +01:00
Niels Dossche
4fd9992561
Fix OSS-Fuzz #403308724
Because simple hooks can be nested without starting a new context, we
need to restore the old property info in case of nested hooks.

Closes GH-18074.
2025-03-16 13:42:40 +01:00
Gina Peter Banyard
d8e7f362dd
ext/curl: Various minor clean-up refactorings (#18042) 2025-03-15 18:14:33 +00:00
Niels Dossche
c5f6a8b0a2
Minor improvements to ext/xml memory management (#18071) 2025-03-15 14:40:39 +01:00
David Carlier
c80e450931
Merge branch 'PHP-8.4' 2025-03-15 11:38:05 +00:00
David Carlier
3bb3db5314
Merge branch 'PHP-8.3' into PHP-8.4 2025-03-15 11:37:56 +00:00
David Carlier
6c189708a5
Merge branch 'PHP-8.4' 2025-03-15 11:34:52 +00:00
David Carlier
946408251f
Merge branch 'PHP-8.3' into PHP-8.4 2025-03-15 11:34:30 +00:00
Saki Takamachi
e954bf6750
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fixed pdo_firebird_handle_factory to check ret when starting a transaction (#17632)
2025-03-15 08:52:03 +09:00
Saki Takamachi
e96a35b9a8
Fixed pdo_firebird_handle_factory to check ret when starting a transaction (#17632)
Changed to not execute php_firebird_begin_transaction
if transaction cannot be started successfully

Closes #17632
2025-03-15 08:51:49 +09:00
Niels Dossche
a2ac800ab8
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-18015: Error messages for ldap_mod_replace are confusing
2025-03-15 00:51:28 +01:00
Saki Takamachi
6b6fde9098
ext/bcmath: If size of BC_VECTOR array is within 64 bytes, stack area is now used (#18065) 2025-03-15 08:43:43 +09:00
Niels Dossche
6717947ffe
Fix GH-18015: Error messages for ldap_mod_replace are confusing
Closes GH-18053.
2025-03-15 00:42:07 +01:00
Saki Takamachi
843d2a9b5f
ext/bcmath: bc_divide() small fix (#18060) 2025-03-15 08:41:14 +09:00
Niels Dossche
867ed156f7
Fix GH-18033: NULL-ptr dereference when using register_tick_function in destructor
The problem is that `php_request_shutdown` calls `php_deactivate_ticks` prior
to running destructors and the shutdown functions and finalizing output
handlers.
So if a destructor or shutdown function re-registers a tick function,
then the user tick functions handler will be added back to `PG(tick_functions)`.
When the next request happens, the list `PG(tick_functions)` still contains an
entry to call the user tick functions (added in the previous request
during shutdown). This causes a NULL deref eventually because
`run_user_tick_functions` assumes that if it is called then
`BG(user_tick_functions)` must be non-NULL.

Fix this by moving the tick handler deactivation.

Closes GH-18047.
2025-03-15 00:32:10 +01:00
Arnaud Le Blanc
f75dd82866
Merge branch 'PHP-8.4'
* PHP-8.4:
  Destroy temporary module classes in reverse order
2025-03-14 10:51:50 +01:00
Arnaud Le Blanc
4b9c72f329
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Destroy temporary module classes in reverse order
2025-03-14 10:49:10 +01:00
Saki Takamachi
32547f1127
ext/bcmath: If the result is 0, n_scale is set to 0. (#18056) 2025-03-14 17:52:50 +09:00
Saki Takamachi
fa1effdb3c
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fixed pointer subtraction for scale (#17986)
2025-03-14 09:00:33 +09:00
Saki Takamachi
7c9872e255
Fixed pointer subtraction for scale (#17986)
Closes #17986
2025-03-14 09:00:00 +09:00
Saki Takamachi
4e4f1729dd
ext/bcmath: Simplify bc_divide() code (#17987)
Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
2025-03-14 08:53:48 +09:00
Niels Dossche
b6e55d9856
Merge branch 'PHP-8.4'
* PHP-8.4:
  Correct check for maximum string length in JIT helpers
2025-03-13 23:49:48 +01:00
Niels Dossche
f4ba3564f5
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Correct check for maximum string length in JIT helpers
2025-03-13 23:49:42 +01:00
Niels Dossche
f18d0a1212
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-18037: SEGV Zend/zend_execute.c
2025-03-13 23:48:35 +01:00
Niels Dossche
413938143b
Fix GH-18037: SEGV Zend/zend_execute.c
A frameless icall with 3 arguments is a special case because it uses
OP_DATA, but this was not added to the list, so the opline pointed to
the wrong address resulting in UBSAN report or crash.

Closes GH-18048.
2025-03-13 23:48:24 +01:00
Jakub Zelenka
6ec89f028f
Merge branch 'PHP-8.4' 2025-03-13 22:32:18 +01:00
Jakub Zelenka
74911be889
Merge branch 'PHP-8.3' into PHP-8.4 2025-03-13 22:31:31 +01:00
Niels Dossche
fc047b4e00
Merge branch 'PHP-8.4'
* PHP-8.4:
  [ci skip] Fix NEWS order
  Fix GH-18018: RC1 data returned from offsetGet causes UAF in ArrayObject
2025-03-13 19:11:59 +01:00
Niels Dossche
3c17d3fc05
[ci skip] Fix NEWS order 2025-03-13 19:11:53 +01:00
Niels Dossche
d43d4684bd
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-18018: RC1 data returned from offsetGet causes UAF in ArrayObject
2025-03-13 19:11:24 +01:00
Pierrick Charron
11ec2cb94a
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Fix release dates on NEWS
  [skip ci] Fix release dates on NEWS
  [skip ci] Fix invalid release date of 8.1.1
  [skip ci] Fix release date of 8.3.19
2025-03-13 13:51:44 -04:00
Pierrick Charron
0c0cebe031
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [skip ci] Fix release dates on NEWS
  [skip ci] Fix invalid release date of 8.1.1
  [skip ci] Fix release date of 8.3.19
2025-03-13 13:50:11 -04:00
Pierrick Charron
a3aaedc76c
[skip ci] Fix release dates on NEWS 2025-03-13 13:50:06 -04:00
Ilija Tovilo
e5adfd5d89
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix flaky connection count in mysqli test
2025-03-13 16:47:36 +01:00
Ilija Tovilo
e624364967
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix flaky connection count in mysqli test
2025-03-13 16:47:29 +01:00
Gina Peter Banyard
ac5e72e280 Add missing clean sections 2025-03-13 15:00:07 +00:00
Gina Peter Banyard
5dae1e1dc2 Split var_dump tests
So that these aren't huge mega tests
2025-03-13 15:00:07 +00:00
Gina Peter Banyard
83090b4705 Split print_r tests
So that these aren't huge mega tests
2025-03-13 15:00:07 +00:00
Gina Peter Banyard
2a859abd33 Remove test dependency on resource/object IDs 2025-03-13 15:00:07 +00:00
Jorg Adam Sowa
3f3ac4de25
[skip ci] Remove wrappers comments in session ext (#18017) 2025-03-13 12:14:31 +00:00
Jakub Zelenka
0d10f7bfe5
Remove OpenSSL 1.0.2 related code (#18032)
This also removes old LibreSSL checks as minimum that compiles is 3.5.0
2025-03-13 10:59:26 +01:00
Remi Collet
9d4fd7f9b9
Merge branch 'PHP-8.4'
* PHP-8.4:
  Relax test expectation for pcre2lib 10.45 Using e92848789a
2025-03-13 07:48:50 +01:00
Remi Collet
5de019d9bd
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Relax test expectation for pcre2lib 10.45 Using e92848789a
2025-03-13 07:46:55 +01:00
Dmitry Stogov
7faa3decd9
Merge branch 'PHP-8.4'
* PHP-8.4:
  Update IR
2025-03-13 03:08:16 +03:00
Dmitry Stogov
ae67eb0490
Update IR
IR commit: 8bb0acca45a7b0f12691f4258e41462599efbd74
2025-03-13 03:07:43 +03:00
David Carlier
ccb6d78bab
fix php_version 2025-03-12 22:22:20 +00:00
David Carlier
4d6c7bd6e3
Merge branch 'PHP-8.4' 2025-03-12 22:21:17 +00:00
David Carlier
7f771e1e87
Merge branch 'PHP-8.3' into PHP-8.4 2025-03-12 22:20:03 +00:00
Ilija Tovilo
8731c95b35
Make missing trait error recoverable
We were already handling NULL as a case, but seem to have forgotten to
pass the ZEND_FETCH_CLASS_EXCEPTION flag.

Also make "is not a trait" error recoverable, there's no reason why it
can't be.

Fixes GH-17959
Closes GH-17960
2025-03-12 16:19:58 +01:00
Eric Mann
0a811cea4f
Merge branch 'PHP-8.3' 2025-03-12 06:35:48 -07:00
DanielEScherzer
7f0d4e36de
access_modifiers_002.phpt: fix test name [skip ci] (GH-18027)
"Attributes" has taken on another meaning since this test was created in 2007
2025-03-12 11:54:11 +01:00
Kévin Dunglas
a191e7a4b1
Merge branch 'PHP-8.4'
* PHP-8.4:
  fix GH-8533: dynamic libphp linking on Mac
2025-03-12 08:59:20 +01:00
Kévin Dunglas
74a455fb11
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  fix GH-8533: dynamic libphp linking on Mac
2025-03-12 08:58:54 +01:00
Pierrick Charron
645cd6a5ad
Merge branch 'PHP-8.4'
* PHP-8.4:
  PHP-8.2 is now for PHP 8.2.29-dev
2025-03-11 18:35:16 -04:00
Pierrick Charron
d465449b05
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  PHP-8.2 is now for PHP 8.2.29-dev
2025-03-11 18:34:25 -04:00
Niels Dossche
5e1b40ca7d
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix incorrectly merged bug75535.phpt
2025-03-11 23:06:47 +01:00
Niels Dossche
8156a89eff
Fix incorrectly merged bug75535.phpt
Co-authored-by: Jakub Zelenka <bukka@php.net>
2025-03-11 23:06:28 +01:00
Niels Dossche
3d6f4c8bbe
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GHSA-p3x9-6h7p-cgfc: libxml streams wrong `content-type` on redirect
2025-03-11 23:00:43 +01:00
Tim Düsterhus
a8d3a80067
Fix GHSA-p3x9-6h7p-cgfc: libxml streams wrong content-type on redirect
libxml streams use wrong content-type header when requesting a
redirected resource.
2025-03-11 22:58:39 +01:00
Ben Ramsey
3ae44211b3
Merge branch 'PHP-8.4' 2025-03-11 16:43:52 -05:00
Ben Ramsey
109230d0da
Merge branch 'PHP-8.3' into PHP-8.4 2025-03-11 16:43:28 -05:00
Jakub Zelenka
5c8025e23f
Merge branch 'PHP-8.4' 2025-03-11 22:24:34 +01:00
Jakub Zelenka
6976fb6ba7
Merge branch 'PHP-8.3' into PHP-8.4 2025-03-11 22:23:09 +01:00
David CARLIER
21fd08be71
ext/sockets: adding SO_BUSY_POLL socket option for Linux. (#17954)
To possibly reduce the latency when polling packets by activating it
from the network interface for N microseconds.
The kernel by doing so, increase the CPU(s) activity bound to
the socket significantly.
Note that not only the kernel needs to have support enabled for it
(which the average distribution usually does) but the network
interface itself needs to support it too. If not, it is just a no-op.
2025-03-11 20:03:28 +00:00
Eric Mann
cd04535903
Merge branch 'PHP-8.3' 2025-03-11 12:06:55 -07:00
Gina Peter Banyard
38fce780d9
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Update NEWS
  Fix bug and add test for dba_open same file twice (#17979)
2025-03-11 11:11:25 +00:00
Gina Peter Banyard
bb4174e6bc
[skip ci] Update NEWS 2025-03-11 11:10:19 +00:00
Christian Schneider
4ca6bde32f
Fix bug and add test for dba_open same file twice (#17979)
Co-authored-by: Christian Schneider <schneider@search.ch>
2025-03-11 11:08:53 +00:00
Niels Dossche
9d60dc16b8
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix test GH-16535 for libxml2 2.14
  Fix tests for libxml2 2.14
2025-03-10 20:23:50 +01:00
Niels Dossche
09189026e6
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix test GH-16535 for libxml2 2.14
  Fix tests for libxml2 2.14
2025-03-10 20:23:43 +01:00
Ilija Tovilo
2862302bce
Merge branch 'PHP-8.4'
* PHP-8.4:
  Increase CircleCI no_output_timeout
2025-03-10 13:38:25 +01:00
Ilija Tovilo
dfdf52eb9f
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Increase CircleCI no_output_timeout
2025-03-10 13:38:16 +01:00
Ilija Tovilo
94f327219a
Merge branch 'PHP-8.4' 2025-03-10 11:28:49 +01:00
Ilija Tovilo
3b9b26f760
Merge branch 'PHP-8.3' into PHP-8.4 2025-03-10 11:28:43 +01:00
Niels Dossche
33c4ca36e4
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix weird unpack behaviour in DOM
  Fix GH-17989: mb_output_handler crash with unset http_output_conv_mimetypes
2025-03-09 11:21:34 +01:00
Niels Dossche
aa6e58f82a
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix weird unpack behaviour in DOM
  Fix GH-17989: mb_output_handler crash with unset http_output_conv_mimetypes
2025-03-09 11:21:27 +01:00
Ilija Tovilo
30ce9acd33
Merge branch 'PHP-8.4'
* PHP-8.4:
  Suppress snmp lib memory leak, skip ASAN tests
2025-03-08 16:12:32 +01:00
Ilija Tovilo
efb08feb85
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Suppress snmp lib memory leak, skip ASAN tests
2025-03-08 16:12:24 +01:00
Ilija Tovilo
f9d8d483cb
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix lazy proxy calling set hook twice
2025-03-08 12:39:20 +01:00
Ilija Tovilo
8254e8de31
Fix lazy proxy calling set hook twice
Writing to an uninitialized lazy proxy will initialize the underlying
object and then call zend_std_write_property() on it. If this happens
inside a hook, zend_std_write_property() should not call the hook again
but directly write to the property slot. This didn't previously work
because zend_should_call_hook() would compare the parent frame
containing the proxy to the underlying object. This is now handled
explicitly.

Fixes GH-18000
Closes GH-18001
2025-03-08 12:38:27 +01:00
Ilija Tovilo
9fd62733b9
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix skipped lazy init on primed SIMPLE_WRITE
2025-03-08 12:33:20 +01:00
Ilija Tovilo
9acfe6e11c
Fix skipped lazy init on primed SIMPLE_WRITE
Go through the normal assignment path, which includes an IS_UNDEF check.

Fixes GH-17998
Closes GH-17999
2025-03-08 12:32:18 +01:00
Ilija Tovilo
e58521c9e8
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix incorrect handling of hooked props without get hook in get_object_vars()
2025-03-08 12:27:56 +01:00
Ilija Tovilo
868959350f
Fix incorrect handling of hooked props without get hook in get_object_vars()
Fixes GH-17988
Closes GH-17997
2025-03-08 12:27:28 +01:00
Niels Dossche
2a6122c54a
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix uninitialized memory accesses in DOM iterator
2025-03-08 11:12:40 +01:00
Niels Dossche
8950c241b3
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix uninitialized memory accesses in DOM iterator
2025-03-08 11:12:34 +01:00
Niels Dossche
3772b502f6
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17941: Stack-use-after-return with lazy objects and hooks
2025-03-08 00:00:12 +01:00
Niels Dossche
38e8725bec
Fix GH-17941: Stack-use-after-return with lazy objects and hooks
zend_std_write_property() can return the variable pointer, but the code
was using a local variable, and so a pointer to a local variable could
be returned. Fix this by using the value pointer instead of the backup
value was written.
This can be more efficient on master by using the safe_assign helper.

Closes GH-17947.
2025-03-08 00:00:01 +01:00
Niels Dossche
632357b275
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17991: Assertion failure dom_attr_value_write
2025-03-07 22:43:48 +01:00
Niels Dossche
6083dc09a3
Fix GH-17991: Assertion failure dom_attr_value_write
Closes GH-17995.
2025-03-07 22:43:38 +01:00
David Carlier
a14301b2d6
Merge branch 'PHP-8.4' 2025-03-07 18:31:51 +00:00
David Carlier
6004063206
Merge branch 'PHP-8.3' into PHP-8.4 2025-03-07 18:31:14 +00:00
David Carlier
ea86442857
Merge branch 'PHP-8.4' 2025-03-07 18:08:30 +00:00
David Carlier
bc55177832
Merge branch 'PHP-8.3' into PHP-8.4 2025-03-07 18:07:48 +00:00
David Carlier
cd88e9f1f4
[skip ci] NEWS/UPGRADING 2025-03-07 18:02:52 +00:00
bogdanungureanu
97402d5ab5
ext/intl: Add DECIMAL_COMPACT_SHORT and DECIMAL_COMPACT_LONG for NumberFormatter class
close GH-17975
2025-03-07 18:00:38 +00:00
Dmitry Stogov
af704ae067
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix register allocarion for result of ASSIGN_OBJ (#17994)
2025-03-07 19:30:47 +03:00
Dmitry Stogov
1b9d659c3f
Fix register allocarion for result of ASSIGN_OBJ (#17994)
This fixes few failures in Symfony unit tests with function JIT
2025-03-07 19:28:51 +03:00
Calvin Buckley
71ee356d2c
Merge branch 'PHP-8.4'
* PHP-8.4:
  Remove "Notify Slack" on ppc nightly workflow (#17993)
2025-03-07 10:40:10 -04:00
Calvin Buckley
7634484dc2
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Remove "Notify Slack" on ppc nightly workflow (#17993)
2025-03-07 10:40:01 -04:00
Dmitry Stogov
cd586623b6
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix function JIT for Wordpress unit tests
2025-03-07 02:32:29 +03:00
Dmitry Stogov
5885b9490c
Fix function JIT for Wordpress unit tests 2025-03-07 02:30:30 +03:00
Dmitry Stogov
972d6b6664
Fix JIT for INIT_STATIC_METHOD_CALL in a closure 2025-03-07 01:09:28 +03:00
Niels Dossche
e3a5c38382
Merge branch 'PHP-8.4'
* PHP-8.4:
  Add test for GH-17966
2025-03-06 21:56:01 +01:00
Niels Dossche
bac1ed6579
Add test for GH-17966
This was fixed via https://github.com/dstogov/ir/pull/109 which was
merged in cc70838dc9.
2025-03-06 21:55:53 +01:00
Dmitry Stogov
ad5de59f93
Merge branch 'PHP-8.4'
* PHP-8.4:
  Merge IR
2025-03-06 23:01:25 +03:00
Dmitry Stogov
cc70838dc9
Merge IR
IR commit: 0441281e95ce9736131eddc71ce666389dcccd4b
2025-03-06 23:00:53 +03:00
Dmitry Stogov
d9e39f5c6f
Fix JIT for INIT_STATIC_METHOD_CALL in a closure 2025-03-06 21:53:45 +03:00
Niels Dossche
5009c236fc
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-15834: Segfault with hook "simple get" cache slot and minimal JIT
2025-03-06 19:37:29 +01:00
Niels Dossche
f6c2e40a11
Fix GH-15834: Segfault with hook "simple get" cache slot and minimal JIT
The FETCH_OBJ_R VM handler has an optimization that directly enters into
a hook if it is a simpler getter hook. This is not compatible with the
minimal JIT because the minimal JIT will try to continue executing the
opcodes after the FETCH_OBJ_R.
To solve this, we check whether the opcode is still the expected one
after the execution of the VM handler. If it is not, we know that we are
going to execute a simple hook. In that case, exit to the VM.

Closes GH-17909.
2025-03-06 19:37:21 +01:00
Niels Dossche
9ddc25afe3
Simplify array_any(), array_all(), array_find(), array_find_key() (#17978)
By returning something more semantically meaningful that SUCCESS/FAILURE
we can avoid refcounting for array_all() and array_any().
Also we can avoid resetting the input values to UNDEF.
2025-03-06 19:33:41 +01:00
Dmitry Stogov
918332cf9c
Fix Symfony tests failures with function JIT 2025-03-06 19:18:38 +03:00
Ilija Tovilo
01a894a269
Merge branch 'PHP-8.4'
* PHP-8.4:
  Upgrade security branches to Ubuntu 22.04
2025-03-06 15:25:28 +01:00
Ilija Tovilo
4d5a88c7fc
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Upgrade security branches to Ubuntu 22.04
2025-03-06 15:25:24 +01:00
Ilija Tovilo
bc32bb164f
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix flaky DatePeriod test
2025-03-06 15:04:36 +01:00
Ilija Tovilo
253c579c25
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix flaky DatePeriod test
2025-03-06 15:04:29 +01:00
Niels Dossche
0dede83264
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix memory leaks in array_any() / array_all()
2025-03-05 19:53:30 +01:00
Niels Dossche
75cca9f19e
Fix memory leaks in array_any() / array_all()
The return value is overwritten, but if the key was not an interned
string we should destroy it.

Closes GH-17977.
2025-03-05 19:52:16 +01:00
Niels Dossche
83722a5fdc
Fix memory leaks in array_any() / array_all()
The return value is overwritten, but if the key was not an interned
string we should destroy it.

Closes GH-17977.
2025-03-05 19:51:51 +01:00
Calvin Buckley
eebc7b0a7a
Merge branch 'PHP-8.4'
* PHP-8.4:
  Skip mysqli/tests/bug73462 on PPC CI (#17971)
2025-03-05 10:20:34 -04:00
Calvin Buckley
b2e49c80bf
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Skip mysqli/tests/bug73462 on PPC CI (#17971)
2025-03-05 10:20:19 -04:00
rekmixa
4f5136cf2e
Allow substituting static for self in final classes
Fixes GH-17725
Closes GH-17724
2025-03-05 11:31:46 +01:00
Ayesh Karunaratne
cab120f521
ext/curl: update Caddyfile basicauth to basic_auth
In Caddy 2.8, `basicauth` was renamed to `basic_auth`.

This also applies `caddy fmt Caddyfile --overwrite` changes.
2025-03-05 16:30:59 +07:00
Gina Peter Banyard
fe8d39afc4
ext/pdo: Pack _pdo_dbh_t struct (#17741)
This reduces the size from 176 to 152 bytes
2025-03-04 22:10:16 +00:00
Gina Peter Banyard
cd65240673
ext/pdo: Add tests for PDO::ATTR_STATEMENT_CLASS attribute (#17969) 2025-03-04 17:09:17 +00:00
Ayesh Karunaratne
8e39e9c815
ext/curl: update sync-constants.php consts-ignore list 2025-03-04 21:21:00 +07:00
Tim Düsterhus
057ff3519d
sapi/cli: Print non-default INI settings for --ini=diff (#17762)
This is a follow-up for php/php-src#17459, updating the command-line flag to
not modify the behavior of `--ini`.
2025-03-04 08:42:06 +01:00
Ilija Tovilo
0df99742c4
Merge branch 'PHP-8.4'
* PHP-8.4:
  Upgrade i386 branch to Ubuntu 22.04
2025-03-03 23:25:14 +01:00
Ilija Tovilo
2076ab1248
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Upgrade i386 branch to Ubuntu 22.04
2025-03-03 23:24:21 +01:00
Dmitry Stogov
9dd2ae4d76
Merge branch 'PHP-8.4'
* PHP-8.4:
  Merge IR
2025-03-03 23:48:30 +03:00
Dmitry Stogov
f016caa312
Merge IR
IR commit: 1a02c4819f210a1f4548b83850ed7cd5c76c13aa
2025-03-03 23:48:08 +03:00
Gina Peter Banyard
9285559c8c ext/bz2: Use new php_streams fast ZPP specifier 2025-03-03 18:08:23 +00:00
Gina Peter Banyard
ff40eed32d ext/hash: Use new php_streams fast ZPP specifier 2025-03-03 18:08:23 +00:00
Gina Peter Banyard
eb4ccf5758 ext/pgsql: Use new php_streams fast ZPP specifier 2025-03-03 18:08:23 +00:00
Gina Peter Banyard
c9d23c96d6 ext/ftp: Use new php_streams fast ZPP specifier 2025-03-03 18:08:23 +00:00
Gina Peter Banyard
da1fde28f3 ext/standard: Use new php_streams fast ZPP specifier 2025-03-03 18:08:23 +00:00
Gina Peter Banyard
f3857dd613 ext/standard: Use new php_streams fast ZPP specifier for stream functions 2025-03-03 18:08:23 +00:00
Gina Peter Banyard
8787fa2a36 ext/standard: Use new php_streams fast ZPP specifier for file functions
Fix a corresponding test
2025-03-03 18:08:23 +00:00
Gina Peter Banyard
11876f92fd main: Add a custom Fast ZPP specifier for php_streams 2025-03-03 18:08:23 +00:00
Calvin Buckley
fca13796ef
Merge branch 'PHP-8.4'
* PHP-8.4:
  Attempt at ppc64 CI (#17945)
2025-03-03 12:41:51 -04:00
Calvin Buckley
7ae8f93e45
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Attempt at ppc64 CI (#17945)
2025-03-03 12:41:41 -04:00
Pascal Chevrel
ff88701b77
Fix GH-17956 Internal dev server 404 page is not responsive
Add a basic viewport html meta tag with responsive mode parameters
See: https://developer.mozilla.org/en-US/docs/Web/HTML/Viewport_meta_tag

Updated existing tests

close GH-17957
2025-03-03 12:05:00 +00:00
Niels Dossche
0097ad8eb3
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17938: UAF with zend_test opline observer and magic_quotes_gpc=1 (#17958)
2025-03-03 08:22:55 +01:00
Niels Dossche
4c751ec04c
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17938: UAF with zend_test opline observer and magic_quotes_gpc=1 (#17958)
2025-03-03 08:22:49 +01:00
Niels Dossche
98e0501343
Drop support for -z CLI/CGI option
This functionality didn't actually work.
This was discussed on the mailing list [1] and no one objected.

[1] https://externals.io/message/126368

Closes GH-17883.
2025-03-03 08:21:56 +01:00
Niels Dossche
1ae2c871d0
Avoid unnecessary string refcounting in ext/date (#17890) 2025-03-02 22:55:06 +01:00
Niels Dossche
d95b9d6d32
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17736: Assertion failure zend_reference_destroy()
2025-03-02 22:41:21 +01:00
Niels Dossche
ee4a9a4a7c
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17736: Assertion failure zend_reference_destroy()
2025-03-02 22:37:07 +01:00
Calvin Buckley
3677871347
Use pkg-config for ext/ldap without a directory (#17441)
* Use pkg-config for ext/ldap without a directory

The existing check is not very good. OpenLDAP has been shipping a
pkg-config file for a while now, and that's preferable over trying to
manually find it.

Note that for older OpenLDAP or non-OpenLDAP implementations, a
directory can still be passed to use the old logic. Note that Oracle
LDAP is busted and going away soon; I'm not sure for other LDAP
implementations.

Tested on macOS 14.

* Convert added ifs to AS_IF
2025-02-28 14:39:31 -04:00
Jakub Zelenka
2e7b6dac31
Merge branch 'PHP-8.4' 2025-02-28 14:52:37 +01:00
Jakub Zelenka
4936c32772
Merge branch 'PHP-8.3' into PHP-8.4 2025-02-28 14:51:52 +01:00
Niels Dossche
0c4d13a822
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix branch target in zend_jit_push_call_frame() (#17949)
2025-02-28 09:22:32 +01:00
Niels Dossche
9e779dae7b
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix branch target in zend_jit_push_call_frame() (#17949)
2025-02-28 09:22:25 +01:00
Tim Düsterhus
da1e254652
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix `ReflectionFunction::isDeprecated()` for materialized `__call()` (#17914)
2025-02-27 14:48:24 +01:00
Tim Düsterhus
2e999bad34
Fix ReflectionFunction::isDeprecated() for materialized __call() (#17914)
* Fix `ReflectionFunction::isDeprecated()` for materialized `__call()`

Fixes php/php-src#17913

* NEWS
2025-02-27 14:48:08 +01:00
Art Kay
2b2a70d45e
Fix a number of typos in comments / docs
Co-authored-by: Michael Voříšek <mvorisek@mvorisek.cz>

Closes GH-17874
2025-02-26 22:57:31 +01:00
Ilija Tovilo
8f21763616
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix varying pgsql error message
2025-02-26 21:30:32 +01:00
Ilija Tovilo
8be263d2a1
Fix varying pgsql error message 2025-02-26 21:30:24 +01:00
Ilija Tovilo
949e10e4c1
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix circumvented added hooks in JIT
2025-02-26 21:26:39 +01:00
Ilija Tovilo
376e90fbf2
Fix circumvented added hooks in JIT
The following code poses a problem in the JIT:

```php
class A {
    public $prop = 1;
}

class B extends A {
    public $prop = 1 {
        get => parent::$prop::get() * 2;
    }
}

function test(A $a) {
    var_dump($a->prop);
}

test(new B);
```

The JIT would assume A::$prop in test() could be accessed directly
through OBJ_PROP_NUM(). However, since child classes can add new hooks
to existing properties, this assumption no longer holds.

To avoid introducing more JIT checks, a hooked property that overrides a
unhooked property now results in a separate zval slot that is used
instead of the parent slot. This causes the JIT to pick the slow path
due to an IS_UNDEF value in the parent slot.

zend_class_entry.properties_info_table poses a problem in that
zend_get_property_info_for_slot() and friends will be called using the
child slot, which does not store its property info, since the parent
slot already does. In this case, zend_get_property_info_for_slot() now
provides a fallback that will iterate all property infos to find the
correct one.

This also uncovered a bug (see Zend/tests/property_hooks/dump.phpt)
where the default value of a parent property would accidentally be
inherited by the child property.

Fixes GH-17376
Closes GH-17870
2025-02-26 21:26:00 +01:00
Ilija Tovilo
15c2477273
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix accidentally inherited default value in overridden virtual properties
2025-02-26 21:17:49 +01:00
Ilija Tovilo
e0c69dde02
Fix accidentally inherited default value in overridden virtual properties
Discovered when working on GH-17376.
2025-02-26 21:16:58 +01:00
Ilija Tovilo
84d00ec58f
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix property hook backing value access in multi-level inheritance
2025-02-26 20:49:15 +01:00
Ilija Tovilo
7a55116f12
Fix property hook backing value access in multi-level inheritance
Discovered by Niels when testing GH-17376.
2025-02-26 20:49:07 +01:00
David Carlier
d6cd754121
Merge branch 'PHP-8.4' 2025-02-25 21:56:01 +00:00
David Carlier
c8bead8393
Merge branch 'PHP-8.3' into PHP-8.4 2025-02-25 21:55:46 +00:00
Niels Dossche
265ac5b233
Merge branch 'PHP-8.4'
* PHP-8.4:
  NEWS for 8.4.5: combine ext/GD sections [skip ci]
2025-02-25 22:34:35 +01:00
DanielEScherzer
a73fe50864
NEWS for 8.4.5: combine ext/GD sections [skip ci]
Closes GH-17930.
2025-02-25 22:34:25 +01:00
Saki Takamachi
13108bb558
Merge branch 'PHP-8.4'
* PHP-8.4:
  PHP-8.4 is now for PHP 8.4.6-dev
2025-02-26 00:04:45 +09:00
Saki Takamachi
1ec469d116
PHP-8.4 is now for PHP 8.4.6-dev 2025-02-26 00:02:20 +09:00
Ilija Tovilo
ded8af57c4
Merge branch 'PHP-8.4'
* PHP-8.4:
  Reflection: indicate final and abstract properties in string output
2025-02-25 12:22:00 +01:00
Daniel Scherzer
81f143e71f
Reflection: indicate final and abstract properties in string output
Add "final" and "abstract" to the result of `_property_string()` when
outputting the string representation of a `ReflectionClass` or
`ReflectionProperty` instance

Closes GH-17827
2025-02-25 12:21:15 +01:00
DanielEScherzer
babf7a32bf
Zend/tests: organize some tests with sub directories (10) (#17920)
Add directories for tests relating to
- halting the compiler
- `declare()` usage
- exception handlers
- `get_class_methods()`
- `get_class_vars()`
- `isset()`
- name collisions

As well as organizing a couple of tests into existing sub directories along the
way

Work towards GH-15631
2025-02-25 09:48:52 +00:00
Tim Düsterhus
9466b3fbda
php_gdb: Add support for ZEND_AST_CALLABLE_CONVERT to ZendAstPrettyPrinter 2025-02-25 09:25:54 +01:00
DanielEScherzer
0b42749621
GDB: apply ast pretty printing to specialized structures (#17884)
The `ZendAstPrettyPrinter` had logic to handle the various structures that are
based on `zend_ast`, like `zend_ast_decl`, but the printer was only installed
when the value was a `zend_ast`, meaning that for the specialized structures
the details wouldn't be shown unless they were cast (in GDB) to `zend_ast`.
Instead, just register the printer for the specialized structures too.
2025-02-25 09:17:14 +01:00
David CARLIER
cc116067b2
Revert "ext/sockets: follow-up on AF_PACKET support." (#17924)
This reverts commit de018aa2c5.
2025-02-25 07:04:40 +00:00
Dmitry Stogov
1a10b990f2
Merge branch 'PHP-8.4'
* PHP-8.4:
  Update IR
2025-02-25 02:23:57 +03:00
Dmitry Stogov
819b1988a0
Update IR
IR commit: ca93e781eaf6b0949690d3df272ecf44528ff4a8
2025-02-25 02:23:05 +03:00
Jakub Zelenka
9ed83e1c74
Merge branch 'PHP-8.4' 2025-02-24 23:23:25 +01:00
Jakub Zelenka
ed00c1d74b
Merge branch 'PHP-8.3' into PHP-8.4 2025-02-24 23:22:47 +01:00
David Carlier
de018aa2c5
ext/sockets: follow-up on AF_PACKET support.
support from socket_recvfrom and exposing basic PHP userland type.

close GH-17657
2025-02-24 22:09:29 +00:00
Niels Dossche
98fc344ddb
Merge branch 'PHP-8.4'
* PHP-8.4:
  Backport GH-17869 to PHP 8.3 JIT
2025-02-24 21:46:05 +01:00
Niels Dossche
fa4ae80928
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Backport GH-17869 to PHP 8.3 JIT
2025-02-24 21:46:00 +01:00
Niels Dossche
a9eddae103
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17866: zend_mm_heap corrupted error after upgrading from 8.4.3 to 8.4.4
2025-02-24 21:42:21 +01:00
Niels Dossche
2542357b6d
Fix GH-17866: zend_mm_heap corrupted error after upgrading from 8.4.3 to 8.4.4
This regressed in GH-17592.
The function is with its attributes HashTable* is copied in
zend_get_closure_invoke_method() but its refcount is not increased.
This caused a crash in the Symfony demo page.

Closes GH-17880.
2025-02-24 21:39:55 +01:00
Niels Dossche
229c1ebb67
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17916: Final abstract properties should error
2025-02-24 20:19:24 +01:00
Daniel Scherzer
c0857e0d8a
Fix GH-17916: Final abstract properties should error
Closes GH-17917.
2025-02-24 20:17:41 +01:00
Niels Dossche
8e9df32309
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17868: Cannot allocate memory with tracing JIT on 8.4.4
2025-02-24 19:39:00 +01:00
Niels Dossche
5ede5415e1
Fix GH-17868: Cannot allocate memory with tracing JIT on 8.4.4
The generated code tries to initialize the run time cache for even
internal closures, but it should only initialize the run time cache for
user closures. We fix this by adding a check for the function type.
If `func` is known, then we can check the type at code generation time.

Closes GH-17869.
2025-02-24 19:36:13 +01:00
Niels Dossche
2b6c9b68bb
Fix GH-17900 and GH-8084
Calling the constructor twice has no real world benefit.
Block it to fix these two issues.
We also clean up the constructor code a bit:
- `in_ctor` implies `object` exist.
- We surround the instance check with ZEND_DEBUG to avoid a runtime
  penalty.

Closes GH-17900.
Closes GH-8084.
Closes GH-17908.
2025-02-24 19:25:08 +01:00
Ilija Tovilo
0008a1e84b
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Use laravel default branch in community build
2025-02-24 15:58:48 +01:00
Ilija Tovilo
ca75ebf3a1
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [skip ci] Use laravel default branch in community build
2025-02-24 15:58:40 +01:00
Bob Weinand
bcd7222522 Merge branch 'PHP-8.4' 2025-02-24 14:37:21 +01:00
Bob Weinand
53fa98ecd3
Fix GH-17715: Handle preloaded internal function runtime cache (#17835)
This solely affects the builtin enum functions currently.

Given that these are stored in SHM, we cannot simply hardwire a pointer into the internal function runtime cache on NTS too, but have to use a MAP_PTR (like on ZTS).
Now, by design, the runtime cache of internal functions no longer is reset between requests, hence we need to store them explicitly as static runtime cache.

On NTS builds we cannot trivially move the pointers into CG(internal_run_time_cache) as they're directly stored on the individual functions (on ZTS we could simply iterate the static map_ptrs).
Hence, we have the choice between having opcache managing the internal run_time_cache for its preloaded functions itself or realloc CG(internal_run_time_cache) and iterate through all functions to assign the new address. We choose the latter for simplicity and initial speed.
2025-02-24 14:35:47 +01:00
David Carlier
06101224b4
Merge branch 'PHP-8.4' 2025-02-24 07:15:08 +00:00
David Carlier
fc73da57f4
Merge branch 'PHP-8.3' into PHP-8.4 2025-02-24 07:14:56 +00:00
Niels Dossche
1fa15abe92
Remove pointless call to zval_ptr_dtor() in sqlite3 (#17906)
This is IS_LONG.
2025-02-23 21:04:47 +01:00
David Carlier
a0e1ce1b57
Merge branch 'PHP-8.4' 2025-02-23 16:02:45 +00:00
David Carlier
34d0e4f31f
Merge branch 'PHP-8.3' into PHP-8.4 2025-02-23 16:02:35 +00:00
Niels Dossche
6a4b0c922c
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix memory leaks in pdo_sqlite callback registration
  Fix cycle leak in sqlite3 setAuthorizer()
2025-02-23 16:36:06 +01:00
Niels Dossche
635fe263ac
Fix memory leaks in pdo_sqlite callback registration
* We need to clean the trampoline if the construction check fails
* Checking for an exception and then returning causes a leak on
  `collation`. Returning early is pointless anyway.

Closes GH-17904.
2025-02-23 16:35:55 +01:00
Niels Dossche
76035090b6
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix cycle leak in sqlite3 setAuthorizer()
2025-02-23 16:35:25 +01:00
DanielEScherzer
674663464e
Zend/tests: organize some tests with sub directories (9) (#17897)
Add directories for tests relating to
- calling user functions (`call_user_func()` and `call_user_func_array()`)
- using `::class` to access class names
- null coalescing with `??`
- concatenation with `.`
- indirect function calls (e.g. by calling a variable with a function name)
- reporting of line numbers
- static variables in functions
- type casts

As well as organizing a couple of tests into existing sub directories along the
way

Work towards GH-15631
2025-02-23 14:41:49 +00:00
David Carlier
388134769b
Merge branch 'PHP-8.4' 2025-02-23 13:23:48 +00:00
David Carlier
96340e9eed
Merge branch 'PHP-8.3' into PHP-8.4 2025-02-23 13:23:38 +00:00
Niels Dossche
404c96e2bb
Avoid string copies for date/time format in firebird (#17902) 2025-02-23 14:14:42 +01:00
David Carlier
f89b0a229c
Merge branch 'PHP-8.4' 2025-02-23 10:45:55 +00:00
David Carlier
e8dda54dd5
Merge branch 'PHP-8.3' into PHP-8.4 2025-02-23 10:45:46 +00:00
David CARLIER
67a349d8f3
ext/bz2: removing useless casts for filter ZendMM parts. (#17887) 2025-02-23 10:16:00 +00:00
Niels Dossche
b1841fdfa2
Avoid unnecessary string refcounting in ext/mbstring (#17892) 2025-02-23 00:23:53 +01:00
Niels Dossche
03f97fc34b
Avoid unnecessary string refcounting in ext/pcre (#17893) 2025-02-23 00:23:39 +01:00
Niels Dossche
1eacd4aea0
Avoid unnecessary string refcounting in ext/dom (#17889) 2025-02-23 00:23:22 +01:00
DanielEScherzer
618190127e
Zend/tests: organize some tests with sub directories (8) (#17873)
Create new sub directories for tests related to backtraces and for tests
related to `$this` being reserved in different places and not being usable or
reassignable.

Work towards GH-15631
2025-02-22 19:10:59 +00:00
Niels Dossche
77b6a795d3
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix using Dom\Node with Dom\XPath callbacks
2025-02-22 16:00:45 +01:00
Niels Dossche
7974c62873
Fix using Dom\Node with Dom\XPath callbacks
This code was introduced when the Dom\Node and DOMNode classes were
still aliases, so the type check was never updated.
We fix this by checking if the doc pointer follows the spec and pick the
right node CE based on that.

Closes GH-17888.
2025-02-22 16:00:39 +01:00
Christoph M. Becker
49d798abcc
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17879: readfile_variation8-win32.phpt test conflict
2025-02-22 00:11:31 +01:00
Christoph M. Becker
2c911e400a
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17879: readfile_variation8-win32.phpt test conflict
2025-02-22 00:10:51 +01:00
Niels Dossche
8ce16d517f
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17847: xinclude destroys live node
2025-02-21 22:28:00 +01:00
Niels Dossche
be3d128632
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17847: xinclude destroys live node
2025-02-21 22:27:53 +01:00
DanielEScherzer
7b8a61a18c
Zend/tests: merge constant_expressions into constexpr, update names (#17872)
While reviewing the existing tests in the `constexpr` directory, I found that
some of the names were not updated to reflect the contents when the contents
were changed in #9301.

Follow-up to #15638
2025-02-21 18:37:39 +00:00
Christoph M. Becker
05f8feeae4
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17855: CURL_STATICLIB flag set even if linked with shared lib
2025-02-21 13:08:59 +01:00
Christoph M. Becker
1eb67515be
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17855: CURL_STATICLIB flag set even if linked with shared lib
2025-02-21 13:08:29 +01:00
Christoph M. Becker
9998337539
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17855: CURL_STATICLIB flag set even if linked with shared lib
2025-02-21 12:50:21 +01:00
Christoph M. Becker
07a3719bc7
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17855: CURL_STATICLIB flag set even if linked with shared lib
2025-02-21 12:49:08 +01:00
Christoph M. Becker
29c39a3d91
Fix GH-17855: CURL_STATICLIB flag set even if linked with shared lib
We must define `CURL_STATICLIB` only when building against a static
libcurl.  The detection relies on our usual naming conventions, what
should be revised in the future (possibly using pkg-config, or
switching to CMake).

Closes GH-17857.
2025-02-21 12:46:20 +01:00
Niels Dossche
7063b01aab
Merge branch 'PHP-8.4'
* PHP-8.4:
  Reflection: show the type of object constants used as default properties
2025-02-21 09:39:02 +01:00
Niels Dossche
77847b02b9
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Reflection: show the type of object constants used as default properties
2025-02-21 09:36:01 +01:00
David CARLIER
0ec6413562
ext/sockets: multicast socket option helper change to zval_try_get_tmp_string() (#17871) 2025-02-20 23:47:33 +00:00
David CARLIER
6c096bfa13
ext/sockets: php_set_inet*_addr using zend_string instead. (#17845) 2025-02-20 21:59:55 +00:00
Dmitry Stogov
378e1b0853
Merge branch 'PHP-8.4'
* PHP-8.4:
  Update IR
2025-02-20 23:58:31 +03:00
Dmitry Stogov
dd404dc419
Update IR
IR commit: 1499748be439e7f786c0ee2c4f738c126af57df8
2025-02-20 23:58:08 +03:00
Tim Düsterhus
2042fd34e0
Support first-class callables in const-expressions (#17213)
RFC: https://wiki.php.net/rfc/fcc_in_const_expr

Co-authored-by: Volker Dusch <volker@tideways-gmbh.com>
2025-02-20 18:52:47 +01:00
Christoph M. Becker
252dd1e9f0
Building ext/intl fails with MSVC /std:c11 (#17179)
A previous fix to be able to build C++ extensions with MSVC[1], was
based on the assumption that `max_align_t` would be defined in stddef.h
on Windows.  That was plain wrong; there is no such typedef (or macro).

Thus we revert that fix, and instead make an exception for Windows,
where we always use the fallback definition, which should work fine on
Windows.

[1] <ab449a7e46>
2025-02-20 15:14:58 +01:00
Remi Collet
c5ee870b85
Merge branch 'PHP-8.4'
* PHP-8.4:
  zip version is now 1.22.5
2025-02-20 11:48:09 +01:00
Remi Collet
04a33a1122
zip version is now 1.22.5 2025-02-20 11:47:51 +01:00
Arnaud Le Blanc
bcf0ee185b
UPGRADING for GH-17698 2025-02-19 17:04:57 +01:00
Dmitry Stogov
3b23de31db
Merge branch 'PHP-8.4'
* PHP-8.4:
  Update IR
2025-02-18 21:32:45 +03:00
Dmitry Stogov
352aca1ee1
Update IR
IR commit: 7f920cb660a1ef615a3059eab77b86ca1a43121e
2025-02-18 21:32:17 +03:00
Christoph M. Becker
3d9a0a0c17
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17837: ::getColumnMeta() on unexecuted statement segfaults
2025-02-18 17:03:33 +01:00
Christoph M. Becker
4a514f653a
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17837: ::getColumnMeta() on unexecuted statement segfaults
2025-02-18 17:03:00 +01:00
Niels Dossche
da38477544
Merge branch 'PHP-8.4'
* PHP-8.4:
  NEWS for GH-17794
2025-02-17 21:58:46 +01:00
Niels Dossche
4bc7330655
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  NEWS for GH-17794
2025-02-17 21:58:39 +01:00
Niels Dossche
a54ed9eb24
Fix GH-17727: JIT SEGV on OOM in dtor when creating backtrace
This became visible after GH-17056 was merged, but technically the lack
of setting the opline is also present on lower branches.
We set the opline to mirror the SAVE_OPLINE() from
ZEND_INIT_STATIC_METHOD_CALL().

Closes GH-17732.
2025-02-17 19:32:22 +01:00
Niels Dossche
033a66bac8
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix lowercase HTML attribute exceptions
  Fix GH-17802: \Dom\HTMLDocument querySelector attribute name is case sensitive in HTML
2025-02-17 19:32:01 +01:00
Niels Dossche
74df3e0404
Fix lowercase HTML attribute exceptions
Closes GH-17815.
2025-02-17 19:31:50 +01:00
Niels Dossche
3a4a320386
Fix GH-17802: \Dom\HTMLDocument querySelector attribute name is case sensitive in HTML
According to https://html.spec.whatwg.org/#case-sensitivity-of-selectors,
the CSS selector attribute name must be converted to lowercase in HTML elements,
and then compared case-sensitive to the attribute name in the element.
We implement this not by doing the explicit conversion, but by a manual
loop using a function that first converts the rhs characters to
lowercase and keeps the lhs characters the same, achieving the same
effect.
2025-02-17 19:31:23 +01:00
Arnaud Le Blanc
8af9042405
Use new ZPP and inline caches in ReflectionProperty::getValue() and variants (#17698)
Apply the following changes to ReflectionProperty::getValue(), ::getRawValue(), ::isInitialized(), ::setValue(), ::setRawValue():

- Pass a cache slot to the property handler
- Inline the simple case of fetching a declared property
- Use the new parameter parsing API

This results in run time decrease of 12% to 59% in [micro benchmarks](https://gist.github.com/arnaud-lb/2de08142dcd0c7b49caed21398f44656), when executed with `hyperfine -L version base,opt "/tmp/{version}/sapi/cli/php -d opcache.enable_cli=1 $script"`:

```
get-raw-value.php:   -58%
get-value-dyn.php:   -50%
get-value-hook.php:  -47%
get-value.php:       -59%
is-initialized.php:  -59%
set-value.php:       -11%
```

And a 1.8% decrease in this Doctrine benchmark: 505825290d...reflection-property-get-value-opt
2025-02-17 13:46:59 +01:00
Ayesh Karunaratne
395c3fbe9f
UPGRADING: Add CURLINFO_USED_PROXY, HTTPAUTH_USED, and PROXYAUTH_USED
Follow-up to GH-17816.
2025-02-17 17:46:59 +07:00
Ayesh Karunaratne
d6b1d2e4ca
Merge branch 'Ayesh-curl/8-12/auth-used-consts'
* Ayesh-curl/8-12/auth-used-consts:
  ext/curl: Add `CURLINFO_{USED_PROXY,HTTPAUTH_USED,PROXYAUTH_USED}`
2025-02-17 17:39:02 +07:00
Ayesh Karunaratne
6a319928c4
ext/curl: Add CURLINFO_{USED_PROXY,HTTPAUTH_USED,PROXYAUTH_USED}
Adds support for `curl_getinfo()` info keys and additional array keys:

 - [`CURLINFO_USED_PROXY`](https://curl.se/libcurl/c/CURLINFO_USED_PROXY.html) - `libcurl` >= 8.7.9 -
   Zero if no proxy was used in the previous transfer or a non-zero value if a proxy was used.
 - [`CURLINFO_HTTPAUTH_USED`](https://github.com/curl/curl/blob/curl-8_12_0/docs/libcurl/opts/CURLINFO_HTTPAUTH_USED.md) - `libcurl` >= 8.7.9 -
   Bitmask indicating the authentication method that was used in the previous HTTP request.
 - [`CURLINFO_PROXYAUTH_USED`](https://github.com/curl/curl/blob/curl-8_12_0/docs/libcurl/opts/CURLINFO_PROXYAUTH_USED.md) - `libcurl` >= 8.12.0 -
   Bitmask indicating the authentication method that was used in the previous request done over an HTTP proxy.

```php
curl_getinfo($ch);
```
```php
[
	// ...
	"used_proxy" => 0,
	"httpauth_used" => 0,
	"proxyauth_used" => 0,
]
```

This also updates the `Caddyfile` for curl tests to add a new route
that supports HTTP basic auth.
2025-02-17 17:37:27 +07:00
Dmitry Stogov
3967b7a75e
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix FFI Parsing of Pointer Declaration Lists (#17794)
2025-02-17 10:27:47 +03:00
Dmitry Stogov
ddde315035
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix FFI Parsing of Pointer Declaration Lists (#17794)
2025-02-17 10:27:33 +03:00
Christoph M. Becker
6ccb35ec94
Merge branch 'PHP-8.4'
* PHP-8.4:
  Adapt tests to Windows 11
2025-02-17 00:09:17 +01:00
Christoph M. Becker
8a6370d7a9
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Adapt tests to Windows 11
2025-02-17 00:08:43 +01:00
Christoph M. Becker
08ace8409d
Merge branch 'PHP-8.4'
* PHP-8.4:
  Prevent using system DLLs when running the tests
2025-02-16 23:08:21 +01:00
Christoph M. Becker
7a734caacc
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Prevent using system DLLs when running the tests
2025-02-16 23:06:54 +01:00
DanielEScherzer
0d8b139bc1
Zend/tests: organize some tests with sub directories (7) (#17826)
Create a new subdirectory for tests relating to inheritance

Work towards GH-15631
2025-02-16 15:55:03 +00:00
Niels Dossche
8f5a6ff60d
Reduce memory allocations in querySelector resolution (#17821)
These memory allocations at the entry don't need to happen because
they're live for the entire evaluation.
2025-02-16 16:36:49 +01:00
Niels Dossche
e92848789a
Upgrade bundled pcre2lib to 10.45 (#17825) 2025-02-16 12:16:46 +01:00
David CARLIER
3b82367871
Fix GH-17831: zend_test_compile_string crash on nul bytes check. (#17832)
Setting check_null previously was due to misunderstanding its purpose
2025-02-16 11:14:19 +00:00
DanielEScherzer
a1da7cac85
basic_functions: update error_log documentation [skip ci] (#17828)
Sending to a TCP/IP address is not an option anymore, and it hasn't been since
before the file was created in this repo in 1999 (257de2b). Based on
php/doc-en@d522d135a1 it appears that this
feature was part of PHP 3 and removed before PHP 4. I tried to track down the
original code to find when it was actually removed but wasn't able to find a
PHP 3 repository.
2025-02-16 10:22:18 +01:00
David CARLIER
18df1e4783
ext/gd create gd object with zend_object_alloc (#17823)
while at it, fix build warning "wrong" calloc arguments order
2025-02-16 00:05:37 +00:00
Niels Dossche
82bdc8a2ad
Merge branch 'PHP-8.4'
* PHP-8.4:
  [ci skip] Fix GH-17808 dependencies
2025-02-16 00:17:12 +01:00
Niels Dossche
d6c3079910
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [ci skip] Fix GH-17808 dependencies
2025-02-16 00:17:06 +01:00
Niels Dossche
cbdc1f3f72
Revert "Reduce number of string duplications in phar (#17814)"
This reverts commit 619d29386a.

Just Windows things...
2025-02-16 00:16:08 +01:00
Niels Dossche
5c1dad8e36
Revert "Fix Windows build for GH-17814 and add extension dependency (#17819)"
This reverts commit 5cce35c647.
2025-02-16 00:16:04 +01:00
David CARLIER
dbea8d3385
ext/spl: use zend_object_alloc to create SplObjectStorage instances. (#17824) 2025-02-15 22:33:44 +00:00
David CARLIER
05a155782b
ext/gmp: use zend_object_alloc instead to initialize GMP instances. (#17822) 2025-02-15 19:09:36 +00:00
Christoph M. Becker
ed9c283589
Fail build_task.bat if main nmake failed (GH-17820)
Otherwise we may not notice Windows CI build failures.

Fixes GH-17818.
2025-02-15 18:26:11 +01:00
Niels Dossche
5cce35c647
Fix Windows build for GH-17814 and add extension dependency (#17819) 2025-02-15 17:04:55 +01:00
DanielEScherzer
a50f82bebf
Zend/tests: organize some tests with sub directories (6) (#17807)
Move more tests into existing directories

Work towards GH-15631
2025-02-15 14:55:07 +00:00
Niels Dossche
619d29386a
Reduce number of string duplications in phar (#17814)
We don't need to duplicate these strings from the resource, we can just
use them with an offset.
To prove this was safe, I had to make the arguments const and then
propagate that everywhere, so this patch also introduces some more
constness.
2025-02-15 15:20:29 +01:00
Niels Dossche
c7d62cfd76
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17808: PharFileInfo refcount bug
2025-02-15 13:16:40 +01:00
Niels Dossche
5d8ea65f43
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17808: PharFileInfo refcount bug
2025-02-15 13:16:33 +01:00
Niels Dossche
a570ce8f40 Remove custom patches that are no longer in upstream
These were introduced in 6747068c, but they don't seem to be in upstream
(anymore). For the entry in rpm it may have even been a mixup with the
two sections in the rpm file: there's a "10 string" entry but only in
the delta part.
2025-02-15 12:53:07 +01:00
Niels Dossche
37dbad8fcd Upgrade to file 5.46 2025-02-15 12:53:07 +01:00
David CARLIER
d3da2a2884
zend_test: zend_test_compile_string converting script argument to path. (#17810) 2025-02-15 11:15:08 +00:00
David Carlier
01a87e0d2d
Merge branch 'PHP-8.4' 2025-02-15 10:12:34 +00:00
David Carlier
eabbb1c1c6
Merge branch 'PHP-8.3' into PHP-8.4 2025-02-15 10:12:20 +00:00
Shivam Mathur
246c57352e Merge branch 'PHP-8.3' into PHP-8.4 2025-02-14 23:36:04 +00:00
Niels Dossche
c696087e32
Fix error message on Windows 2025-02-15 00:23:38 +01:00
Niels Dossche
b3dd5a4c86
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix zlib support for large files
  Fix memory leak on overflow in _php_stream_scandir()
2025-02-14 23:11:17 +01:00
Niels Dossche
8f8d4be5eb
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix zlib support for large files
  Fix memory leak on overflow in _php_stream_scandir()
2025-02-14 23:10:40 +01:00
Christoph M. Becker
252b52ac5a
Improve COM ctor exception code for failing ProgIDs (GH-17673)
The `$module_name` of `com::__construct()` can be a ProgID, ClassID or
moniker.  We first try `CLSIDFromString()`, and if that fails, we go
ahead and try to treat the `$module_name` as a moniker.  If that also
fails, we throw an exception with the result of `MkParseDisplayName()`
what would just be `MK_E_SYNTAX` if given a ProgID.  This result is
highly confusing for the common case where a ProgID is given, which is
not registered (e.g. due to a typo).  In this case, we use the original
`HRESULT` (`CO_E_CLASSSTRING`) instead.
2025-02-14 17:44:43 +01:00
Christoph M. Becker
fe9c9049ef
Elevate Windows CI to /W3 (sans C4018/C4267) (GH-17665)
C4018[1] is about unsigned/signed comparisons; C4267[2] is about
conversion from `size_t` to a "smaller" type.  We likely should resolve
these warnings in the long run, but for now, it seems like a no brainer
to elevate to `/W3` even if we have to exempt two additional categories
of warnings, since we can catch some others.  And we no longer need to
elevate C4010[3] to a higher level to catch it.

[1] <https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4018>
[2] <https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4267>
[3] <https://learn.microsoft.com/de-de/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4013>
2025-02-14 17:39:54 +01:00
Christoph M. Becker
7c8bd08f6d
Implement zend_safe_address() for MSVC 64bit (GH-17679)
The 32bit implementation seems to be okay, but we rather should avoid
falling back to the double (pun intended) calculation for non `__GNUC__`
systems.  We use the intsafe.h intrinsics instead for MSVC and
compatible compilers.
2025-02-14 17:37:27 +01:00
Christoph M. Becker
e9ffe02fa1
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Fix phpize for Windows 11 (24H2)
2025-02-14 17:19:50 +01:00
Christoph M. Becker
974ed3130e
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [skip ci] Fix phpize for Windows 11 (24H2)
2025-02-14 17:19:18 +01:00
nzsys
2d693c4d4a
[skip ci] Fix: Remove unused code and clean up regex patterns (GH-17791)
- Removed unused variable  from getHeaders function.
- Simplified regex by removing unnecessary lazy quantifiers ().
- Removed unnecessary  flag from regex patterns.
This improves readability and reduces redundant code without altering functionality.
2025-02-14 16:54:12 +01:00
DanielEScherzer
07e5f6fc3d
ReflectionClass::isCloneable(): reduce duplication (GH-17795)
When the `zend_class_entry` has a `zend_function` entry for `clone`, the logic
is the same regardless of if the `reflection_object` entry has an object or
not; the determination is based solely on the flags of the `zend_function`.
2025-02-14 16:50:33 +01:00
David Carlier
77d748617a
Merge branch 'PHP-8.4' 2025-02-14 15:29:32 +00:00
David Carlier
ed18fd073a
Merge branch 'PHP-8.3' into PHP-8.4 2025-02-14 15:28:48 +00:00
Ilija Tovilo
f25eb7f18d
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix curl protocols test expectation
2025-02-14 14:38:58 +01:00
Ilija Tovilo
5b87faaaa7
Fix curl protocols test expectation
Closes GH-17803
2025-02-14 14:38:34 +01:00
David CARLIER
b296712403
zend: gcc 15 will support counted_by(x) instead. (#17790)
gcc gave up on the initial patchset for `element_count` and went
by `counted_by` since last october.
2025-02-14 12:22:10 +00:00
DanielEScherzer
1a468b6efc
Docs: add a page about zend_constant (GH-17072) 2025-02-14 12:49:57 +01:00
DanielEScherzer
d22abca488
Zend/tests: organize some tests with sub directories (5) (#17800)
Second pass through `Zend/tests/bug*` to organize the tests.

Move tests to existing sub directories, and create some new sub directories:
* `ArrayAccess`
* `autoload`
* `clone`
* `serialize` (also covers `unserialize()`)
* `switch`

Work towards GH-15631
2025-02-14 11:49:14 +00:00
DanielEScherzer
767ddfc86a
bug81626.phpt: replace Cyrillic Small Letter Es [skip ci] (#17799) 2025-02-14 11:47:59 +00:00
David Hein
77d5eb6a5a
[skip ci] Fix tests with multiline titles (GH-17763)
See GH-17761
2025-02-14 12:03:53 +01:00
Daniel Scherzer
367c5b522a gen_stub: stop cloning FramelessFunctionInfo objects
They are immutable
2025-02-14 08:43:00 +01:00
Daniel Scherzer
d8e8ce0e2a gen_stub: stop cloning AttributeInfo objects
They are immutable
2025-02-14 08:43:00 +01:00
Daniel Scherzer
6b741e34d0 gen_stub: whitespace and readability improvements
Remove blank lines at the start of functions, ensure there are spaces between
parameters, split a long function call across multiple lines
2025-02-14 08:43:00 +01:00
Daniel Scherzer
c2f81073fd gen_stub: clean up some variable declarations
Inline single-use variables, remove unneeded forward declarations
2025-02-14 08:43:00 +01:00
Daniel Scherzer
4af64fdbfa gen_stub: convert parseFramelessFunctionInfo() to a constructor
Also mark `FramelessFunctionInfo::$arity` readonly
2025-02-14 08:43:00 +01:00
Daniel Scherzer
9da6050e08 gen_stub: add visibility to class constants
Make everything public for now
2025-02-14 08:43:00 +01:00
Daniel Scherzer
eafddfd3d9 gen_stub: document more readonly class properties 2025-02-14 08:43:00 +01:00
Daniel Scherzer
97cd9fdc13 gen_stub: combine identical condition blocks 2025-02-14 08:43:00 +01:00
Daniel Scherzer
12c89aa853 gen_stub: merge ConstOrClassConstName interface into AbstractConstName
Interface is only directly implemented by the abstract class, no need to have a
separate interface.
2025-02-14 08:43:00 +01:00
DanielEScherzer
f5c9f8bcd3
gen_stub: fix PropertyInfo::getString() version compatibility (#17779)
I forgot a `$this->` in #15751
2025-02-14 08:30:28 +01:00
Niels Dossche
78d934ad8e
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix memory leak when encoding check fails
2025-02-13 19:11:08 +01:00
Niels Dossche
902e01f4f9
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix memory leak when encoding check fails
2025-02-13 19:10:46 +01:00
Tim Düsterhus
55994f83e0
php_gdb: Fix missing casts in ZendAstPrettyPrinter (#17786)
Fixes php/php-src#17782
2025-02-13 17:19:47 +01:00
DanielEScherzer
6e3185049a
gen_stub: set up PHP 8.5 support (#17780)
Add the new known strings from #17755
2025-02-13 16:18:58 +00:00
DanielEScherzer
c3b4359873
[skip ci] run-tests.php: fix some typos (#17783) 2025-02-13 16:18:09 +00:00
DanielEScherzer
a81649f992
Zend/tests: organize some tests with sub directories (4) (#17778)
First pass at moving `Zend/tests/gh*` tests to existing sub directories

Work towards GH-15631
2025-02-13 16:17:36 +00:00
Gina Peter Banyard
65d433161a
Use new known "self" and "parent" zend_strings (#17766) 2025-02-12 15:30:55 +00:00
nzsys
48866b760f
[skip ci] Fix typo in PHPDoc: corrected $attribute to $attributes to (#17774) 2025-02-12 15:26:23 +00:00
Niels Dossche
5acff0e61d
Update NEWS and UPGRADING for zlib flock() support
[ci skip]

Closes GH-17752.
2025-02-11 21:58:05 +01:00
Niels Dossche
4d3d0aeb66
Add test for mandatory zlib locks
Windows has mandatory locks, so we can test the exclusive lock reliably.
2025-02-11 21:56:48 +01:00
Niels Dossche
acb17fb450
Add missing error reporting to reading/writing zlib streams 2025-02-11 21:56:41 +01:00
Niels Dossche
6c706c5714
Implement GH-17668: zlib streams should support locking 2025-02-11 21:56:41 +01:00
Niels Dossche
34e1c590cb
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17747: Exception on reading property in register-based FETCH_OBJ_R breaks JIT
  Fix GH-17745: zlib extension incorrectly handles object arguments
2025-02-11 21:55:51 +01:00
Niels Dossche
34d8befe8d
Fix GH-17747: Exception on reading property in register-based FETCH_OBJ_R breaks JIT
When read_property fails, it may return `&EG(uninitialized_zval)`, and
the exception is handled in the VM. The VM will try to
`zval_ptr_dtor_nogc` the result, but the result was never set, resulting
in dtor'ing garbage data. To solve this, we check when a different zval*
was returned and initialize the result with UNDEF. We don't need to copy
as the slow_ex handler return values are used directly in a register.

Closes GH-17749.
2025-02-11 21:55:23 +01:00
Niels Dossche
0e0d2d21b7
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17745: zlib extension incorrectly handles object arguments
2025-02-11 21:53:52 +01:00
Gina Peter Banyard
ac52b5b738
Zend: Add const specifier to resolve_class_name() 2025-02-11 19:48:05 +00:00
Gina Peter Banyard
8ebf986587
Zend: Add tests for relative types (#17764) 2025-02-11 15:18:04 +00:00
Gina Peter Banyard
1ad7743133
Zend: Resolve self and parent types at compile time (#17755)
This does not apply to traits.
2025-02-11 15:15:32 +00:00
Gina Peter Banyard
15d7b83ad3
ext/pdo: Improve test so that output is decipherable (#17394) 2025-02-11 13:30:35 +00:00
David Carlier
ddd1dd0c4b
ext/sockets: adding BSD IP_BINDANY constant.
Simply allows the socket to bind to any address, including one not
bound to any network interface.

close GH-17591
2025-02-11 13:10:42 +00:00
Christoph M. Becker
e4999275c2
Fix GH-17658: COMPersistHelper::LoadFromStream() can segfault (GH-17659)
* Fix GH-17658: COMPersistHelper::LoadFromStream() can segfault

The actual fix is trivial, but to be able to test the behavior we have
to introduce an own COM object, since existing persistable objects
likely implement `IPersistInit`, not only `IPersist`.  We also want to
avoid further test dependencies on possibly unavailable objects, such
as `Word.Application`.

To this purposes, we add a small COM in-process server, which may be
extended for other testing purposes.  We keep it simple by implementing
it in C++, but without using any more sophisticated frameworks like ATL.

This component needs to be built explicitly (`nmake comtest.dll`), and
also needs to be explicitly registered (`nmake register_comtest`).
When no longer needed, it is possible to unregister the component
(`nmake unregister_comtest`).
2025-02-11 12:42:25 +01:00
Christoph M. Becker
e6c570a22f
Prevent unsigned overflow in php_handle_swc() (GH-17678)
The multiplication of `ZSTR_LEN(bufz)` with the `factor` can easily
overflow on LLP64 architectures, causing a smaller `buf` to be
allocated than expected.  While there are no security implications,
calling `uncompress()` with the small buffer cannot be successful
(`Z_BUF_ERROR`).  We avoid such superfluous calls by bailing out of
the loop early in case of an overflow condition.

Note that `safe_emalloc()` would not help here, since that will not
prevent 32bit unsigned overflow on 64bit architectures.
2025-02-11 00:47:55 +01:00
Christoph M. Becker
650086f3e6
Exclude unused functions from compilation units (GH-17686)
This avoids Clang complaining with `-Wunused-function`.

We also introduce the macro `PRELOAD_SUPPORT` for clarification.
2025-02-10 18:00:19 +01:00
Dmitry Stogov
6deaaf609f
Merge branch 'PHP-8.4'
* PHP-8.4:
  Update IR
2025-02-10 16:48:11 +03:00
Dmitry Stogov
9fb355b863
Update IR
IR commit: 8ec4979470fe2a123d0e56da92aa8d5d19b6e54c
2025-02-10 16:47:47 +03:00
Niels Dossche
2acda557cd Pack _php_sqlite3_db_object 2025-02-10 08:42:11 +01:00
Niels Dossche
9ee08999f4 Convert initialised to bool 2025-02-10 08:42:11 +01:00
Niels Dossche
dbf7d4402c Convert is_prepared_statement to bool 2025-02-10 08:42:11 +01:00
Niels Dossche
e14f9f4c42 Pack _php_sqlite3_result_object 2025-02-10 08:42:11 +01:00
Niels Dossche
5eae6d1405 Don't store the object zval directly 2025-02-10 08:42:11 +01:00
Niels Dossche
c0d910d506 Get rid of always-false intern checks
These checks are always false because we're receiving a valid
zend_object.
2025-02-10 08:42:11 +01:00
Niels Dossche
bc74cff479 Get rid of unnecessary wrapping a statement in a free list object
This simplifies the code and reduces memory usage.
2025-02-10 08:42:11 +01:00
Niels Dossche
43ac692a09 Use faster string operations in sqlite3 2025-02-10 08:42:11 +01:00
DanielEScherzer
bce1f4aeb1
Zend/tests: organize some tests with sub directories (3) (#16444)
First pass at moving `Zend/tests/bug*` tests to existing sub directories

Work towards GH-15631
2025-02-10 00:35:51 +00:00
Niels Dossche
7b13105120
Merge branch 'PHP-8.4'
* PHP-8.4:
  Add .gitignore section for additional test build files
2025-02-09 23:25:38 +01:00
Niels Dossche
466d2c1797
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Add .gitignore section for additional test build files
2025-02-09 23:25:31 +01:00
Gina Peter Banyard
b757fa812d
ext/pdo_{odbc|pgsql}: Use precomputed data_source_len (#17744)
This is already computed by PDO, no need to recompute it again inside the drivers.
2025-02-09 13:10:20 +00:00
Gina Peter Banyard
4e55889dca
ext/pdo: Refactor validation of fetch mode in PDO statement (#17699)
Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
2025-02-09 00:35:33 +00:00
Gina Peter Banyard
1331a61100
ext/pdo: Use zend_strpprintf() instead of spprintf() (#17743)
Most of the time this will end up as a zend_string in some way anyway, do it directly.
2025-02-08 21:19:46 +00:00
Gina Peter Banyard
5333afa607
ext/pdo: Convert _pdo_dbh_t query_stmt_zval to a zend_object pointer (#17742)
This saves 8 bytes
2025-02-08 19:27:51 +00:00
Jakub Zelenka
bff0ec82a6
Merge branch 'PHP-8.4' 2025-02-08 12:08:19 +01:00
Jakub Zelenka
74d4e67236
Merge branch 'PHP-8.3' into PHP-8.4 2025-02-08 12:07:22 +01:00
Niels Dossche
d3e5dbe45b
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17650: realloc with size 0 in user_filters.c
2025-02-07 20:24:07 +01:00
Niels Dossche
c2e5c58736
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17650: realloc with size 0 in user_filters.c
2025-02-07 20:24:00 +01:00
Tim Düsterhus
6024122e54
Merge branch 'PHP-8.4'
* PHP-8.4:
  Free the trampoline when deprecation on materializing `__callStatic()` of trait throws (#17729)
2025-02-07 10:54:01 +01:00
Tim Düsterhus
041036960c
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Free the trampoline when deprecation on materializing `__callStatic()` of trait throws (#17729)
2025-02-07 10:53:31 +01:00
Arnaud Le Blanc
763865320b
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix ReflectionProperty::getRawValue() and related methods for properties overridden with hooks
2025-02-07 10:49:40 +01:00
Arnaud Le Blanc
24b191a4de
Fix ReflectionProperty::getRawValue() and related methods for properties overridden with hooks
`new Reflectionproperty($scope, $propName)` keeps a reference to the
zend_property_info of $propName declared in $scope. In getRawValue() and
related methods, we use this reference to check whether the property is hooked.

Calling `new ReflectionProperty($scope, $propName)->getRawValue($object)` is
equivalent to the expression $object->$propName from scope $scope (except that
it bypasses hooks), and thus may access an overridden property (unless the
original is private). This property may have hooks and different flags.

Here I fetch the effective property info before checking for hooks and
property flags.

Fixes GH-17713
Closes GH-17714
2025-02-07 10:49:02 +01:00
Tim Düsterhus
35be6d0715
Merge branch 'PHP-8.4'
* PHP-8.4:
  Disallow calls to abstract `__call()` / `__callStatic()` (#17719)
2025-02-07 09:37:40 +01:00
Tim Düsterhus
e13d25eb84
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Disallow calls to abstract `__call()` / `__callStatic()` (#17719)
2025-02-07 09:37:28 +01:00
Niels Dossche
459fc9de78
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17704: ldap_search fails when $attributes contains a non-packed array with numerical keys
2025-02-06 23:31:46 +01:00
Niels Dossche
e3a23069c9
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17704: ldap_search fails when $attributes contains a non-packed array with numerical keys
2025-02-06 23:31:30 +01:00
Gina Peter Banyard
78714d0fc5
ext/openssl: Use zend_result return type instead of int where applicable (#17721) 2025-02-06 16:59:43 +00:00
Jakub Zelenka
d662ab5f08
Introduce openssl backend for v1 and v3 API separation (#16918)
The main purpose of this is to better handle the API difference and add
an inital work to separate PHP and OpenSSL logic. This is really just
the first step and further changes are coming after that.

Closes GH-16918
2025-02-06 15:50:05 +01:00
Ilija Tovilo
cd306661a2
Merge branch 'PHP-8.4'
* PHP-8.4:
  Add CONFLICT all to random port test
2025-02-06 15:26:09 +01:00
Ilija Tovilo
4ac2c3653b
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Add CONFLICT all to random port test
2025-02-06 15:26:02 +01:00
Dmitry Stogov
cdaa69e122
Merge branch 'PHP-8.4'
* PHP-8.4:
  IR Update
2025-02-06 02:04:36 +03:00
Dmitry Stogov
c730175be8
IR Update
IR commit: 36329a0398ff57929c51c52084027730a75b9862
2025-02-06 02:04:03 +03:00
David Carlier
65a20d5a09
Merge branch 'PHP-8.4' 2025-02-05 19:41:16 +00:00
David Carlier
dc7b661a60
Fix GH-17703: imagescale both width and heigh set with negative values.
Throwing a ValueError in this particular case.

close GH-17708
2025-02-05 19:39:51 +00:00
Christoph M. Becker
dd66bb9817
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix curl_basic_022.phpt for libcurl 8.12.0
2025-02-05 19:24:37 +01:00
Christoph M. Becker
e9d4fc184d
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix curl_basic_022.phpt for libcurl 8.12.0
2025-02-05 19:23:52 +01:00
Ilija Tovilo
4172b60818
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix segfault when assigning to backing value by-ref from hook
2025-02-05 18:06:41 +01:00
Ilija Tovilo
ab6977d36c
Fix segfault when assigning to backing value by-ref from hook
Fixes oss-fuzz #391975641
Closes GH-17620
2025-02-05 18:06:05 +01:00
Tim Düsterhus
e3798c2ab9
sapi/cli: Extend --ini to print INI settings changed from the builtin default (#17459)
* sapi/cli: Extend `--ini` to print INI settings changed from the builtin default

This is intended to make it easier to check whether or not a given INI setting
is changed from the default when building reproducers for a bugreport, without
forgetting any that might be relevant to the report.

As an example, running `sapi/cli/php -c /etc/php/8.3/cli/ --ini` on my Ubuntu
will now output:

    Configuration File (php.ini) Path: /usr/local/lib
    Loaded Configuration File:         /etc/php/8.3/cli/php.ini
    Scan for additional .ini files in: (none)
    Additional .ini files parsed:      (none)

    Non-standard INI settings:
    allow_url_include: "0" -> ""
    auto_append_file: (none) -> ""
    auto_prepend_file: (none) -> ""
    display_errors: "1" -> ""
    display_startup_errors: "1" -> ""
    enable_dl: "1" -> ""
    error_reporting: (none) -> "22527"
    html_errors: "1" -> "0"
    ignore_repeated_errors: "0" -> ""
    ignore_repeated_source: "0" -> ""
    implicit_flush: "0" -> "1"
    log_errors: "0" -> "1"
    mail.add_x_header: "0" -> ""
    mail.mixed_lf_and_crlf: "0" -> ""
    max_execution_time: "30" -> "0"
    memory_limit: "128M" -> "-1"
    request_order: (none) -> "GP"
    session.cookie_httponly: "0" -> ""
    session.gc_divisor: "100" -> "1000"
    session.gc_probability: "1" -> "0"
    session.sid_bits_per_character: "4" -> "5"
    session.sid_length: "32" -> "26"
    short_open_tag: "1" -> ""
    unserialize_callback_func: (none) -> ""
    user_dir: (none) -> ""
    variables_order: "EGPCS" -> "GPCS"
    zend.assertions: "1" -> "-1"
    zend.exception_ignore_args: "0" -> "1"
    zend.exception_string_param_max_len: "15" -> "0"

* Improve phrasing

Co-authored-by: Michael Voříšek <mvorisek@mvorisek.cz>

* NEWS/UPGRADING

---------

Co-authored-by: Michael Voříšek <mvorisek@mvorisek.cz>
2025-02-05 17:54:52 +01:00
Christoph M. Becker
107bd080a5
Fix Clang style nits (GH-17685)
This addresses all `-Wlogical-op-parentheses` and `-Wmissing-braces`
warnings across the whole code base (all Windows specific code).
2025-02-05 14:13:56 +01:00
DanielEScherzer
dc7161cffe
UPGRADING: fix some typos [skip ci] (#17701) 2025-02-04 21:25:44 +01:00
Gina Peter Banyard
790286ab6c ext/pdo: Pass argument number to pdo_dbh_attribute_set() 2025-02-04 19:28:47 +00:00
Gina Peter Banyard
b6febd1356
ext/pdo: Revome useless ext/standard header include 2025-02-04 18:14:05 +00:00
Gina Peter Banyard
598f982a6b
ext/pdo: Add const modifiers to pdo_get_TYPE_param() functions 2025-02-04 18:13:33 +00:00
Christoph M. Becker
61f42f2d4e
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17503: Undefined float conversion in mb_convert_variables
2025-02-04 15:55:06 +01:00
Christoph M. Becker
47a0922dee
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17503: Undefined float conversion in mb_convert_variables
2025-02-04 15:53:24 +01:00
Ilija Tovilo
7ee1a87e7d
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Another flaky phar macOS test
2025-02-04 14:52:38 +01:00
Ilija Tovilo
d3101fb420
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [skip ci] Another flaky phar macOS test
2025-02-04 14:52:31 +01:00
Gina Peter Banyard
4fcbdea974 ext/pdo: Turn lazy_object_ref into a zend_object* from a zval
This saves 8 bytes
2025-02-04 11:23:08 +00:00
Gina Peter Banyard
9054a8f214 ext/pdo: Add test for lazy fetch mode 2025-02-04 11:23:08 +00:00
Gina Peter Banyard
481bafe943 ext/pdo: Add static modifier for PDORow object handlers 2025-02-04 11:23:08 +00:00
Niels Dossche
9040e795ed
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix fallback paths in fast_long_{add,sub}_function
2025-02-03 22:43:24 +01:00
Niels Dossche
c7d3c5fcb1
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix fallback paths in fast_long_{add,sub}_function
2025-02-03 22:40:41 +01:00
Christoph M. Becker
c1f7b87fb1
Fix MSVC C4267 warnings in gd.c (GH-17680)
These warnings are about conversion from `size_t` to a smaller type[1],
and in this case because `gdIOCtx` works with `int` lengths.  Two of
these warnings are harmless, and we resolve them by using `size_t` in
the first place, and adding a cast (plus an assertion), respectively.

The others actually hint at potential issues when reading image data
with more than `INT_MAX` bytes; we catch that upfront, and throw a
`ValueError` and a warning, respectively.

[1] <https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4267>
2025-02-03 21:02:15 +01:00
Christoph M. Becker
4373c601ea
Remove more unused local variables (GH-17688)
Since `pdo_odbc_ucs22utf8()` doesn't actually use the `stmt`, we drop
this parameter as well.
2025-02-03 20:06:29 +01:00
Niels Dossche
1879ec1713
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17577: JIT packed type guard crash
2025-02-03 19:38:04 +01:00
Niels Dossche
78da288222
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17577: JIT packed type guard crash
2025-02-03 19:35:32 +01:00
Niels Dossche
9b7e08603b
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17654: Multiple classes using same trait causes function JIT crash
2025-02-03 19:28:26 +01:00
Niels Dossche
6d6380c09d
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17654: Multiple classes using same trait causes function JIT crash
2025-02-03 19:28:20 +01:00
Christoph M. Becker
4e6a3cecf5
Don't forward declare static functions in sendmail.h (GH-17684)
sendmail.h is not only included by sendmail.c, but also by
php_win32_globals.h, because that header uses some of the defined
macros.  However, the forward declarations of the static functions are
not needed anywhere else than in sendmail.c, and Clang warns about the
unused functions elsewhere (`-Wunused-function`).  Thus we move the
forward declarations to sendmail.c.
2025-02-03 16:50:32 +01:00
Christoph M. Becker
3fa9e283a0
Drop unused local variables (GH-17682) 2025-02-03 16:42:29 +01:00
Christoph M. Becker
caf5e8a167
Solve C4267 warnings in win32/ioutil for x64 (GH-17674)
C4267[1] are about conversion from `size_t` to a "smaller" type,
causing potential loss of data (aka. truncation).

In this case we can solve that cleanly (i.e. without casting and
further checks) by changing the affected variables to be of type
`DWORD`.

[1] <https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4267>
2025-02-03 00:13:58 +01:00
Gina Peter Banyard
6ae12093ce
ext/pdo: Rearrange struct to pack and group related fields together (#17651)
All bound related fields are now part of the same cache line
2025-02-02 21:25:29 +00:00
Niels Dossche
ff80ec70c6
Add enchant_dict_remove() (#17507) 2025-02-02 19:14:49 +01:00
Niels Dossche
50ed7b58bf
Add non-NULL assertion to zend_get_gc_buffer_add_obj() (#17671)
This would've saved me time when fixing the nightly failure in Laravel [1].

[1] e306a2e0
2025-02-02 19:09:53 +01:00
Christoph M. Becker
5f7a9ee97e
Merge branch 'PHP-8.4'
* PHP-8.4:
  Relax timezone_IDforWindowsID_basic2.phpt expectations
2025-02-02 13:39:13 +01:00
Christoph M. Becker
59ed63732f
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Relax timezone_IDforWindowsID_basic2.phpt expectations
2025-02-02 13:38:36 +01:00
Shivam Mathur
0d8aebf1d9
Fix condition to check for config.w32 in phpize (#17667) 2025-02-02 08:49:16 +05:30
Niels Dossche
e306a2e0e8
Add missing NULL checks in dbstmt_get_gc
This fixes the nightly Laravel failure: 3651202379
2025-02-01 23:58:44 +01:00
Christoph M. Becker
f1702d2bb1
Suppress MSVC C4995 warnings (deprecations)
These have the same meaning as C4996[1] (which we already suppress),
but are triggered by a different mechanism[2].  It makes no sense to
suppress one, but not both.

Of course it would be better not to suppress either, but wrt the two
C4995 warnings we see in php-src, that requires deprecation of using
the ODBC cursor library[3], so might take a while.

[1] <https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4996>
[2] <https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4995>
[3] <https://externals.io/message/126264>

Closes GH-17664.
2025-02-01 22:48:43 +01:00
Christoph M. Becker
236e12e5f0
Drop --with-uncritical-warn-choke configuration option
This selection of suppressed warnings is pretty arbitrary, and
apparently disabling it does not raise any more warning for whole
php-src (except for `-Wno-deprecated-declarations`).  As such it
appears to be pretty useless, and it seems to be more appropriate to
let users select which warnings to suppress via manually set `CFLAGS`.

Since we already apply `/wd4996`[1] when building with MSVC, and there
are indeed plenty of deprecation warnings, for now, we apply
`-Wno-deprecated-declarations` for Clang builds unconditionally.

[1] <https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4996>

Closes GH-17554.
2025-02-01 15:09:40 +01:00
Christoph M. Becker
ed92da89a9
Refactor uncompress() loop in php_handle_swc() (GH-17574)
As is, MSVC raises C4334[1] to hint at a potential code issue.  We
could solve this with a cast, but actually the code is unclear as is
because `factor` is not the factor, but rather the factor`s power.
Thus we refactor the loop variant, and also fix the comment.

[1] <https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4334>
2025-02-01 13:17:45 +01:00
Niels Dossche
28751d32c2
Fix nightly failure in socket_afpacket.phpt
Alpine has a slighly differently worded error message, so relax the test:

"unable to retrieve peer name [95]: Not supported"
2025-02-01 12:39:15 +01:00
Christoph M. Becker
a611be4c07
Elevate Windows CI to /W2 (sans C4146/C4244) (GH-17581)
C4146[1] is about unary minus applied to unsigned operands; that
behavior is well defined, and apparently used deliberately in the code
base.

C4244[2] is about possible loss of data when converting to another
arithmetic type.  This is addressed by another PR[3].

Anyhow, it seems like a no brainer to elevate to `/W2` even if we have
to exempt two categories of warnings, since we can catch some others.

[1] <https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-2-c4146?view=msvc-170>
[2] <https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-2-c4244>
[3] <https://github.com/php/php-src/pull/17076>
2025-02-01 12:25:24 +01:00
Christoph M. Becker
64830b9b3d
Reuse EG(windows_version_info) in php_get_uname() (GH-17558)
There is no need to retrieve the Windows OS version information again,
since it is already available via `EG(windows_version_info)`.
2025-02-01 11:23:53 +01:00
Christoph M. Becker
3955b01653
Avoid duplicate build rules
On Windows, the cli and phpdbg SAPIs have variants (cli-win32 and
phpdbgs, respectively) which are build by default.  However, the
variants share some files, what leads to duplicate build rules in the
generated Makefile.  NMake throws warning U4004[1], but proceeds
happily, ignoring the second build rule.  That means that different
flags for duplicate rules are ignored, hinting at a potential problem.

We solve this by introducing an additional (optional) argument to
`SAPI()` and `ADD_SOURCES()` which can be used to avoid such duplicate
build rules.  It's left to the SAPI maintainers to make sure that
appropriate rules are created.  We fix this for phpdbgs right away,
which currently couldn't be build without phpdbg due to the missing
define; we remove the unused `PHP_PHPDBG_EXPORTS` flag altogether.

[1] <https://learn.microsoft.com/en-us/cpp/error-messages/tool-errors/nmake-warning-u4004>

Closes GH-17545.
2025-02-01 11:21:09 +01:00
Niels Dossche
8deca2838c
Fix initializer for older C compilers 2025-01-31 22:45:03 +01:00
Kalle Sommer Nielsen
ed320b500c Fix C23 syntax for VS16 (CI runs VS22) 2025-01-31 22:28:31 +02:00
Ilija Tovilo
16c9652f27
Fix use-of-uninitialized-value of EG(last_fatal_error_backtrace) with ZTS (GH-17639)
Static variables are zeroed, but ts memory is not. Hence, we need to do
it ourselves.
2025-01-31 14:14:53 +01:00
Gina Peter Banyard
b4f275f9f8
Zend: Use ZEND_FCI_INITIALIZED() macro to check if an FCI is initialized (#17291) 2025-01-31 12:10:44 +00:00
Ilija Tovilo
47b7779329
Fix return type of error_get_last()
Since GH-17056, the result may return the backtrace array.

Closes GH-17641
2025-01-31 12:11:54 +01:00
Tim Düsterhus
5052b325fe
zend_execute: Fix misleading UnhandledMatchError messages when exception_string_param_max_len=0 (#17601) 2025-01-31 11:12:19 +01:00
Tim Düsterhus
8c68fe1b5c
Merge branch 'PHP-8.4'
* PHP-8.4:
  zend_execute: Suppress values in `UnhandledMatchError` for `zend.exception_ignore_args=1` (#17619)
2025-01-31 10:21:49 +01:00
Tim Düsterhus
7eaa9f0478
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  zend_execute: Suppress values in `UnhandledMatchError` for `zend.exception_ignore_args=1` (#17619)
2025-01-31 10:21:32 +01:00
Gina Peter Banyard
3ff7758bcf ext/pdo: Refactor PDO::FETCH_CLASS to not rely on a FCI and use a HashTable for ctor_arg
To call the constructor we now only store the CE and a HashTable for the arguments.
This reduces the size of the _pdo_stmt_t struct from 320 bytes to 232 bytes.
Moreover, this now means that the constructor argument array follows the usual CUFA semantics.
This change is a BC break, as string keys now act like named arguments.
Moreover, the automatic wrapping of by-value arguments for by-ref parameters has been dropped, and the usual E_WARNING is now emitted in those cases.

The do_fetch() is heavily refactored to simplify the execution flow, which also makes it easier to understand.
Additionally we add a new bitflag in_fetch to prevent modification of the fetch flags by userland when PDO is fetching from the DB.
2025-01-30 18:48:54 +00:00
Gina Peter Banyard
229df24ae8 Zend/GC: Add zend_get_gc_buffer_add_ht() function 2025-01-30 18:48:54 +00:00
Niels Dossche
b068c2ff94
Fix GH-17442: Engine UAF with reference assign and dtor
Closes GH-17443.
2025-01-30 19:43:03 +01:00
Gina Peter Banyard
09791ed1d1
ext/pdo: Convert database_object_handle zval to zend_object* (#17629)
This saves 8 bytes on the PDO statement struct.

We change the PGSQL PDO driver API to take a zend_object* instead of a zval* at the same time.
2025-01-30 18:34:03 +00:00
Niels Dossche
ef10339fe7
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix memory leak in phpdbg calling registered function
  Partially fix GH-17387
2025-01-30 19:32:28 +01:00
Niels Dossche
29bafa6323
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix memory leak in phpdbg calling registered function
  Partially fix GH-17387
2025-01-30 19:31:38 +01:00
Niels Dossche
6e84c41d05
Fix GH-12856: ReflectionClass::getStaticPropertyValue() returns UNDEF zval for uninitialized typed properties
Closes GH-17590.
2025-01-30 19:22:59 +01:00
Shivam Mathur
efca8cb682
ci: add workflow to trigger windows builds (#17634) 2025-01-30 23:14:59 +05:30
Calvin Buckley
5ad03fb0ce Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix potential read of uninitialized padding data in DOM (#17628)
2025-01-30 11:41:00 -04:00
Niels Dossche
81803b9b09
Fix potential read of uninitialized padding data in DOM (#17628)
The fix for GH-17481 introduced a regression that can cause the read of
uninitialized padding data when going over a chunk boundary during HTML
parsing of UTF-8.
The wrong offset was computed with respect to the input buffer, the
length of the error-corrected UTF-8 code point is not necessarily the
same as the input code point length.
This was not noticed because no CI jobs run with Valgrind nor I do it
regularly, and ASAN doesn't catch uninitialized accesses.
2025-01-30 11:26:58 -04:00
David Carlier
2ea386a516
ext/sockets: linux AF_PACKET support.
close GH-17440
2025-01-30 12:43:35 +00:00
Arnaud Le Blanc
9df1c930bf
GDB script improvements (#17227)
* Support IS_INDIRECT, IS_PTR, IS_ALIAS_PTR when printing zvals
* Pretty print the ce_flags field when pretty printing a zend_class_entry
* Pretty print the const flags when pretty printing a zend_class_constant
* Added a minimal zend_property_info pretty printer to pretty print the flags field
* Added minimal zend_function, zend_op_array, and zend_internal_function pretty printers: The string value is the function/method name, function type (user/internal), and location (when possible). The fn_flags field is pretty printed
* Added a minimal zend_op pretty printer to pretty print the opcode
* Added a zend_refcounted_h pretty printer to pretty print the type_info
* Added minimal pretty printers for zend_object and zend_array
* Print the type and address of pretty-printed structs
* Added gdb commands: print_fn_flags, print_ce_flags, print_prop_flags, print_const_flags, print_ref_type_info, print_opcode, dump_op_array
* Fields of type zend_string, zend_class_entry, zend_array are printed by default in all our pretty printers, using short representation
* Increased the maximum length of printed strings to 200 chars before truncation (was 50)
2025-01-30 12:22:07 +01:00
Ilija Tovilo
fa7c67d622
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix stack overflow detection for variable compilation
2025-01-29 23:28:22 +01:00
Ilija Tovilo
4f91af38cc
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix stack overflow detection for variable compilation
2025-01-29 23:28:16 +01:00
Gina Peter Banyard
0537968f00
ext/pdo: Use zend_object_alloc() for allocating PDORows (#17621)
Follow-up for GH-17606
2025-01-29 19:33:19 +00:00
Gina Peter Banyard
8d95b3da89
ext/pdo: Remove refcount field from _pdo_stmt_t (#17622)
It is unused, and removing it saves 8 bytes on 64 bits systems.
2025-01-29 19:33:06 +00:00
Christoph M. Becker
e1f3249285
Fix snmp_session_error.phpt for 32bit machines (GH-17611)
For `$retries === PHP_INT_MAX` there is no exception on 32bit machines.
To avoid splitting the tests, or even not running it on 32bit, we work
around.
2025-01-29 14:41:15 +01:00
Gina Peter Banyard
b667939b57
ext/pdo: Fix zend_object std layout for _pdo_row_t (#17606)
As of PHP 7 [1] the `std` should be at the end of the struct instead of at the beginning.

See GH-17598 for more UB related details.

[1] https://www.npopov.com/2015/06/19/Internal-value-representation-in-PHP-7-part-2.html#objects-in-php-7
2025-01-29 12:50:01 +00:00
Eric Norris
0a14ab18d2
RFC: Error Backtraces v2 (#17056)
see https://wiki.php.net/rfc/error_backtraces_v2

Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
2025-01-29 12:54:23 +01:00
Saki Takamachi
5bf6e2e378
Merge branch 'PHP-8.4'
* PHP-8.4:
  follow up for #17615
2025-01-29 19:25:05 +09:00
Saki Takamachi
18d96671a5
follow up for #17615
The deleted line has returned, so delete it again.
2025-01-29 19:25:03 +09:00
Saki Takamachi
c9fa625e41
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fixed GH-17398: bcmul memory leak (#17615)
2025-01-29 19:15:23 +09:00
Saki Takamachi
4c90bb2da4
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fixed GH-17398: bcmul memory leak (#17615)
2025-01-29 19:15:10 +09:00
Remi Collet
b0abb49402
Merge branch 'PHP-8.4'
* PHP-8.4:
  relax test for zlib-ng
2025-01-29 11:04:30 +01:00
Remi Collet
6945e60f54
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  relax test for zlib-ng
2025-01-29 11:04:20 +01:00
Niels Dossche
6f4579af85
Introduce php_pdo_stmt_valid_db_obj_handle() (#17567) 2025-01-28 21:54:11 +01:00
Jakub Zelenka
ad6cdb5aaa
Merge branch 'PHP-8.4' 2025-01-28 19:47:10 +01:00
Jakub Zelenka
cf5d227597
Merge branch 'PHP-8.3' into PHP-8.4 2025-01-28 19:46:47 +01:00
Tim Düsterhus
9241ca42bc
zend_object_handlers: Use zend_array_release() in zend_release_properties() and zend_free_trampoline() (#17608) 2025-01-28 19:34:41 +01:00
Niels Dossche
286030d532
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17609: Typo in error message: Dom\NO_DEFAULT_NS instead of Dom\HTML_NO_DEFAULT_NS
  PHP-8.4 is now for PHP 8.4.5-dev
2025-01-28 19:30:55 +01:00
Niels Dossche
359eb30351
Fix GH-17609: Typo in error message: Dom\NO_DEFAULT_NS instead of Dom\HTML_NO_DEFAULT_NS 2025-01-28 19:30:25 +01:00
Calvin Buckley
ef2c371f13
PHP-8.4 is now for PHP 8.4.5-dev 2025-01-28 13:27:39 -04:00
Ilija Tovilo
ed1e47e325
Fix callable variance check (GH-17613)
Caused by GH-15492. While the parent might contain callable, it may also
contain other types. zend_is_class_subtype_of_type() may be checking a
member that is not callable itself. Fall back to the normal class
subtype check.

Discovered by a failing Laravel test in nightly.
2025-01-28 16:45:36 +01:00
Ilija Tovilo
98da67aa9a
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Another flaky macOS phar test
2025-01-28 12:59:31 +01:00
Ilija Tovilo
4d545f91bc
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [skip ci] Another flaky macOS phar test
2025-01-28 12:59:25 +01:00
Ilija Tovilo
68a638d367
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix missing GC_PERSISTENT_LOCAL flag on accel_globals.key
2025-01-28 12:56:00 +01:00
Ilija Tovilo
ac42a8de75
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix missing GC_PERSISTENT_LOCAL flag on accel_globals.key
2025-01-28 12:55:55 +01:00
Ilija Tovilo
dfd8c0ca05
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Another flaky macOS phar test
2025-01-28 12:45:43 +01:00
Ilija Tovilo
c63460c92c
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [skip ci] Another flaky macOS phar test
2025-01-28 12:45:35 +01:00
Christoph M. Becker
06c41ec6c5
Run curl_setopt_ssl.phpt on Windows, too (GH-16086)
The whole point of using `proc_open()` to execute `openssl s_client` is
that we can terminate the process when we're done.  However, when going
through the shell on Windows, we get a handle to the shell process, and
if we terminate that, the grandchild will stay open.  Since the pipes
of the grandchild will stay open, the PHP process will not terminate
either, so the test stalls.

We solve this by simply bypassing the shell.
2025-01-28 01:14:10 +01:00
Ilija Tovilo
3992ffa2c2
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix cve-2014-3538 test
2025-01-27 21:49:16 +01:00
Ilija Tovilo
c1b151020a
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix cve-2014-3538 test
2025-01-27 21:49:10 +01:00
Christoph M. Becker
ef74ea08ce
Drop superfluous php_com_dotnet_object.ce (GH-17603)
* Drop superfluous php_com_dotnet_object.ce

This is readily available via the `zend_object` (i.e. `zo.ce`), so
there is no need to duplicate it.

There is also no need to assign the ce to the std object,
since this is done be `zend_object_std_init()` anyway.
2025-01-27 20:26:57 +01:00
Christoph M. Becker
efcdcd7bde
Drop NetWare support from bundled libgd (GH-17596)
This has been removed from upstream years ago[1], and PHP generally
dropped NetWare support even earlier.

[1] <e6bb110663>
[2] <https://externals.io/message/96838>
2025-01-27 20:00:34 +01:00
Ilija Tovilo
62b34412dc
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix inline zend_string using struct padding
2025-01-27 19:51:58 +01:00
Ilija Tovilo
1432a13413
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix inline zend_string using struct padding
2025-01-27 19:51:47 +01:00
Niels Dossche
f926c5ce81
Fix GH-16883: gzopen() does not use the default stream context when opening HTTP URLs
Otherwise it's not possible to control the context; it's also consistent
with how the standard open functions work.

Closes GH-17589.
2025-01-27 19:25:52 +01:00
Calvin Buckley
a7df6a7759 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix crash in PDO_ODBC statement dtor (#17586)
2025-01-27 13:43:54 -04:00
Calvin Buckley
25bdbf96cf Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix crash in PDO_ODBC statement dtor (#17586)
2025-01-27 13:43:21 -04:00
Ilija Tovilo
b14469b36f
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix mysql mysql_native_password error on CircleCI
2025-01-27 17:14:12 +01:00
Ilija Tovilo
199e42644a
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix mysql mysql_native_password error on CircleCI
2025-01-27 17:13:41 +01:00
Tim Düsterhus
47fc970e03
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix `#[\Deprecated]` for `__call()` and `__callStatic()` (#17592)
2025-01-27 13:41:50 +01:00
Tim Düsterhus
f37b165403
Fix #[\Deprecated] for __call() and __callStatic() (#17592)
* Fix `#[\Deprecated]` for `__call()` and `__callStatic()`

Fixes php/php-src#17597.

* Do not duplicate the `attributes` table in `zend_get_call_trampoline_func()`
2025-01-27 13:41:41 +01:00
Gina Peter Banyard
60ee42eb3e
Merge branch 'PHP-8.4'
* PHP-8.4:
  ext/pdo: Fix a UAF when changing default fetch class ctor args
2025-01-26 23:41:42 +00:00
Gina Peter Banyard
7f321a1313
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  ext/pdo: Fix a UAF when changing default fetch class ctor args
2025-01-26 23:37:14 +00:00
Christoph M. Becker
ab996934eb
Drop misleading comments about undefined behavior (GH-17532)
There is no undefined behavior here.  If `BitScan*()` returns zero, the
value written to the first parameter is undefined, but we return a
reasonable value.
2025-01-26 22:50:52 +01:00
David Carlier
d6c6675bfe
ext/sodium: general buffer upper bounds adjustments.
For zend_string allocations, it was tested against SIZE_MAX now using
ZSTR_MAX_LEN to take in account zend_string type's metadata.

close GH-17588
2025-01-26 19:41:41 +00:00
David Carlier
f82f602ec8
ext/pgsql: few internal changes.
Z_PARAM_STR*/Z_PARAM_PATH. lo_write checks any null byte.

close GH-17587
2025-01-26 19:15:36 +00:00
David Carlier
63b6e905fa
[skip ci] NEW/UPGRADING 2025-01-26 18:35:57 +00:00
David Carlier
71c19e2921
ext/snmp: internals calls renaming 2025-01-26 18:35:05 +00:00
David Carlier
81458f5dcf
ext/snmp: various internals rewrite.
close GH-17368
2025-01-26 18:27:53 +00:00
Christoph M. Becker
bd23d3ab6b
Remove unused variable (GH-17573) 2025-01-26 17:19:40 +01:00
Niels Dossche
613c5e626e
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17572: getElementsByTagName returns collections with tagName-based indexing, causing loss of elements when converted to arrays
2025-01-26 16:22:04 +01:00
Niels Dossche
fc7c353519
Fix GH-17572: getElementsByTagName returns collections with tagName-based indexing, causing loss of elements when converted to arrays
Only (dtd) named node maps should have string-based indexing.
The ce check is fragile, just check for the presence of an xml hash
table.

Closes GH-17580.
2025-01-26 16:21:54 +01:00
Gina Peter Banyard
37cd00e170 ext/pdo: Add a test with a fetchAll() call being interupted partways 2025-01-26 13:31:16 +00:00
Gina Peter Banyard
8a81d005e5 ext/pdo: Add a test creating instances of Directory
This should not be possible, other opaque classes cannot be instantiated in practice as they do not have properties and prevent dynamic properties
2025-01-26 13:31:16 +00:00
Christoph M. Becker
75d7684e9f
Remove useless compiler options (GH-17553)
* `/Fp` provides a path name for procompiled headers[1], but we don't use
  these.
* `/FR` is used to generate .sbr files; these have been important long
  ago for Visual Studio support, but as of Visual Studio 2008 the IDE
  no longer uses .sbr files.
* `/LD` is used to inform the *compiler* that it should build a DLL[3];
  however, we build all DLLs with the *linker*.

[1] <https://learn.microsoft.com/en-us/cpp/build/reference/fp-name-dot-pch-file>
[2] <https://learn.microsoft.com/en-us/cpp/build/reference/fr-fr-create-dot-sbr-file>
[3] <https://learn.microsoft.com/en-us/cpp/build/reference/md-mt-ld-use-run-time-library>
2025-01-25 19:59:12 +01:00
Christoph M. Becker
5890761ef9
Overhaul GD test helpers and affected tests (GH-17309)
* Use type declarations instead of doc-block annotations

* Inline the terrible get_rgb() function

* Always traverse pixels in Z order

libgd stores the pixel as an array of rows, so we should use row-major-
order traversal to improve caching.

* Add assertions to avoid misuse of the functions

The assertion regarding the image dimensions won't break any tests, and
we had it already as a comment.

However, asserting that the images are truecolor images is important
for `calc_image_dissimilarity()` which otherwise would calculate
nonsense, and not unreasonable for `test_image_equals_image()` which
otherwise is overspecified (for our purposes, it doesn't matter which
palette entry a pixel refers to, but rather whether the actual colors
referred by a palette color match).

Since the truecolor assertions break two tests, we fix these by
converting to truecolor.  That should likely be backported to lower
branches.

* Drop implicit conversion to truecolor

Conversion to truecolor is a relatively expensive operation, and as
such should not be implicit; instead test authors are encouraged to use
truecolor images in the first place where possible, or to even find
better ways to verify expectations than doing a full image comparison.

* Merge similarity.inc into func.inc

There is no particular reason to have a separate file for similarity
comparisons.

* Simplify bug43475.phpt and bug64641.phpt

`calc_image_dissimilarity()` calculates the sum of the euclidean
distance of the RGB channels of all pixels.  The euclidean distance is
either zero or greater than or equal to one (but never in ]0, 1[).  The
sum of these values also has this property, so it doesn't make sense to
check for less than 1e-5.  Thus we just call `test_image_equals_file()`
instead.

* Replace calc_image_dissimilarity() with the well-known mse()

`calc_image_dissimilarity()` has the drawback that it did sum up the
pixel differences, so for large images the result could be way larger
than for small images.  It also has the drawback that it likely is not
as well understood as the mean squared error.  Thus we replace it with
the latter, and calculate the mean squared error of the individual RGB
channels (to be precise).  The result is always in range 0..255**2 what
makes reasoning about thresholds easier.
2025-01-25 19:48:38 +01:00
Christoph M. Becker
f698c62361
Fix bug 64823: ZTS GD fails to to find system TrueType font
First, the `$fontfile` parameter actually supports a semicolon
delimited list of fonts (as documented[1]); thus passing the full
string to `VCWD_REALPATH()` or `php_check_open_basedir()` makes no
sense; we could pass the individual parts, but …

Second, libgd uses an elaborate font detection.  There is a hard-
coded `DEFAULT_PATH` which can be overridden by the environment
variable `GDFONTPATH`.  Semantics are like the `PATH` environment
variable.  If `DEFAULT_PATH` was still exposed (it is no longer as of
libgd 2.1.0[2]), we could take that into account, but …

External libgd can be configured with font-config support, so font
aliases and even lookup patterns are supported.  There is no way to
cater to that upfront.

Thus, we no longer interfere with libgd's font lookup.  Checking the
realpath was already doubtful (we didn't even use the resolved path).
Lifting the open_basedir restriction is a bit more delicate, but the
manual still states that open_basedir would not apply, and more
relevant, not much harm can be done, because libgd only passes the
found font to `FT_New_Face()` which likely fails for any non font files
without any error which could reveal sensitive information.  And the
font file is never written.

It should be noted that this solves lookup of system fonts, does not
change the behavior for absolute font paths, but still does not resolve
issues with relative paths to font files in ZTS environments using
external libgd (our bundled libgd has a workaround for that).  This
particular issue cannot be solved, so users of ZTS builds still need to
add `realpath(.)` to the `GDFONTPATH` as documented in the manual (or
pass absolute paths as `$fontfile`).

[1] <https://www.php.net/imagettftext>
[2] <2a921c80fb>

Closes GH-17366.
2025-01-25 19:27:05 +01:00
Christoph M. Becker
f2954bfb79
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix NULL arithmetic in System V shared memory emulation
2025-01-25 18:59:26 +01:00
Christoph M. Becker
5c066e04b2
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix NULL arithmetic in System V shared memory emulation
2025-01-25 18:59:00 +01:00
Christoph M. Becker
fa1af48c83
Merge branch 'PHP-8.4'
* PHP-8.4:
  Use preinstalled MySQL for Windows CI
2025-01-25 17:43:17 +01:00
Christoph M. Becker
be11d97ec7
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Use preinstalled MySQL for Windows CI
2025-01-25 17:42:37 +01:00
Gina Peter Banyard
6fc49ab518
ext/pdo: Convert FETCH_INTO zval to a zend_object pointer (#17525) 2025-01-24 22:59:56 +00:00
Niels Dossche
88bab6e591
Merge branch 'PHP-8.4'
* PHP-8.4:
  [ci skip] NEWS for GH-17122
2025-01-24 23:31:24 +01:00
Niels Dossche
27187bd1da
[ci skip] NEWS for GH-17122 2025-01-24 23:31:11 +01:00
Niels Dossche
f2b010f503
Merge branch 'PHP-8.4'
* PHP-8.4:
  Update test expectation for different Firebird version
2025-01-24 22:10:21 +01:00
Niels Dossche
77130794a3
Update test expectation for different Firebird version
libfbclient 5.0.1 with server 4.0.1 has a different error message and
code.
> Read only sql transaction

Closes GH-17565.
2025-01-24 22:10:08 +01:00
Gina Peter Banyard
5b06a066f6
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Add NEWS entries
  Fix crash in firebird statement dtor
  ext/pdo: Fix memory leak if GC needs to free PDO Statement
2025-01-24 20:22:13 +00:00
Gina Peter Banyard
8ed0d7fe96
Merge branch 'PHP-8.4'
* PHP-8.4:
  Add NEWS entries
  Fix crash in firebird statement dtor
  ext/pdo: Fix memory leak if GC needs to free PDO Statement
2025-01-24 20:20:11 +00:00
Gina Peter Banyard
eda8ce728a
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Add NEWS entries
  Fix crash in firebird statement dtor
  ext/pdo: Fix memory leak if GC needs to free PDO Statement
  Fix GHA config yml error
2025-01-24 20:20:01 +00:00
Gina Peter Banyard
32fb2607a3
Zend: Make Closure a proper subtype of callable (#15492) 2025-01-24 17:32:23 +00:00
Ilija Tovilo
c2fddac8ca
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GHA config yml error
2025-01-24 15:44:53 +01:00
Ilija Tovilo
135cabb48f
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GHA config yml error
2025-01-24 15:44:41 +01:00
Gina Peter Banyard
b2480c3b55
Revert "Add into zval to GC buffer first"
I thought I was on a branch and not master oopsie

This reverts commit bd02141659.
2025-01-24 14:26:42 +00:00
Gina Peter Banyard
bd02141659
Add into zval to GC buffer first 2025-01-24 14:26:11 +00:00
Gina Peter Banyard
3930b6f378
Merge branch 'PHP-8.4'
* PHP-8.4:
  ext/session: Fix GH-17541 (ext/session NULL pointer dereferencement during ID reset)
2025-01-24 14:10:12 +00:00
Gina Peter Banyard
d35904adf2
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  ext/session: Fix GH-17541 (ext/session NULL pointer dereferencement during ID reset)
2025-01-24 14:10:00 +00:00
Ilija Tovilo
d003511467
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Use !cancelled() over always() in GHA config
2025-01-24 14:27:56 +01:00
Ilija Tovilo
64be3296e8
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [skip ci] Use !cancelled() over always() in GHA config
2025-01-24 14:27:49 +01:00
Ilija Tovilo
0126625ded
Merge branch 'PHP-8.4'
* PHP-8.4:
  Skip Symfony/Wordpress in 8.1 build
  Backport nightly.yml
2025-01-24 14:15:10 +01:00
Ilija Tovilo
cbeb95f7ea
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Skip Symfony/Wordpress in 8.1 build
  Backport nightly.yml
2025-01-24 14:15:02 +01:00
Ilija Tovilo
10ccb6bf0d
Drop intel macOS build from push (#17551)
This build becomes less relevant as all currently sold Apple computers
contain Apple Silicon CPUs. This build rarely fails in isolation anyway.
For the time being, we'll keep the nightly builds in all configurations.
2025-01-23 19:17:24 +01:00
Niels Dossche
6d4598eba8
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix type confusion with session SID constant
2025-01-23 19:03:45 +01:00
Niels Dossche
b448d540c2
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix type confusion with session SID constant
2025-01-23 19:03:35 +01:00
Gina Peter Banyard
ad4cbf4e7f
ext/pdo_firebird: Add LSAN suppression for isc_attach_database() (#17544) 2025-01-22 20:51:00 +00:00
Dmitry Stogov
387ce309ba
Merge branch 'PHP-8.4'
* PHP-8.4:
  Update IR
2025-01-22 18:30:56 +03:00
Dmitry Stogov
63965f1de5
Update IR
IR commit: 02909bc123845fc2c41ec333b44b6f5ea1a196fe
2025-01-22 18:30:33 +03:00
David Carlier
3337f22eb1
Merge branch 'PHP-8.4' 2025-01-21 19:34:14 +00:00
Christian Schneider
fa21fce84f
ext/pgsql: Add check for constant PGRES_TUPLES_CHUNK to fix compilation failures
close GH-17540
2025-01-21 19:32:38 +00:00
Christoph M. Becker
aa76127d01
Address more Clang warnings (GH-17506)
We prefer clean solutions (such as declaring the proper type in the
first place, or introducing a portable format specifier) where easily
possible, but resort to casts otherwise.

We also port f1480ab14b.
2025-01-21 20:05:29 +01:00
Niels Dossche
75bd1a9dc0
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix may_have_extra_named_args flag for ZEND_AST_UNPACK
2025-01-21 19:27:24 +01:00
Niels Dossche
0b12db6afa
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix may_have_extra_named_args flag for ZEND_AST_UNPACK
2025-01-21 19:27:19 +01:00
Niels Dossche
c218f62920
Remove always-true check in pdo_stmt.c (#17535)
`check_empty` is checked earlier up, so this variable is always true.
2025-01-21 19:20:57 +01:00
Tim Düsterhus
1aaf2b1899
array_filter: Remove unnecessary refcounting (#17538)
This syncs the implementation with the updated implementation of `array_find()`
in php/php-src#17536. For the following test script:

    <?php

    $array = range(1, 8000);

    $result = 0;
    for ($i = 0; $i < 4000; $i++) {
    	$result += count(array_filter($array, static function ($item) {
    		return $item <= 4000;
    	}));
    }
    var_dump($result);

This change results in:

    Benchmark 1: /tmp/before array_filter.php
      Time (mean ± σ):     696.9 ms ±  16.3 ms    [User: 692.9 ms, System: 3.5 ms]
      Range (min … max):   681.6 ms … 731.5 ms    10 runs

    Benchmark 2: /tmp/after array_filter.php
      Time (mean ± σ):     637.5 ms ±   5.6 ms    [User: 633.6 ms, System: 3.8 ms]
      Range (min … max):   630.2 ms … 648.6 ms    10 runs

    Summary
      /tmp/after array_filter.php ran
        1.09 ± 0.03 times faster than /tmp/before array_filter.php

Or as reported by perf:

    # Samples: 2K of event 'cpu_core/cycles/'
    # Event count (approx.): 2567197440
    #
    # Overhead  Command  Shared Object         Symbol
    # ........  .......  ....................  ........................................................
    #
        37.02%  before   before                [.] zend_call_function
        15.50%  before   before                [.] execute_ex
        10.60%  before   before                [.] zif_array_filter
         9.43%  before   before                [.] zend_hash_index_add_new
         9.13%  before   before                [.] ZEND_IS_SMALLER_OR_EQUAL_SPEC_TMPVARCV_CONST_HANDLER
         8.46%  before   before                [.] zend_init_func_execute_data
         3.78%  before   before                [.] zval_add_ref
         3.47%  before   before                [.] zval_ptr_dtor
         1.17%  before   before                [.] zend_is_true

vs

    # Samples: 2K of event 'cpu_core/cycles/'
    # Event count (approx.): 2390202140
    #
    # Overhead  Command  Shared Object         Symbol
    # ........  .......  ....................  ........................................................
    #
        36.87%  after    after                 [.] zend_call_function
        20.46%  after    after                 [.] execute_ex
         8.22%  after    after                 [.] zend_init_func_execute_data
         7.94%  after    after                 [.] zend_hash_index_add_new
         7.89%  after    after                 [.] zif_array_filter
         6.28%  after    after                 [.] ZEND_IS_SMALLER_OR_EQUAL_SPEC_TMPVARCV_CONST_HANDLER
         3.95%  after    after                 [.] zval_add_ref
         2.23%  after    after                 [.] zend_is_true
2025-01-21 15:43:16 +01:00
Tim Düsterhus
c39d112620
array_find: Remove unnecessary refcounting (#17536)
* array_find: Fix data type for `retval_true`

* array_find: Remove unnecessary refcounting

In a post on LinkedIn [1], Bohuslav Šimek reported that the native
implementation of `array_find()` was about 3× slower than the equivalent
userland implementation. While I was not able to verify this claim, due to a
lack of reproducer provided, I could confirm that the native `array_find()` was
indeed slower than the equivalent userland implementation. For the following
example script:

    <?php

    function my_array_find(array $array, callable $callback): mixed {
        foreach ($array as $key => $value) {
            if ($callback($value, $key)) {
                return $value;
            }
        }

        return null;
    }

    $array = range(1, 10000);

    $result = 0;
    for ($i = 0; $i < 5000; $i++) {
    	$result += array_find($array, static function ($item) {
    		return $item === 5000;
    	});
    }
    var_dump($result);

with the `array_find()` call appropriately replaced for each case, a PHP-8.4
release build provided the following results:

    Benchmark 1: /tmp/before native.php
      Time (mean ± σ):     765.9 ms ±   7.9 ms    [User: 761.1 ms, System: 4.4 ms]
      Range (min … max):   753.2 ms … 774.7 ms    10 runs

    Benchmark 2: /tmp/before userland.php
      Time (mean ± σ):     588.0 ms ±  17.9 ms    [User: 583.6 ms, System: 4.1 ms]
      Range (min … max):   576.0 ms … 633.3 ms    10 runs

    Summary
      /tmp/before userland.php ran
        1.30 ± 0.04 times faster than /tmp/before native.php

Running `native.php` with perf reports that a third of the time is spent in
`zend_call_function()` and another 20% in `execute_ex()`, however
`php_array_find()` comes next at 14%:

    # Samples: 3K of event 'cpu_core/cycles/'
    # Event count (approx.): 2895247444
    #
    # Overhead  Command  Shared Object      Symbol
    # ........  .......  .................  ...........................................
    #
        32.47%  before   before             [.] zend_call_function
        20.63%  before   before             [.] execute_ex
        14.06%  before   before             [.] php_array_find
         7.89%  before   before             [.] ZEND_IS_IDENTICAL_SPEC_CV_CONST_HANDLER
         7.31%  before   before             [.] zend_init_func_execute_data
         6.50%  before   before             [.] zend_copy_extra_args

which was surprising, because the function doesn’t too all that much. Looking
at the implementation, the refcounting stood out and it turns out that it is
not actually necessary. The `array` is passed by value to `array_find()` and
thus cannot magically change within the callback. This also means that the
array will continue to hold a reference to string keys and values, preventing
these values from being collected. The refcounting inside of `php_array_find()`
thus will never do anything useful.

Comparing the updated implementation against the original implementation shows
that this change results in a 1.14× improvement:

    Benchmark 1: /tmp/before native.php
      Time (mean ± σ):     775.4 ms ±  29.6 ms    [User: 771.6 ms, System: 3.5 ms]
      Range (min … max):   740.2 ms … 844.4 ms    10 runs

    Benchmark 2: /tmp/after native.php
      Time (mean ± σ):     677.3 ms ±  16.7 ms    [User: 673.9 ms, System: 3.1 ms]
      Range (min … max):   655.9 ms … 705.0 ms    10 runs

    Summary
      /tmp/after native.php ran
        1.14 ± 0.05 times faster than /tmp/before native.php

Comparing the native implementation against the userland implementation with
the new implementation shows that while the native implementation still is
slower, the difference reduced to 15% (down from 30%):

    Benchmark 1: /tmp/after native.php
      Time (mean ± σ):     670.4 ms ±   9.3 ms    [User: 666.7 ms, System: 3.4 ms]
      Range (min … max):   657.1 ms … 689.0 ms    10 runs

    Benchmark 2: /tmp/after userland.php
      Time (mean ± σ):     576.7 ms ±   7.6 ms    [User: 572.5 ms, System: 3.7 ms]
      Range (min … max):   563.9 ms … 588.1 ms    10 runs

    Summary
      /tmp/after userland.php ran
        1.16 ± 0.02 times faster than /tmp/after native.php

Looking at the updated perf results shows that `php_array_find()` now only
takes up 8% of the time:

    # Samples: 2K of event 'cpu_core/cycles/'
    # Event count (approx.): 2540947159
    #
    # Overhead  Command  Shared Object         Symbol
    # ........  .......  ....................  ...........................................
    #
        34.77%  after    after                 [.] zend_call_function
        18.57%  after    after                 [.] execute_ex
        12.28%  after    after                 [.] zend_copy_extra_args
        10.91%  after    after                 [.] zend_init_func_execute_data
         8.77%  after    after                 [.] php_array_find
         6.70%  after    after                 [.] ZEND_IS_IDENTICAL_SPEC_CV_CONST_HANDLER
         4.68%  after    after                 [.] zend_is_identical

[1] https://www.linkedin.com/posts/bohuslav-%C5%A1imek-kambo_the-surprising-performance-of-php-84-activity-7287044532280414209-6WnA

* array_find: Clean up exception handling

This change has no effect on performance, but greatly improves readability of
the implementation.
2025-01-21 12:27:49 +01:00
Niels Dossche
3786b721e8
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17408: Assertion failure Zend/zend_exceptions.c
2025-01-21 08:21:27 +01:00
Niels Dossche
25543b4566
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17408: Assertion failure Zend/zend_exceptions.c
2025-01-21 08:21:13 +01:00
Tim Düsterhus
0f8340d0a5
zend_ini: Implement zend_ini_string*() in terms of zend_ini_str*() (#17530) 2025-01-20 22:15:23 +01:00
Christoph M. Becker
ce53dab272 Fix Clang builds regarding undefined function call
While MSVC is apparently fine using `_AddressOfReturnAddress()` without
including intrin.h, Clang complains that the function is undefined.  So
we include the header, if `_MSC_VER` is defined, what is the case for
MSVC and clang-cl, but not for some other compilers on Windows (e.g.
GCC).
2025-01-20 14:49:25 +01:00
Gina Peter Banyard
6bd2b8dfa5
ext/pdo: Throw an exception instead of fatal error if the class is not found (#17528) 2025-01-19 23:35:24 +00:00
Gina Peter Banyard
9283abc1a0
ext/pdo: Rename and add tests for PDO::FETCH_CLASS fetch mode (#17526) 2025-01-19 20:33:13 +00:00
Jakub Zelenka
b60f9bf27a
Merge branch 'PHP-8.4' 2025-01-19 20:39:27 +01:00
Jakub Zelenka
b3c297d88f
Merge branch 'PHP-8.3' into PHP-8.4 2025-01-19 20:38:51 +01:00
David Carlier
27125b8c39
Merge branch 'PHP-8.4' 2025-01-19 18:01:52 +00:00
David Carlier
c82e31b026
Fix GH-17516: SplFileTempObject::getPathInfo() crash on invalid class.
This no longer caught the case where an non SplFileInfo/inherited class
of nwas passed since the refactoring in 8.4.

close GH-17517
2025-01-19 18:01:02 +00:00
Kamil Tekiela
a883082f87
Improve mysqli_thread_id test (#17515) 2025-01-19 17:54:01 +00:00
Kamil Tekiela
d6d23fe002
Improve bug74021 test (#17514) 2025-01-19 17:53:54 +00:00
Kamil Tekiela
6919b95010
Ensure charset in tests (#17513) 2025-01-19 17:53:37 +00:00
Gina Peter Banyard
a100450cd9
ext/intl: Call DateTimeInterface::getTimestamp() directly (#17487) 2025-01-19 17:28:36 +00:00
Niels Dossche
b8ee4c2b19
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17518: offset overflow phar extractTo()
2025-01-19 13:06:01 +01:00
Niels Dossche
7cc8719ee5
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17518: offset overflow phar extractTo()
2025-01-19 13:05:55 +01:00
Niels Dossche
675f359e91
Merge branch 'PHP-8.4'
* PHP-8.4:
  Cherry-pick lexbor/lexbor@f94d97a3
2025-01-19 11:51:41 +01:00
Niels Dossche
22704af4b8
Cherry-pick lexbor/lexbor@f94d97a3
Co-authored-by: Alexander Borisov <lex.borisov@gmail.com>
2025-01-19 11:50:56 +01:00
Jorg Adam Sowa
8c11382a52
Removed unused headers from link.c (#16080) 2025-01-19 10:20:03 +01:00
Ayesh Karunaratne
88fc34aa7a
ext/curl: update CURLOPT_PREREQFUNCTION test to validate CURLE_ABORTED_BY_CALLBACK return value
Updates the `CURLOPT_PREREQFUNCTION` test to validate that
connections failed when the PREREQFUNC returns abort returns
CURLE_ABORTED_BY_CALLBACK as the error number.

Previously, it only checked against a hardcoded value. Now, it
checks against the `CURLE_ABORTED_BY_CALLBACK` constant as well.
2025-01-19 11:20:41 +07:00
David CARLIER
252c0c9164
win32: switch handful of memmove over memcpy. (#17508) 2025-01-18 14:47:48 +00:00
David Carlier
709c0a9905
Merge branch 'PHP-8.4' 2025-01-17 22:25:37 +00:00
David Carlier
05a1c04c43
Merge branch 'PHP-8.3' into PHP-8.4 2025-01-17 22:25:24 +00:00
Christoph M. Becker
7dbfacb27e Suppress UB warnings regarding indirect function calls
Like for POSIX systems, we pass `-fno-sanitize=function`.

Closes GH-17462.
2025-01-17 23:00:57 +01:00
Christoph M. Becker
e1c4c0300e Fix Clang lib folder detection on Windows
First, more recent versions of Clang do no longer have trailing info in
parentheses, so the detection would fail.  Since we're not interested
in this information, we just ignore it.

Then we should not rely on Clang being installed in the default program
folder.  Instead we look up where the first clang.exe can be found, and
assume that it is located in a bin/ folder in the installation path.
From there we construct the library path, which is
`lib\clang\<ver>\lib\windows` where `<ver>` is either the full version
(older Clang) or only the major version.  Note that this is the case
for stand-alone LLVM installations as well as Visual Studio supplied
ones.

Finally, we clean up by improving the error messages, and removing the
duplicate clang version detection in `add_asan_opts()`.

While we're at it, we also apply a cosmetic improvement to avoid
(trailing) whitespace in the compiler name (e.g. shown by `-v`).
2025-01-17 23:00:57 +01:00
Niels Dossche
ddfa3934d8
[ci skip] Fix NEWS format 2025-01-17 19:45:59 +01:00
Niels Dossche
0bed3d5d6d
Merge branch 'PHP-8.4'
* PHP-8.4:
  NEWS for GH-17485
  Cherry-pick lexbor/lexbor@e58e1e8c
  Cherry-pick lexbor/lexbor@ae97abfb
  Cherry-pick lexbor/lexbor@e39083b0
2025-01-17 19:44:16 +01:00
Niels Dossche
0b04061e71
NEWS for GH-17485
Fixes GH-17485.
2025-01-17 19:43:08 +01:00
Niels Dossche
d0981864eb
Cherry-pick lexbor/lexbor@e58e1e8c
Co-authored-by: Alexander Borisov <lex.borisov@gmail.com>
2025-01-17 19:39:58 +01:00
Niels Dossche
a928b66447
Cherry-pick lexbor/lexbor@ae97abfb
Co-authored-by: Alexander Borisov <lex.borisov@gmail.com>
2025-01-17 19:39:12 +01:00
Niels Dossche
4531292ad2
Cherry-pick lexbor/lexbor@e39083b0
Co-authored-by: Alexander Borisov <lex.borisov@gmail.com>
2025-01-17 19:39:12 +01:00
Niels Dossche
5471f117c5
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17500: Segfault with requesting nodeName on nameless doctype
2025-01-17 19:37:19 +01:00
Niels Dossche
525aeff070
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17500: Segfault with requesting nodeName on nameless doctype
2025-01-17 19:37:14 +01:00
Christoph M. Becker
dd42ebef94
Drop useless and not quite correct cast (GH-17454)
A while ago, the cast has been changed from `u_char *` to `uint8_t *`,
but neither makes sense, and causes Clang to complain with
`-Wcompare-distinct-pointer-types`.
2025-01-17 17:56:52 +01:00
Gina Peter Banyard
8765e9f5e7 ext/zip: Throw a TypeError if the return value of the cancel callback is not an int 2025-01-17 16:48:28 +00:00
Gina Peter Banyard
dccd4af9aa ext/zip: Cancel operation if user callback throws an exception 2025-01-17 16:48:28 +00:00
Gina Peter Banyard
79b9fe334a ext/zip: Convert cancel_callback to FCC 2025-01-17 16:48:28 +00:00
Gina Peter Banyard
76a5804560 ext/zip: Convert progress_callback to FCC 2025-01-17 16:48:28 +00:00
Gina Peter Banyard
08784ed58a ext/zip: Add some tests for methods taking callbakcs 2025-01-17 16:48:28 +00:00
Niels Dossche
72708f298b
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17481: UTF-8 corruption in \Dom\HTMLDocument
  Fix GH-17486: Incorrect error line numbers reported in Dom\HTMLDocument::createFromString
2025-01-17 16:25:23 +01:00
Niels Dossche
2952e164a9
Fix GH-17481: UTF-8 corruption in \Dom\HTMLDocument
We need to properly handle the case when we return from having too few
bytes, this needs to be handled separately because the while loop
otherwise just performs a partial byte copy.

Closes GH-17489.
2025-01-17 16:25:08 +01:00
Niels Dossche
21c170c75a
Fix GH-17486: Incorrect error line numbers reported in Dom\HTMLDocument::createFromString
Closes GH-17491.
2025-01-17 16:24:28 +01:00
Christoph M. Becker
8a9095a92e
Define PHP_HAVE_BUILTIN_EXPECT for Clang on Windows (GH-17457)
Clang supports `__builtin_expect()` at least as of 4.0.0, which is the
(theoretical) minimum required on Windows, so we define it
unconditionally.  This also solves some macro redefinition warnings in
JIT-IR.
2025-01-17 14:21:02 +01:00
Derick Rethans
e64f674237
Updated to version 2025.1 (2025a) 2025-01-17 11:53:13 +00:00
Derick Rethans
9eb055c9aa
Empty merge 2025-01-17 11:53:13 +00:00
Derick Rethans
4333009190
Updated to version 2025.1 (2025a) 2025-01-17 11:53:12 +00:00
Derick Rethans
2d3dca004a
Empty merge 2025-01-17 11:53:12 +00:00
Christoph M. Becker
36b8a69009
Drop superfluous enum forward declaration (GH-17455)
Besides that it is not needed, it is not proper C, and Clang warns that
"forward references to 'enum' types are a Microsoft extension"
(`-Wmicrosoft-enum-forward-reference`).
2025-01-17 11:45:58 +01:00
Dennis Snell
f2d8420b1c
Test: grapheme_extract should slide properly past error bytes. (#17404)
grapheme_extract should slide properly past error bytes.

Adds a test to assert that the `$next` parameter of `grapheme_extract()`
points to the next byte offset in the input `$haystack` after accounting
for the moved offset, according to the docs:

> If offset does not point to the first byte of a UTF-8 character,
> the start position is moved to the next character boundary.

It seems that the existing behavior is to find the next grapheme
boundary from the original provided offset, but if the offset doesn’t
point to a valid starting byte, the assigned `$next` value will point
to the byte that was immediately decoded in the same call, leading to
possible infinite loops in user-space code.

```
while ( $at < strlen( $s ) ) {
        $grapheme = grapheme_extract( "\x85PHP", 1, GRAPHEME_EXTR_COUNT, $at, $at );
	// never moves past the second byte, always returns 'P'
}
```
2025-01-17 17:12:41 +09:00
Niels Dossche
d0d8e6867a
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17447: Assertion failure when array popping a self addressing variable
2025-01-16 20:29:08 +01:00
Niels Dossche
ae3ab37816
Fix GH-17447: Assertion failure when array popping a self addressing variable
This is the same bug as GH-16957, and fixed in the same way.

Closes GH-17448.
2025-01-16 20:28:51 +01:00
Niels Dossche
a4fa1e728a
Merge branch 'PHP-8.4'
* PHP-8.4:
  Cherry-pick lexbor/lexbor@58c88147
2025-01-16 19:22:55 +01:00
Niels Dossche
ac266c9a05
Cherry-pick lexbor/lexbor@58c88147
See https://github.com/lexbor/lexbor/issues/261.
2025-01-16 19:22:25 +01:00
Jorg Adam Sowa
ac2ce94de0
zend_hrtime: Fix build for macOS without clock_gettime_nsec_np() (#17437) 2025-01-16 18:57:51 +01:00
Christoph M. Becker
5c39a4636b
Replace __forceinline with zend_always_inline in win32/ (GH-17482)
`__forceinline` is MSVC specific (and also understood by Clang on
Windows), but the code in win32/ should not be constrained to these
compilers.  Since we already have `zend_always_inline`, we use this
instead.
2025-01-16 15:05:24 +01:00
Christoph M. Becker
6967de563e
Simplify ZEND_SIGNED_MULTIPLY_LONG() on Windows (GH-17477)
For Clang, we just need to define the respective macros, since these
built-ins are available in all supported Clang versions (>= 4.0.0,
currently)[1].

For MSVC (and possibly other compilers) we use the respective APIs of
intsafe.h[2] which are available as of Windows 7/Server 2008 R2.

For x86 (and to a lesser extend for ARM64) that should also notably
improve performance.

[1] <https://releases.llvm.org/4.0.0/tools/clang/docs/LanguageExtensions.html>
[2] <https://learn.microsoft.com/en-us/windows/win32/api/intsafe/>
2025-01-16 13:57:07 +01:00
Christoph M. Becker
39f1d253b1
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix potential OOB when checking for trailing spaces
2025-01-16 00:03:16 +01:00
Christoph M. Becker
b702eafbff
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix potential OOB when checking for trailing spaces
2025-01-16 00:02:39 +01:00
Christoph M. Becker
8d6f46d9d2
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix NULL arithmetic during system program execution
2025-01-15 22:55:19 +01:00
Christoph M. Becker
5f42cc9e1c
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix NULL arithmetic during system program execution
2025-01-15 22:54:33 +01:00
Gina Peter Banyard
df8ac4af91
ext/pdo_odbc: Do not populate message if there is no driver error (#17478) 2025-01-15 20:46:08 +00:00
David Carlier
951d2f81c7
Merge branch 'PHP-8.4' 2025-01-15 20:37:19 +00:00
David Carlier
6979a7a954
ext/pcntl: Fix pcntl_setcpuaffinity exception type for invalid cpu id.
found while working [on the doc](https://github.com/php/doc-en/pull/4346).

close GH-17474
2025-01-15 20:36:18 +00:00
Gina Peter Banyard
effd3f6212
main: Voidify php_startup_ticks() (#17479)
As it always returns SUCCESS and we ignored the return value anyway
2025-01-15 15:55:42 +00:00
Gina Peter Banyard
b7169a2248
ext/soap: Don't call readfile() userland function (#17432)
* ext/soap: Add some SoapServer tests

* ext/soap: Don't call readfile() userland function

We can perform the operation directly, moreover there is no risk of a user disabling the readfile function and defining their own messing up what we are doing.

* ext/soap: Actually throw a SOAP Fault if the WSDL has disappeared
2025-01-15 14:37:44 +00:00
Christoph M. Becker
7512685767
Use built-ins for addition and subtraction on Windows (GH-17472)
For Clang, we just need to define the respective macros, since these
built-ins are available in all supported Clang versions (>= 4.0.0,
currently)[1].

For MSVC (and possibly other compilers) we use the respective APIs of
intsafe.h[2] which are available as of Windows 7/Server 2008 R2.

This avoids the UB due to signed integer overflow that may happen with
our fallback implementations.

We also drop the superfluous SHORT_MAX definition from pdo_firebird.
This shouldn't be defined unconditionally, but since it is apparently
unused, we remove it altogether.

[1] <https://releases.llvm.org/4.0.0/tools/clang/docs/LanguageExtensions.html>
[2] <https://learn.microsoft.com/en-us/windows/win32/api/intsafe/>
2025-01-15 12:58:12 +01:00
Gina Peter Banyard
abfa377fae ext/pdo: Add FETCH_INTO setting via setAttribute "hack" 2025-01-15 03:02:30 +00:00
Gina Peter Banyard
dfcac15739 ext/pdo: Rename variable, because i is really not descriptive 2025-01-15 03:02:30 +00:00
Dmitry Stogov
4c84ed4d98
Merge branch 'PHP-8.4'
* PHP-8.4:
  Update IR
2025-01-15 02:46:08 +03:00
Dmitry Stogov
9aaa469f99
Update IR
IR commit: d6d7fc489137aab218b04b59d770b497c5ae3832
2025-01-15 02:45:24 +03:00
Niels Dossche
650e59a1c2
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17428: Assertion failure ext/opcache/jit/zend_jit_ir.c:8940
2025-01-14 22:38:18 +01:00
Niels Dossche
3524702fe1
Fix GH-17428: Assertion failure ext/opcache/jit/zend_jit_ir.c:8940
The code to update the call_level in that case skips the opline itself,
as that's handled by the tail handler, and then wants to set the opline
to the last opline of the block because the code below the switch will
update the call_level for that opline.
However, the test has a block with a single opline (THROW). The block
after that has ZEND_INIT_FCALL, because `i` points to ZEND_INIT_FCALL
now, it erroneously causes the call_level after the switch.

Closes GH-17438.
2025-01-14 22:37:41 +01:00
David Carlier
a4e25839d3
Merge branch 'PHP-8.4' 2025-01-14 18:33:00 +00:00
David Carlier
b1e0176455
Merge branch 'PHP-8.3' into PHP-8.4 2025-01-14 18:32:51 +00:00
Ilija Tovilo
e95b298262
Store prop info name in CG(context) instead of prop info
The prop info is not always available, e.g. when compiling the default
value.

See GH-17378
Closes GH-17464
2025-01-14 17:01:10 +01:00
Christoph M. Becker
634edc8ab3
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix clang compiler detection on Windows
2025-01-14 12:36:58 +01:00
Christoph M. Becker
58628e0cc6
Fix clang compiler detection on Windows
A previous commit[1] left a "debug" statement, which causes clang
builds on Windows to fail always.

[1] <b3d6414b87>

Closes GH-17450.
2025-01-14 12:36:19 +01:00
Ilija Tovilo
0e1fbf97f4
Merge branch 'PHP-8.4'
* PHP-8.4:
  Relax final+private warning for trait methods with inherited final
2025-01-13 16:46:54 +01:00
Ilija Tovilo
3c138641e1
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Relax final+private warning for trait methods with inherited final
2025-01-13 16:46:43 +01:00
Ilija Tovilo
a06668af30
Merge branch 'PHP-8.4'
* PHP-8.4:
  __PROPERTY__ does not work in all constant expression contexts
2025-01-13 16:43:32 +01:00
Ilija Tovilo
147e9c808c
__PROPERTY__ does not work in all constant expression contexts
Fixes GH-17222
Closes GH-17378
2025-01-13 16:42:38 +01:00
Gina Peter Banyard
af1e289332 ext/json: Refactor php_json_encode_serializable_object() to call method directly 2025-01-13 13:46:25 +00:00
Gina Peter Banyard
75a15cf640 ext/json: Use zend_result type instead of int 2025-01-13 13:46:25 +00:00
Christoph M. Becker
aac71904ca
Don't pass -fwrapv to clang on Windows (GH-17458)
This is apparently not supported there; the VS supplied clang version
18.1.8, reports:

`clang-cl: warning: unknown argument ignored in clang-cl: '-fwrapv' [-Wunknown-argument]`
2025-01-13 14:10:23 +01:00
Christoph M. Becker
788128aec7
Fix -Wpointer-type-mismatch warning (GH-17453)
`GetProcAddress()` returns a `FARPROC` (aka. `long long (*)()`) which
is not compatible with `void *` per the specs.  However, on Windows
they are, so we silence the warning with a cast.
2025-01-13 13:04:19 +01:00
Christoph M. Becker
1675d32261
Fix printf style issues in Windows specific code (GH-17452)
A couple of calls pass strings as formats (`-Wformat-security`), and
some others mix up types (`-Wformat`).
2025-01-13 11:50:05 +01:00
Christoph M. Becker
26bf239e6d
Resolve -Wincompatible-pointer-types warnings (GH-17456)
The phpdbg issue is a real issue, although it's unlikely that harm can
be done due to stack alignment and little-endianess.  The others seem
to be more cosmetic.
2025-01-13 10:54:13 +01:00
Niels Dossche
f99d62013b
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17139: Fix zip_entry_name() crash on invalid entry
2025-01-12 20:42:59 +01:00
Niels Dossche
fd0cabbbe4
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17139: Fix zip_entry_name() crash on invalid entry
2025-01-12 20:42:53 +01:00
Christoph M. Becker
c264679fb4
Remove braces around string initializers (#GH-17451)
While MSVC is apparently fine with that, Clang complains about it (`-Wbraced-scalar-init`).
2025-01-12 19:40:15 +01:00
Niels Dossche
e6f42c1ed0
Fix incorrect casts 2025-01-11 10:50:07 +01:00
Gina Peter Banyard
11937b3df7
ext/pdo: Add a test for PDO::FETCH_FUNC with a return by-ref callback (#17425) 2025-01-10 17:27:19 +00:00
Niels Dossche
bdcb3e9e69
Merge branch 'PHP-8.4'
* PHP-8.4:
  Backport fix GH-17307
2025-01-10 18:24:57 +01:00
Niels Dossche
27fbdc16ff
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Backport fix GH-17307
2025-01-10 18:24:51 +01:00
Calvin Buckley
97a26ae97a
Update OpenBSD glob implementation for Windows (#16948)
We're considering making this used as a glob implementation on POSIX as
well, but first, we should rebase it from the latest version of OpenBSD.

This also adds a new internal header (charclass.h) for glob.

See conversation in GH-15564.

Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>
2025-01-10 11:47:28 -04:00
Tim Düsterhus
d8d1cb4195
zend_ast: Print placeholder value when printing ZEND_AST_OP_ARRAY (#17405)
As per the discussion in GH-17120, we are printing a placeholder value only.
The commit history of that PR also includes alternative implementations, should
a different decision be desirable.

Fixes GH-17096
Closes GH-17120
2025-01-10 08:37:17 +01:00
Gina Peter Banyard
8d79ed6b3e
ext/pdo: Refactor PDO::FETCH_FUNC to not rely on an FCI on the struct (#17420) 2025-01-09 22:22:52 +00:00
Dmitry Stogov
2d4155a6a9
Merge branch 'PHP-8.4'
* PHP-8.4:
  Update IR
2025-01-10 00:35:33 +03:00
Dmitry Stogov
4763193567
Update IR
IR commit: e445f57f3a936584db28489a49098d52f03388a7
2025-01-10 00:34:58 +03:00
Niels Dossche
8c443016e9
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17307: Internal closure causes JIT failure
  Generate inline frameless icall handlers only if the optimization level is set to inline
  Fix GH-15981: Segfault with frameless jumps and minimal JIT
  Fix GH-15833: Segmentation fault (access null pointer) in ext/spl/spl_array.c
2025-01-09 20:01:16 +01:00
Niels Dossche
28b448ac20
Fix GH-17307: Internal closure causes JIT failure
`bcadd(...)` is a closure for an internal function, and
`zend_jit_push_call_frame` takes into account both last_var and the
difference in argument numbers not only for user code but also for
internal code. However, this is inconsistent with
`zend_vm_calc_used_stack`, causing argument corruption.
Making this consistent fixes the issue.

I could only reproduce the assertion failure when using Valgrind.

Closes GH-17319.
2025-01-09 19:59:38 +01:00
Niels Dossche
c790c5b2e7
Generate inline frameless icall handlers only if the optimization level is set to inline 2025-01-09 19:59:10 +01:00
Niels Dossche
72184abd2f
Fix GH-15981: Segfault with frameless jumps and minimal JIT
Minimal JIT shouldn't generate a call to the complex handler, but
instead rely on the VM and then check for a two-way jump.
This moves the frameless codegen under the check `JIT_G(opt_level) >=
ZEND_JIT_LEVEL_INLINE`.
2025-01-09 19:59:03 +01:00
Niels Dossche
b666dc9788
Fix GH-15833: Segmentation fault (access null pointer) in ext/spl/spl_array.c
We're accessing the object properties table directly in spl, but we're
not accounting for lazy objects. Upon accessing we should trigger the
initialization as spl is doing direct manipulations on the object
property table and expects a real object.

Closes GH-17235.
2025-01-09 19:58:00 +01:00
Niels Dossche
5d4707e22a
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17409: Assertion failure Zend/zend_hash.c:1730
  NEWS
  Add comment
  Fix GH-16892: ini_parse_quantity() fails to parse inputs starting with 0x0b
  Fix GH-16886: ini_parse_quantity() fails to emit warning for 0x+0
  Merge duplicate code blocks
2025-01-09 19:54:52 +01:00
Niels Dossche
3eb79e146f
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17409: Assertion failure Zend/zend_hash.c:1730
  NEWS
  Add comment
  Fix GH-16892: ini_parse_quantity() fails to parse inputs starting with 0x0b
  Fix GH-16886: ini_parse_quantity() fails to emit warning for 0x+0
  Merge duplicate code blocks
2025-01-09 19:54:46 +01:00
Gina Peter Banyard
cc3a729995 ext/ldap: Fix FCC is initialized condition 2025-01-09 16:42:58 +00:00
David Carlier
adcd3ad46b
Merge branch 'PHP-8.4' 2025-01-09 13:46:39 +00:00
David Carlier
e975c27e12
Fix GH-17400: bindtextdomain segfault with UTF-16 domain value.
The provided domain could be a non ascii value even if not supposed to,
in the error reported case was of 4 code points long but domain is "empty" leading to
a NULL return. It worked up to 8.3 "by accident" before the zend_string
conversion and check prior for emptiness.

close GH-17402
2025-01-09 13:45:59 +00:00
Christoph M. Becker
0f40e62ca7
Fix bug 68629: Transparent artifacts when using imagerotate
We port the respective upstream fix[1], which dropped the special cased
implementations of fixed-point arithmetic rotation in favor of the
generic implementation.

We also port follow-up upstream fixes[2][3].

[1] <bd6d2e101f>
[2] <6d21d30429>
[3] <9df878a400>

Closes GH-17375.
2025-01-09 13:19:25 +01:00
Tim Düsterhus
e421a44ac6
zend_ast: Remove unused ZEND_AST_EXIT (#17417)
This AST node is no longer used since `exit()` was made a real function in
GH-13483.
2025-01-09 12:23:33 +01:00
Christoph M. Becker
757faee9ec
Merge branch 'PHP-8.4'
* PHP-8.4:
  Add support for reading GIFs without colormap
2025-01-09 12:07:03 +01:00
Christoph M. Becker
38365a44d0
Add support for reading GIFs without colormap
Cf. <fc38677e80>.

Closes GH-17364.
2025-01-09 12:06:24 +01:00
Gina Peter Banyard
fba0b18d35 ext/pdo: Remove mostly useless retval field in statement struct 2025-01-09 10:30:10 +00:00
Gina Peter Banyard
bd83f866d1 ext/pdo: Refactor FETCH_FUNCTION mode
Most of the fields on the struct are useless or can be handled differently
2025-01-09 10:30:10 +00:00
Gina Peter Banyard
576f5fac23 ext/pdo: Move PDO MySQL test to common 2025-01-09 10:30:10 +00:00
Niels Dossche
3a039e3725
Add enchant_dict_remove_from_session() (#17393) 2025-01-08 21:53:40 +01:00
Gina Peter Banyard
915feea12d
ext/ldap: Use FCC for rebind_proc callback (#17369) 2025-01-08 20:52:33 +00:00
Niels Dossche
1ec95c33e8
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix crashes in enchant when passing null bytes
2025-01-08 20:47:37 +01:00
Niels Dossche
91384e561f
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix crashes in enchant when passing null bytes
2025-01-08 20:47:31 +01:00
Niels Dossche
6cbe2edaad
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17397: Assertion failure ext/dom/php_dom.c
2025-01-08 19:46:23 +01:00
Niels Dossche
6d215981b6
Fix GH-17397: Assertion failure ext/dom/php_dom.c
The problem was that the property hash tables were not merging the
correct ones, a stupid typo (or caused by merging).

Closes GH-17406.
2025-01-08 19:45:40 +01:00
Gina Peter Banyard
d6cc31cf95
ext/pcre: Refactor preg_replace_callback(_array)() to not pass a useless FCI (#17365)
* ext/pcre: Refactor php_pcre_replace_func_impl() to not rely on an FCI

* ext/pcre: Refactor populate_subpat_array() to take subject as a HashTable*

This makes the assumption the zval is always an array explicit

* ext/pcre: Refactor php_pcre_replace_func_impl()

We don't need the FCI any more, and we always have the subject as a zend_string.

* ext/pcre: Refactor php_pcre_replace_func()

We don't need the FCI any more

* ext/pcre: Refactor php_replace_in_subject_func()

We don't need the FCI any more
Make the Hashtable param const
Throw exception on non string entries

* ext/pcre: Refactor preg_replace_func_impl()

We don't need the FCI anymore
Make the Hashtable params const
Rename function to indicate it is a PHP pcre function

* ext/pcre: Add trampoline tests for preg_replace_callback(_array)()

* ext/pcre: Handle trampolines properly for preg_replace_callback(_array)()

* Revert FCI passing removal
2025-01-08 18:05:06 +00:00
Tim Düsterhus
cee64ed3bd
Add dedicated zend_ast_op_array struct (#17391)
Given that the `ZEND_AST_OP_ARRAY` type already needed special handling in
various places, it makes sense to give it its own struct to avoid some of the
casts. As a side benefit, it is a little smaller than the `zend_ast_zval`
struct.
2025-01-08 11:26:35 +01:00
Tim Düsterhus
fd1eacc2ed
Add assertions verifying that zend_ast_decl AST nodes are not treated as regular zend_ast nodes (#17390)
* zend_compile: Do not traverse children of ZEND_AST_CLOSURE in zend_compile_const_expr()

* Add assertions verifying that zend_ast_decl AST nodes are not treated as regular zend_ast nodes
2025-01-08 10:36:02 +01:00
David Carlier
a091e52316
ext/session: session_start() options arguments type checks.
close GH-17388
2025-01-07 23:52:39 +00:00
Gina Peter Banyard
58d19dade7
ext/intl: Remove unused variable
This is now unused after bf3673a415
2025-01-07 23:34:22 +00:00
Gina Peter Banyard
e5c415cd3a
ext/pdo: Move assignment to declaration for clarity 2025-01-07 22:05:45 +00:00
Gina Peter Banyard
8c27553538
ext/pdo: Use a variable for the column name 2025-01-07 22:05:45 +00:00
Niels Dossche
fcea7af9d9
Use zend_object_alloc() in ext/intl (#17392) 2025-01-07 21:24:24 +01:00
Niels Dossche
cc4402b6cb
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17234: Numeric parent hook call fails with assertion
2025-01-07 19:21:35 +01:00
Niels Dossche
71493623f4
Fix GH-17234: Numeric parent hook call fails with assertion
The current code expects the property name to be a string, but it can
also be a number via the {} syntax. Handle this consistently to a string
by using zval_get_string which will do the type coercion and refcount
update (instead of assuming string and doing an explicit string copy).

Closes GH-17236.
2025-01-07 19:21:22 +01:00
Gina Peter Banyard
e40543a401
zend_closures.c: In Closure::__invoke() call the closure directly (#17372)
This prevents a bunch of indirection which ultimately calls `zend_closure_get_closure()` anyway via the `get_closure` object handler.
2025-01-07 09:20:36 +00:00
Gina Peter Banyard
17ea79bb4e [skip ci] Remove useless comment 2025-01-07 09:10:05 +00:00
Gina Peter Banyard
19dd79bdee ext/pdo: Refactor PDOStatement::fetchAll()
This also refactors the internal do_fetch() function to stop doing wonky stuff to handle grouping, which is a feature of fetchAll

Handle PDO_FETCH_KEY_PAIR on its own as GROUP and UNIQUE flags can interfere with it
2025-01-07 09:10:05 +00:00
Gina Peter Banyard
4dd9acccd2 ext/pdo: Move common PDO bug test and enhance it 2025-01-07 09:10:05 +00:00
Christoph M. Becker
2c49f52b0d
Port "improve _gdImageFillTiled() internal function" (GH-17356)
This improvement was done for libgd 2.1.0[1], and the erroneous
calculation has been fixed as of libgd 2.2.0[2].

While we're at it we also add the overflow checks of external libgd;
these are not really necessary, since `.sx * .sy` overflow was already
prevented when the image has been created, and since we're using
`safe_emalloc()` the `struct seg` overflow is also prevented.  It
should be noted that `overflow2()` prevents `int` overflow, while
`safe_emalloc()` prevents `size_t` overflow, so the former is more
restrictive.  For parity with external libgd, this still appears to be
a good thing.

[1] <86a5debede>
[2] <e87ec88e1c>
2025-01-07 01:23:05 +01:00
Eric Norris
d20880ce3b
RFC: Add CurlSharePersistentHandle objects (#16937)
see https://wiki.php.net/rfc/curl_share_persistence_improvement
2025-01-06 21:52:00 +01:00
Niels Dossche
95d1476e27
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix crashes in function registration + test
2025-01-06 21:31:09 +01:00
Niels Dossche
2860c3d641
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix crashes in function registration + test
2025-01-06 21:31:03 +01:00
Gina Peter Banyard
e2e7b46542 sapi/phpdbg: Grab the function pointer directly
Allocating a string zval to let zend_call_function() do the same thing is slightly pointless
2025-01-06 20:17:25 +00:00
Niels Dossche
a58c6d56bb Make docs consistent with help text 2025-01-06 20:17:25 +00:00
Niels Dossche
8cb15f6203 Fix crashes in function registration + test
Internal function won't need their refcount increased as they outlive
the debugger session, and userland functions won't be unloaded either.
So no refcount management is necessary for registered functions.
2025-01-06 20:17:25 +00:00
Christoph M. Becker
e4df0cbe1c
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix libgd 223: gdImageRotateGeneric() does not properly interpolate
2025-01-06 20:39:14 +01:00
Christoph M. Becker
12e4ee492b
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix libgd 223: gdImageRotateGeneric() does not properly interpolate
2025-01-06 20:38:34 +01:00
Niels Dossche
47f1caed2f
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17122: memory leak in regex
2025-01-06 20:11:42 +01:00
Niels Dossche
dc27acddd6
Fix GH-17122: memory leak in regex
Because the subpattern names are persistent, and the fact that the
symbol table destruction is skipped when using fast_shutdown,
this means the refcounts will not be updated for the destruction of
the arrays that hold the subpattern name keys.
To solve this, detect this situation and duplicate the strings.

Closes GH-17132.
2025-01-06 20:11:36 +01:00
Christoph M. Becker
f5aa69a5fc
Port "merged and expanded settings from gd.h and gdft.c" (GH-17367)
This commit[1] and the related part of the Netware removal[2] move the
related definitions out of gd.h, and bring some updates.

[1] <2a921c80fb>
[2] <e6bb110663>
2025-01-06 15:01:50 +01:00
Christoph M. Becker
cc84d271ea
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17373: imagefttext() ignores clipping rect for palette images
2025-01-06 14:59:38 +01:00
Christoph M. Becker
61dcfc4c9a
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17373: imagefttext() ignores clipping rect for palette images
2025-01-06 14:59:03 +01:00
David Carlier
9f87a19de4
ext/sockets: drop convert_to_array for multicast leave group settings.
close GH-17371
2025-01-06 13:11:07 +00:00
Jakub Zelenka
5ba299be18
Merge branch 'PHP-8.4' 2025-01-06 12:21:20 +01:00
Jakub Zelenka
35c03c165e
Merge branch 'PHP-8.3' into PHP-8.4 2025-01-06 12:20:50 +01:00
Máté Kocsis
684ef016e1
Add support for using final properties in stubs (#17306) 2025-01-06 07:56:13 +01:00
David Carlier
e4ad271073
Merge branch 'PHP-8.4' 2025-01-05 13:45:37 +00:00
David Carlier
3cf381e08c
Merge branch 'PHP-8.3' into PHP-8.4 2025-01-05 13:45:06 +00:00
David Carlier
3ee8b3929e
Merge branch 'PHP-8.4' 2025-01-05 13:35:20 +00:00
David Carlier
895c6d5c49
Merge branch 'PHP-8.3' into PHP-8.4 2025-01-05 13:34:38 +00:00
David Carlier
466f3257eb
ext/sockets: socket_addrinfo_lookup and other few internal changes
- socket_addrinfo_lookup throws when hints is an indexed array.
- socket_get_option hardcoding size outputs to user when data
  size known.

close GH-17363
2025-01-05 13:32:12 +00:00
Gina Peter Banyard
7c32e41ab8 ext/spl: Refactor iterator_apply() to not rely on an FCI
This reduces the size of the struct from 112 to 56 bytes
2025-01-05 12:27:28 +00:00
Gina Peter Banyard
3de22a84e8 ext/spl: Add trampoline test for iterator_apply() 2025-01-05 12:27:28 +00:00
Gina Peter Banyard
e547fe40df ext/spl: Remove useless obj field from spl_iterator_apply_info 2025-01-05 12:27:28 +00:00
Niels Dossche
73f52dc729
Remove custom free_obj handler in xmlwriter
At one point this served a purpose as it contained the cleanup code that
now lives in dtor, but now it just calls the standard handler so we can
just get rid of it.
2025-01-05 13:05:06 +01:00
Christoph M. Becker
a3ef48c265
Port "move pixelate filter to gd_filter.c" (sync with upstream) (GH-17361)
Cf. <0f0894a7dd>.
2025-01-05 11:24:24 +01:00
DanielEScherzer
025cc6f603
UPGRADING: fix misplaced () (#17360)
[skip ci]
2025-01-04 17:42:06 +00:00
Niels Dossche
9da8ace8ea
Merge branch 'PHP-8.4'
* PHP-8.4:
  Handle GC cycles properly in intl iterators
2025-01-04 17:49:45 +01:00
Niels Dossche
3240f478bc
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Handle GC cycles properly in intl iterators
2025-01-04 17:49:39 +01:00
Niels Dossche
ac8b7b8aaf
Fix wrong comment and use cheaper destruction macro (#17359) 2025-01-04 17:18:53 +01:00
Niels Dossche
7be3649016
Cleanup iterator instantiation code (#17358)
Just using object_init_ex() directly makes the code a bit simpler and
avoids unnecessary indirections.
2025-01-04 16:48:41 +01:00
Niels Dossche
b21c16908e
Convert more commonly used DOM element methods to use fast ZPP (#17357) 2025-01-04 16:48:34 +01:00
David Carlier
c7a322cc4c
ext/sockets: follow-up on GH-17300 to check hints value ranges.
close GH-17326
2025-01-04 15:39:53 +00:00
Niels Dossche
0a69e14278 Avoid copying request strings in phar_parse_pharfile() 2025-01-04 14:08:33 +00:00
Niels Dossche
9e3508bfa8
Fix persistent local flag on filename zend_strings in phar (#17353)
This fixes the nightly failure.
2025-01-04 14:56:26 +01:00
Christoph M. Becker
5ba2143c1c
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17349: Tiled truecolor filling looses single color transparency
2025-01-04 14:54:27 +01:00
Christoph M. Becker
5a01c3293a
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17349: Tiled truecolor filling looses single color transparency
2025-01-04 14:54:11 +01:00
Christoph M. Becker
2490097420
Port insertion sort improvement of libgd 2.0.26 (GH-17342)
Possibly a minor performance improvement, but at least in sync with
upstream this way.
2025-01-04 13:13:06 +01:00
Niels Dossche
209e0d6ad2
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-11874: intl causing segfault in docker images
2025-01-03 18:58:42 +01:00
Niels Dossche
0ee6691bbc
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-11874: intl causing segfault in docker images
2025-01-03 18:58:36 +01:00
Christoph M. Becker
8a0b617940
Port clip_1d() clipping rectangle improvement of libgd 2.0.26 (GH-17341)
This is not a functional change, but rather a performance improvement,
to avoid unnecessary calls of `gdImageSetPixel()` which would be no-ops
due to positions outside of the clipping bounds.
2025-01-03 18:26:46 +01:00
Niels Dossche
21f4211d1a
Use zend_string_{equals,startswith} helpers
Closes GH-17240.
2025-01-03 17:59:58 +01:00
Niels Dossche
c7b80e640e
Transform phar_entry_info filename to zend_string
The contents of the string are copied many times, especially in hash
tables. Avoid all this work by using zend_string in the first place.
2025-01-03 17:59:04 +01:00
Niels Dossche
49fa2e4651 Make some arguments of dom_get_elements_by_tag_name_ns_raw() const 2025-01-03 17:50:01 +01:00
Niels Dossche
59a0d00a5d Avoid string duplications in dom iterators 2025-01-03 17:50:01 +01:00
Niels Dossche
4c3aeec74f
Minor cleanups in namednodemap.c (#17340) 2025-01-03 17:33:29 +01:00
Gina Peter Banyard
0fe3a91494 main/streams: Remove questionable use of PHP_STRLCPY
The description of PHP_STRLCPY says that this is a fast version of strlcpy that should be used if we *know* the size of both the source and destination buffers.
This is clearly not the case as we use strlen() to compute it.
Moreover if the result cannot fit in the destination buffer something seriously strange has happened and we should return a failure state rather than truncating.
2025-01-03 13:45:23 +00:00
Christoph M. Becker
f55d6cc110
Internalize gdImageScale*() and gdImageRotate*() helpers
This is basically a port of the "Small code cleanup" commit[1].

We can now drop the superfluous checks for zero width/height.  These
have been introduced as fix for bug 72337[2], while the same issue had
a simpler fix for upstream[3], because the helper functions already
were internal.

[1] <e054be7d82>
[2] <https://bugs.php.net/72337>
[3] <77309c419c>
2025-01-03 14:26:36 +01:00
Christoph M. Becker
11d701a6ab
Port fix for libgd bug 447 (GH-17320)
That bug has been potentially exploitable[1], but the GD extension was
not affected by that, because `gdImageBmpPtr()` is never called.  Still
it seems to be reasonable to port the fix; if only to keep bundled and
external libgd synced.

[1] <https://github.com/advisories/GHSA-hc3p-jvff-jfw5>
2025-01-03 12:57:12 +01:00
Niels Dossche
2dfe92767d
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16800: ftp functions can abort with EINTR
2025-01-03 12:31:13 +01:00
Niels Dossche
e90243a640
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16800: ftp functions can abort with EINTR
2025-01-03 12:31:08 +01:00
Niels Dossche
309e66d984
Use zend_new_pair() for hrtime() (#17328)
This is a specialised optimized helper to return a pair.
2025-01-03 12:28:14 +01:00
Gina Peter Banyard
60252b7845
ext/pdo: Improve testing for FETCH_FUNC mode (#17325) 2025-01-02 23:31:25 +00:00
David Carlier
b7c76ded31
ext/socket: socket_addrinfo_lookup check hints array.
close GH-17300
2025-01-02 13:14:10 +00:00
Gina Peter Banyard
249d2dac28
ext/pdo: Use memcpy instead of strlcpy for copying default error code (#17290)
They have identical sizes, so there is no need for 'extra' safety.

See https://nrk.neocities.org/articles/not-a-fan-of-strlcpy for a rationale against the usage of strlcpy
2025-01-01 20:23:18 +00:00
Gina Peter Banyard
1969955e50
ext/pdo: Drop redundant mode check, and fix the first check (#17302) 2025-01-01 20:22:39 +00:00
Christoph M. Becker
dfdba3cfe4
Merge branch 'PHP-8.4'
* PHP-8.4:
  gh15937.phpt does not need to be an online test
2025-01-01 20:08:57 +01:00
Christoph M. Becker
862ed7ebe5
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  gh15937.phpt does not need to be an online test
2025-01-01 20:08:04 +01:00
Christoph M. Becker
3bfe39f279
Merge branch 'PHP-8.4'
* PHP-8.4:
2025-01-01 20:04:47 +01:00
Christoph M. Becker
37190df423
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  PHP-8.3 is now for PHP-8.3.17-dev
2025-01-01 20:03:06 +01:00
David CARLIER
3e9b530d62
ext/sockets: conversions internal changes. (#17311)
following up on strlcpy removal work too.
2025-01-01 12:13:39 +00:00
Eric Mann
90121f4056
Merge branch 'PHP-8.3' 2024-12-31 09:01:17 -08:00
Saki Takamachi
6fb79e269b
Merge branch 'PHP-8.4'
* PHP-8.4:
  PHP-8.4 is now for PHP 8.4.4-dev
2025-01-01 00:53:26 +09:00
Saki Takamachi
fc10c1d13d
PHP-8.4 is now for PHP 8.4.4-dev 2025-01-01 00:49:12 +09:00
Jakub Zelenka
b072206313
Merge branch 'PHP-8.4' 2024-12-31 15:25:17 +01:00
Jakub Zelenka
d2977b026f
Merge branch 'PHP-8.3' into PHP-8.4 2024-12-31 15:20:06 +01:00
divinity76
47e440019c
improve range array overflow error message (#16510)
Improve range array overflow error message

Added info about "how much it exceeded" and the maximum allowable array size.

Makes debugging easier when encountering this specific issue.
2024-12-30 18:53:16 +01:00
Calvin Buckley
34275564f2 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix FD getting code on big endian (#17259)
2024-12-30 12:42:24 -04:00
Calvin Buckley
b4d3e4e541 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix FD getting code on big endian (#17259)
2024-12-30 12:41:58 -04:00
Niels Dossche
ecb90c1db7
Remove incorrect RC1 annotation for get_include_path() (#17301)
This annotation is wrong since GH-17294.
2024-12-30 14:38:30 +01:00
Gina Peter Banyard
6ab38b52d3 ext/standard: Refactor tick and shutdown functions
Remove usage of FCI and store the parameters and count of it directly on the relevant structures
This reduces the size of the structs by ~50
2024-12-29 23:41:06 +00:00
Gina Peter Banyard
51884edb6b ext/standard: Add trampoline tests for tick and shutdown functions 2024-12-29 23:41:06 +00:00
David Carlier
665ebd7f48
ext/sockets: socket_sendto check port range.
close GH-17299
2024-12-29 19:07:19 +00:00
Gina Peter Banyard
72ff9077a5 ext/standard: Let is_numeric_str parse the int value for us in getopt() 2024-12-29 18:36:11 +00:00
Gina Peter Banyard
f3655100b8 ext/standard: Reuse computed strlen() value in getopt() 2024-12-29 18:36:11 +00:00
Gina Peter Banyard
a718110ae0 ext/standard: Use zend_string in ini_get_all() 2024-12-29 18:36:11 +00:00
Gina Peter Banyard
a1cb516817 ext/standard: Use zend_string in move_uploaded_file()
Also check that the initial path does not contain null bytes
2024-12-29 18:36:11 +00:00
Gina Peter Banyard
1e3498ea01 ext/standard: Use zend_string in is_uploaded_file() 2024-12-29 18:36:11 +00:00
Gina Peter Banyard
1c129c723d ext/standard: Use zend_string in get_include_path() 2024-12-29 18:36:11 +00:00
Niels Dossche
789627612a Prevent string duplication if QName without prefix is given 2024-12-29 18:18:38 +01:00
Niels Dossche
921e178562 Remove unnecessary casts 2024-12-29 18:18:38 +01:00
Niels Dossche
9cf2d1fc69 Remove outdated comment 2024-12-29 18:18:38 +01:00
Niels Dossche
d8a5cefa63 Use enum instead of 2 bools for access mode in simplexml 2024-12-29 18:18:38 +01:00
Niels Dossche
e5e7a9319a Use zend_hash_lookup in simplexml
Prevents a double lookup.
2024-12-29 18:18:38 +01:00
Niels Dossche
1a61d29d5d Use zend_new_pair 2024-12-29 18:18:38 +01:00
Niels Dossche
e21de85b9f Remove pointless conversion from UNDEF to NULL 2024-12-29 18:18:38 +01:00
David Carlier
caafa041d9
ext/sockets: socket_bind() check port validity.
range from ephemeral port (0) to max unsigned 16 bits.

close GH-17296
2024-12-29 15:22:05 +00:00
Niels Dossche
8120c7988a
Merge branch 'PHP-8.4'
* PHP-8.4:
  Revert 746b1cf4 "Access long value directly for call to count() in simplexml"
2024-12-29 14:38:06 +01:00
Niels Dossche
9eaee687d3
Revert 746b1cf4 "Access long value directly for call to count() in simplexml"
The count() function has a tentative return type.
Add a comment for the future.
2024-12-29 14:37:25 +01:00
Niels Dossche
b00c72cf23
Remove no-op MSHUTDOWN function in xmlwriter 2024-12-29 14:28:42 +01:00
Gina Peter Banyard
9eb228488a
ext/sockets: Additional refactorings to socket_set_option() (#17186)
* ext/socket: Reduce scope of variables

* ext/socket: Throw TypeErrors when not passing a string for options requiring one

* ext/sockets: Throw ValueError when string has null bytes for options not passing string length

* ext/sockets: Throw ValueError when string is too long

And replace calls to strlcpy to memcpy
2024-12-29 12:18:15 +00:00
Niels Dossche
b27bbd3ec6
Merge branch 'PHP-8.4'
* PHP-8.4:
  Backport fix GH-17280: ldap_search() fails when $attributes array has holes
2024-12-29 12:24:59 +01:00
Niels Dossche
726c96fbef
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Backport fix GH-17280: ldap_search() fails when $attributes array has holes
2024-12-29 12:19:33 +01:00
Niels Dossche
c6b3ab3966
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix some emalloc() size mistakes
2024-12-29 12:12:22 +01:00
Niels Dossche
9d04d41eec
Fix some emalloc() size mistakes
Fortunately, these only allocate too much memory and not too little.
Also just change it to `sizeof(*var)` everywhere to avoid this mistake
in the future.
2024-12-29 12:11:38 +01:00
Gina Peter Banyard
63f6251812
ext/standard: Use zend_string_equals_literal API (#17292)
Instead of a custom one only available in this file
2024-12-29 10:54:17 +00:00
Daniel Scherzer
8e40bb689e gen_stub: remove some misplaced spaces 2024-12-29 00:24:40 +01:00
Daniel Scherzer
69ff948d39 gen_stub: document a bunch of properties as read-only
In the hopes that it will be clearer that some of the custom clone handling can
be removed the way it was for `ExposedDocComment`, instances of which were
immutable, document a bunch of properties of other classes as read-only.
2024-12-29 00:24:40 +01:00
Daniel Scherzer
3817a71b88 gen_stub: remove impossible Type::__toString() handling
`Type::$types` is typed as an array, and thus can never be `null`. There is no
need to have code to handle such a case.
2024-12-29 00:24:40 +01:00
Daniel Scherzer
daac8f8815 gen_stub: stop cloning ExposedDocComment objects
The objects are immutable, and thus can be safely reused when held by an object
that gets cloned. Remove the unneeded cloning, and document this fact about the
class, noting that the property should be considered `readonly`.

Not actually using `readonly` to maintain PHP 7.4 support.
2024-12-29 00:24:40 +01:00
Daniel Scherzer
418b933aea gen_stub: make some methods only used within their class private
* `FuncInfo::hasParamWithUnknownDefaultValue()`
* `FuncInfo::getFramelessFunctionInfosName()`
* `ClassInfo::getClassSynopsisReference()`
2024-12-29 00:24:40 +01:00
Daniel Scherzer
dd72c4325c gen_stub: convert ArgInfo::$sendBy to a string
Instead of using integers that then need to be converted to the string
representation via `::getSendByString()`, just always store a string,
eliminating the conversion method and replacing it with property access.
2024-12-29 00:24:40 +01:00
Daniel Scherzer
9ab74588d5 gen_stub: refactor Type::tryToSimpleType(), eliminate ::getWithoutNull()
`Type::tryToSimpleType()` tries to convert a type holding multiple simple types
into a single simple type, with the following logic
- if all of the inner types represent `null`, return the first of those
- if all but one of the inner types represent `null`, return the non-null type
- otherwise, return `null`

Previously, it did this with a helper method `::getWithoutNull()`, that
constructed a new `Type` containing only the inner types that did not represent
`null`. However, the only thing the newly created object was used for was
extracting the types it contains, so the actual object creation just adds
overhead. Merge `Type::getWithoutNull()` into `Type::tryToSimpleType()` and
clean up to avoid creating an unneeded object.
2024-12-29 00:24:40 +01:00
Daniel Scherzer
a4e062600f gen_stub: inline single-use VariableLike::addTypeToFieldSynopsis() method
Protected method not overridden in any subclasses, so could be made private,
but the method is short enough and simple enough that it can just be inlined.
2024-12-29 00:24:40 +01:00
Daniel Scherzer
6730cbfb25 gen_stub: inline single-use ::setTypes() methods
Both `ArgInfo::setTypes()` and `ReturnInfo::setTypes()` were private methods
only called in the applicable class's constructor. They had no special logic
that benefited from existing as a separate method, and just added a level of
indirection. Inline the uses and remove the methods.
2024-12-29 00:24:40 +01:00
Daniel Scherzer
d2220a407b gen_stub: inline single-use static SimpleType constructors
The following one-line methods, only used in `SimpleType::fromValue()`, were
inlined:

* `SimpleType::bool()`
* `SimpleType::int()`
* `SimpleType::float()`
* `SimpleType::string()`
* `SimpleType::array()`
* `SimpleType::object()`

Doing so removes an unneeded level of indirection and helps simplify the class.
2024-12-29 00:24:40 +01:00
Daniel Scherzer
c2ecb71dbb gen_stub: remove unused SimpleType::void() 2024-12-29 00:24:40 +01:00
Daniel Scherzer
ad92965474 gen_stub: remove unused VariableLike::getVariableTypeCode() 2024-12-29 00:24:40 +01:00
Gina Peter Banyard
6ef58da59e
ext/mysqlnd: Refactor usage of strlcpy() (#17185)
The two calls that MySQLnd does to this handler all pass a buffer the same size as the error_msg field
Thus, we know that we can just memcpy the error message into the buffer.

See https://nrk.neocities.org/articles/not-a-fan-of-strlcpy for a rationale against the usage of `strlcpy()`
2024-12-28 23:00:08 +00:00
Niels Dossche
65524e5d53
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17208: bug64539-status-json-encoding.phpt fail on 32-bits
2024-12-27 21:48:58 +01:00
Niels Dossche
2161959834
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17208: bug64539-status-json-encoding.phpt fail on 32-bits
2024-12-27 21:48:52 +01:00
Niels Dossche
f90323c8d4
Fix GH-17280: ldap_search() fails when $attributes array has holes (#17284)
We relax the constraint that the array must be a list. What really
matters is that it only has numeric keys. As shown in the example code,
it's really easy to accidentally create a non-list array, so it makes
sense to relax the constraint.
There are 3 cases left where the array is checked to be a list,
in php_ldap_do_search, but I believe this makes sense to keep because
the indices of those arrays have a meaning because they should match
between different arrays. In that case it will prevent programmer
errors.
2024-12-27 17:58:50 +01:00
Niels Dossche
accf957727
Change impossible condition into assertion 2024-12-27 17:34:21 +01:00
dhuang00
71dfa931eb
Shuffle tests for a single worker
Even when tests are not run in parallel, shuffling can help discover tests that
unintentionally depend on other tests being run before them.

Closes GH-17149.
2024-12-27 15:58:59 +01:00
Niels Dossche
23ccd06ede
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17187: unreachable program point in zend_hash
2024-12-27 15:54:42 +01:00
Niels Dossche
575ee23bd9
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17187: unreachable program point in zend_hash
2024-12-27 15:54:37 +01:00
David Carlier
00fe9b205c
ext/sockets: socket_create_listen() check port value beforehand.
port is a 16 bit field, limited to the 65535 value then.
Note that 0 is a valid case for ephemeral port.

close GH-17281
2024-12-27 14:29:11 +00:00
Saki Takamachi
2b36680f0a
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fixed GH-17275: Fixed the calculation logic of dividend scale (#17279)
2024-12-27 21:36:36 +09:00
Saki Takamachi
ef036090d9
Fixed GH-17275: Fixed the calculation logic of dividend scale (#17279)
Fixes #17275
Closes #17279
2024-12-27 21:36:26 +09:00
Niels Dossche
55afe8bd9b
Implement GH-15680: Enhance zend_dump_op_array to Properly Represent Non-Printable Characters in String Literals
Replaces GH-15730 as that PR became stale.

But instead of introducing a new helper, reuse
smart_str_append_escaped(), this also removes the dependency on
ext/standard.

Closes GH-15730.
Closes GH-17277.
2024-12-27 12:53:02 +01:00
Kamil Tekiela
f0554477ae
Make PDO_MYSQL_ATTR_DIRECT_QUERY a proper alias (#16935) 2024-12-26 22:26:40 +00:00
David Carlier
63e4e08e0d
ext/sockets: following-up on GH-16842, update FreeBSD TCP stack setting.
- `TCP_FUNCTION_ALIAS`: fetches the function pointer name alias (>= 14.0
  only tough).
- `TCP_BBR_ALGORITHM`: set/get the underlying algorithm (0: netflix, 1:
  google) when the BBR's TCP stack is used.
- `TCP_REUSPORT_LB_NUMA`: set/get a NUMA domain filter on the socket.

close GH-16923
2024-12-26 20:54:14 +00:00
Niels Dossche
b09ed9a0f2
Use format string to cut off filename instead of duplicating memory
Split off from GH-17240.
2024-12-26 12:30:49 +01:00
Niels Dossche
466c8b0e03
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17257: UBSAN warning in ext/opcache/jit/zend_jit_vm_helpers.c
  Fix GH-17223: Memory leak in libxml encoding handling
2024-12-26 12:26:59 +01:00
Niels Dossche
f4fb77ed61
Fix GH-17257: UBSAN warning in ext/opcache/jit/zend_jit_vm_helpers.c
EX(opline) / opline can be stale if the IP is not stored, like in this
case on a trace enter. We always need to make sure that the opline is up
to date to make sure we don't use stale data.

Closes GH-17260.
2024-12-26 12:26:48 +01:00
Niels Dossche
956576b0b4
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17223: Memory leak in libxml encoding handling
2024-12-26 12:25:08 +01:00
Niels Dossche
b4c5f4e92d
Remove unused dummy_op_array (#17272)
This was introduced in b0b43e86ae for register allocation code, but is
not used anymore nowadays.
2024-12-26 11:25:41 +01:00
Christoph M. Becker
c1c6520c4f
Make imagebmp_basic.phpt more resilient (GH-17265)
Checking for the exact output of most image formats is brittle; even an
otherwise change to some header field causes the output to change, even
if the image would be visually identical.

Checking for an (MD5) hash is even worse, since if the tests fails, we
have no clue for what reason.

Thus we compare the generated image against an pre-generated PNG, using
a test helper which will output a simple image diff in case of test
failure.
2024-12-25 23:15:45 +01:00
Niels Dossche
1331444822
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16013 and bug #80857: Big endian issues
2024-12-25 21:33:49 +01:00
Niels Dossche
250e0ffe90
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16013 and bug #80857: Big endian issues
2024-12-25 21:33:43 +01:00
Christoph M. Becker
2021a58aec
Reintroduce proc_open_multiplex.phpt (GH-17192)
The main intent of the test was to show the changed behavior on
Windows; previously, `stream_select()` would return immediately there,
reporting all pipes as ready; now, it only returns if at least one pipe
is actually ready.

The original test case was overspecified; of course, we cannot assume
that the pipes are ready one after the other; depending on the concrete
`select(2)` implementation and the system scheduler, minor differences
are to be expected.

Thus we relax the test expectations, and now require that not all pipes
are reported ready after a single `stream_select()` call, and that the
output contains all strings.  We also ensure that `stream_select()`
doesn't fail (for whatever reason).  And in case of the test
expectations not being met, we also output some diagnostics (most
notably the output that has already been read).
2024-12-25 17:41:31 +01:00
Christoph M. Becker
ef4fabf61f
Merge branch 'PHP-8.4'
* PHP-8.4:
  Port fix for libgd bug 276
2024-12-25 16:29:43 +01:00
Christoph M. Becker
12ecdad183
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Port fix for libgd bug 276
2024-12-25 16:29:06 +01:00
Niels Dossche
48b37fe384
Merge branch 'PHP-8.4'
* PHP-8.4:
  [ci skip] Make build command for program using embed portable
2024-12-24 14:38:20 +01:00
Niels Dossche
ce322fd1f3
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [ci skip] Make build command for program using embed portable
2024-12-24 14:38:13 +01:00
Niels Dossche
db54a83f74
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17246: GC during SCCP causes segfault
2024-12-24 14:23:40 +01:00
Niels Dossche
e45fdd2f89
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17246: GC during SCCP causes segfault
2024-12-24 14:23:33 +01:00
David Carlier
bf3673a415
ext/intl: TimeZone address todo to throw exceptions on error.
close GH-17215
2024-12-24 06:43:41 +00:00
Niels Dossche
4e9cde758e
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix memory leak on ZEND_FFI_TYPE_CHAR conversion failure
2024-12-23 14:23:16 +01:00
Niels Dossche
d1ed8beb2f
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix memory leak on ZEND_FFI_TYPE_CHAR conversion failure
2024-12-23 14:23:09 +01:00
Kamil Tekiela
bf5e6c5f2d
SplFileObject::fwrite $length param nullable (#17242) 2024-12-23 00:54:24 +01:00
Christoph M. Becker
f6469054dc
Merge branch 'PHP-8.4'
* PHP-8.4:
  Include relevant system headers before defining fallbacks
2024-12-22 16:30:45 +01:00
Christoph M. Becker
0285e9a868
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Include relevant system headers before defining fallbacks
2024-12-22 16:30:04 +01:00
Jakub Zelenka
0aeac68063
Merge branch 'PHP-8.4' 2024-12-22 14:58:36 +01:00
Jakub Zelenka
c4c536da4c
Merge branch 'PHP-8.3' into PHP-8.4 2024-12-22 14:58:08 +01:00
Niels Dossche
d480c04be1
Implement cache slot optimization for XMLReader (#17232) 2024-12-22 13:01:45 +01:00
Niels Dossche
26244c7dcd
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix DOM test on higher branches
2024-12-21 12:50:08 +01:00
Niels Dossche
d2b6b64655
Fix DOM test on higher branches 2024-12-21 12:50:04 +01:00
Niels Dossche
8d39261603
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17225: NULL deref in spl_directory.c
2024-12-21 12:48:24 +01:00
Niels Dossche
a02648087a
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17225: NULL deref in spl_directory.c
2024-12-21 12:47:48 +01:00
Shivam Mathur
b1220da496
ext/pdo_firebird: Fix label follow by declaration (#17229)
A label should be followed by a statement and not a declaration, else old gcc gives the following error: a label can only be part of a statement and a declaration is not a statement

To fix this we wrap the code in the switch case block in braces.
2024-12-21 16:56:53 +05:30
Niels Dossche
1fff0c05b7
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17224: UAF in importNode
2024-12-21 12:01:53 +01:00
Niels Dossche
62dc89d947
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17224: UAF in importNode
2024-12-21 12:01:48 +01:00
Niels Dossche
afc1f0d99b
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17216: Trampoline crash on error
2024-12-21 00:26:37 +01:00
Niels Dossche
627432785e
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17216: Trampoline crash on error
2024-12-21 00:26:23 +01:00
David CARLIER
c4bb6e6c39
ext/sockets: further timeout handling changes. (#17210)
close GH-17210
2024-12-20 22:36:14 +00:00
Arnaud Le Blanc
420365d922
Merge branch 'PHP-8.4'
* PHP-8.4:
  Add observer temporary to dl'ed functions
2024-12-20 18:52:43 +01:00
Arnaud Le Blanc
32148e9b10
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Add observer temporary to dl'ed functions
2024-12-20 18:50:16 +01:00
David Carlier
76ade7165e
Merge branch 'PHP-8.4' 2024-12-20 15:09:59 +00:00
David Carlier
aa815f32ae
Merge branch 'PHP-8.3' into PHP-8.4 2024-12-20 15:09:49 +00:00
Dmitry Stogov
ac2b656a13
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17190: Assertion failure ext/opcache/jit/ir/ir_gcm.c (#17221)
2024-12-20 11:02:41 +03:00
Dmitry Stogov
f8d2e00964
Fix GH-17190: Assertion failure ext/opcache/jit/ir/ir_gcm.c (#17221) 2024-12-20 10:59:33 +03:00
Arnaud Le Blanc
4b1c3cf0b6
Merge branch 'PHP-8.4'
* PHP-8.4:
  NEWS for GH-17168
  ext/gettext/config.m4: symlink en_US.UTF-8 test bits to en_US for musl
  ext/gettext/tests: fix libintl return values under musl
  ext/gettext/gettext.c: handle NULLs from bindtextdomain()
2024-12-19 18:39:27 +01:00
Arnaud Le Blanc
73857e66d2
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  NEWS for GH-17168
  ext/gettext/config.m4: symlink en_US.UTF-8 test bits to en_US for musl
  ext/gettext/tests: fix libintl return values under musl
  ext/gettext/gettext.c: handle NULLs from bindtextdomain()
2024-12-19 18:38:30 +01:00
Dmitry Stogov
6a015491a0
Merge branch 'PHP-8.4'
* PHP-8.4:
  Update IR
2024-12-19 20:30:05 +03:00
Dmitry Stogov
33c12e0776
Update IR
IR commit: 79483000c2a4b918221fa3097ca47b48b3519447
2024-12-19 20:29:35 +03:00
David Carlier
fb2443ac5c
ext/posix posix_ttyname/posix_isatty fd error handling update.
Set to `EBADF` errno for posix_ttyname when out of ranges.
posix_fpathconf now returns false on out of range file descriptors.

close GH-17209
2024-12-19 13:24:07 +00:00
Ilija Tovilo
8aac6987c2
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix RC inference of op1 of FETCH_OBJ and INIT_METHOD_CALL
  Add tests for GH-17151
2024-12-18 19:10:00 +01:00
Dmitry Stogov
6666cc83c5
Fix RC inference of op1 of FETCH_OBJ and INIT_METHOD_CALL
Fixes GH-17151
Closes GH-17152
2024-12-18 19:08:51 +01:00
Ilija Tovilo
cbe9d67efc
Add tests for GH-17151 2024-12-18 19:07:59 +01:00
Ilija Tovilo
e69317b501
Reduce gc stack usage for strings (and resources)
Adding strings to the worklist is useless, because they never contribute to
cycles. The assembly size on x86_64 does not change. This significantly improves
performance in this synthetic benchmark by 33%.

    function test($a) {}

    $a = new stdClass();
    $a->self = $a;
    $a->prop1 = str_repeat('a', 10);
    $a->prop2 = str_repeat('a', 10);
    $a->prop3 = str_repeat('a', 10);
    $a->prop4 = str_repeat('a', 10);
    $a->prop5 = str_repeat('a', 10);
    $a->prop6 = str_repeat('a', 10);
    $a->prop7 = str_repeat('a', 10);
    $a->prop8 = str_repeat('a', 10);
    $a->prop9 = str_repeat('a', 10);
    $a->prop10 = str_repeat('a', 10);

    for ($i = 0; $i < 10_000_000; $i++) {
        test($a);
        gc_collect_cycles();
    }

This requires adding IS_TYPE_COLLECTABLE to IS_REFERENCE_EX to ensure these
values continue to be pushed onto the stack. Luckily, IS_TYPE_COLLECTABLE is
currently only used in gc_check_possible_root(), where the checked value cannot
be a reference.

Note that this changes the output of gc_collect_cycles(). Non-cyclic, refcounted
values no longer count towards the total reported values collected.

Also, there is some obvious overlap with GH-17130. This change should be good
nonetheless, especially if we can remove the GC_COLLECTABLE(Z_COUNTED_P(zv))
condition in PHP 9 and rely on Z_COLLECTABLE_P() exclusively, given we can
assume an object doesn't become cyclic at runtime anymore.

Closes GH-17194
2024-12-18 18:58:41 +01:00
Ilija Tovilo
287aeebba7
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix incorrect dynamic prop offset in hooked prop iterator
2024-12-18 18:48:01 +01:00
Ilija Tovilo
f0441744db
Fix incorrect dynamic prop offset in hooked prop iterator
Fixes GH-17200
Closes GH-17203
2024-12-18 18:47:48 +01:00
Niels Dossche
b2c891f88e
Avoid string duplications in sqlite drivers (#17115)
These string duplications are necessary to unregister the callback
later. We can just keep using zend_string to avoid memory duplications.
2024-12-18 17:32:11 +01:00
Christoph M. Becker
4dc055506c
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17067: glob:// wrapper doesn't cater to CWD for ZTS builds
2024-12-18 13:04:41 +01:00
Christoph M. Becker
a8ffabfc91
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17067: glob:// wrapper doesn't cater to CWD for ZTS builds
2024-12-18 13:04:10 +01:00
Derick Rethans
2e1d6785d5
Merge branch 'PHP-8.4' 2024-12-18 11:39:06 +00:00
Derick Rethans
c5469fa361
Merge branch 'PHP-8.3' into PHP-8.4 2024-12-18 11:39:01 +00:00
Niels Dossche
4d140f79e6
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17198: SplFixedArray assertion failure with get_object_vars
2024-12-17 23:22:47 +01:00
Niels Dossche
5f13c62c77
Fix GH-17198: SplFixedArray assertion failure with get_object_vars
Because the properties table contains both a numeric index and a string
index that map to 0 in a symbol table, this causes an assertion failure.
Looking at the manual page of get_object_vars(), it seems that only real
properties must be included. Given that SplFixedArray's elements are not
accessible like properties, they should be excluded. This restores PHP
8.3 behaviour. The reason that this didn't cause problems on 8.3 is
because it used a different handler (get_properties).

Closes GH-17206.
2024-12-17 23:22:33 +01:00
Niels Dossche
e78a008b36
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17201: Dom\TokenList issues with interned string replace
2024-12-17 23:08:11 +01:00
Niels Dossche
e247461881
Fix GH-17201: Dom\TokenList issues with interned string replace
If a bucket previously had a non-interned string, and is now replaced
with an interned string, then the type flags still incorrectly state
it's a non-interned string. This leads to the refcount being edited for
interned strings, which in turn can lead to a crash when protect_memory
is set.

Closes GH-17207.
2024-12-17 23:07:58 +01:00
Tim Düsterhus
3fea6468fe
phpdbg: Call enums “Enum” and traits “Trait” in info classes (#17191)
* phpdbg: Call enums “Enum” in `info classes`

* phpdbg: Call traits “Trait” in `info classes`
2024-12-17 19:32:47 +01:00
Niels Dossche
97f44b7c39
Merge branch 'PHP-8.4'
* PHP-8.4:
  Export visibility for promoted property (8.3)
  [ci skip] News for GH-17101
  Add test for GH-17101
  Print hooks in parameter exports
  Fix property hook name mismatch
  Extract hook export code
  Export visibility for promoted property
2024-12-17 19:14:55 +01:00
Niels Dossche
634c14795a
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Export visibility for promoted property (8.3)
2024-12-17 19:14:45 +01:00
Niels Dossche
18d47cf63f
[ci skip] News for GH-17101 2024-12-17 19:07:14 +01:00
Niels Dossche
d4778224ca
Add test for GH-17101 2024-12-17 19:06:10 +01:00
Niels Dossche
3f0f7ab7df
Print hooks in parameter exports 2024-12-17 19:06:10 +01:00
Niels Dossche
0cba85b54d
Fix property hook name mismatch 2024-12-17 19:06:10 +01:00
Niels Dossche
6920aa2ae6
Extract hook export code 2024-12-17 19:06:10 +01:00
Niels Dossche
6f41bfd1c7
Export visibility for promoted property 2024-12-17 19:06:09 +01:00
Gina Peter Banyard
18ba9833bf
[skip ci] Add UPGRADING entry for GH-17173 2024-12-17 13:41:22 +00:00
Gina Peter Banyard
b53b52985b
ext/pcntl: Refactor pcntl_exec() (#17172)
* Refactor usage of strlcpy

As we allocate the buffer, we know the string will fit inside the buffer.

* Throw ValueErrors when strings contain null bytes

The underlying C calls work with C strings, which are NULL terminated.

* exec_pcntl() always return false

Thus, update stubs to formally have a return type of `false`.
2024-12-17 13:19:10 +00:00
Gina Peter Banyard
916288e85c
ext/pdo_firebird: Throw ValueError if cursor name is too long (#17173)
Co-authored-by: Saki Takamachi <34942839+SakiTakamachi@users.noreply.github.com>
2024-12-17 13:15:47 +00:00
Christoph M. Becker
91b7f12cf1
Drop newly added flaky test for now
The test expectations are overly specific, and may not be met.  For
now, we're dropping the test case.
2024-12-17 11:29:41 +01:00
Ilija Tovilo
becf207d0c
[skip ci] Ignore snmp test on asan that frequently times out
Not sure why this happens only on master.
2024-12-17 10:49:10 +01:00
David Carlier
4750ce1e6d
Merge branch 'PHP-8.4' 2024-12-16 23:00:23 +00:00
David Carlier
eb0e991c5d
Merge branch 'PHP-8.3' into PHP-8.4 2024-12-16 22:56:18 +00:00
Gina Peter Banyard
c8bbb2b551
[skip ci] Add upgrading entry for GH-17177 2024-12-16 22:52:14 +00:00
Gina Peter Banyard
d21777d4a2
sapi/cli: Refactor process title setting code (#17177) 2024-12-16 22:50:06 +00:00
Christoph M. Becker
6972612e1e
Improve fix for GH-16889
The original patch[1] cared only about pipe handles in the rset, but
would be problematic if there are other handles (e.g. files in the
rset, or pipes/files in the other sets), because `php_select()` would
return immediately, reporting all non read-pipe handles as ready, but
possibly never reporting read-pipe handles.

We fix this by applying different logic for the case where only pipe
handles are supplied in the rset, but no handles in the wset or eset.
In this case `php_select()` only returns when actually one of the
handles is ready, or when the timeout expires.  To avoid busy looping
in this case, we sleep for a short amount of time.  This matches POSIX
behavior.

In all other cases, `php_select()` behaves as before (i.e. prior to the
original fix), that is it returns immediately, reporting all handles as
ready.

We also add a test case that demonstrates multiplexing the output of a
couple of child processes.

See also the discussion on <https://github.com/php/php-src/pull/16917>.

[1] <b614b4a69a>

Closes GH-17174.
2024-12-16 23:25:38 +01:00
Niels Dossche
fadceca448
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17140 (Assertion failure in JIT trace exit with ZEND_FETCH_DIM_FUNC_ARG)
  Fix GH-16255: Unexpected nan value in ext/gd/libgd/gd_filter.c
2024-12-16 19:46:21 +01:00
Niels Dossche
2104097a79
Fix GH-17140 (Assertion failure in JIT trace exit with ZEND_FETCH_DIM_FUNC_ARG)
ZEND_FETCH_DIM_FUNC_ARG should also be repeated on undefined access,
consistent to how ZEND_FETCH_DIM_R is handled. The opcode was just
missing from the assertion list.

Closes GH-17148.

Co-authored-by: Dmitry Stogov <dmitry@zend.com>
2024-12-16 19:46:11 +01:00
Niels Dossche
7b2b2ecab9
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16255: Unexpected nan value in ext/gd/libgd/gd_filter.c
2024-12-16 19:44:50 +01:00
Saki Takamachi
0507b83360
Merge branch 'PHP-8.4'
* PHP-8.4:
  Correctly round rounding mode with zero edge case (#17065)
2024-12-17 00:17:38 +09:00
Saki Takamachi
52ebdfbe00
Correctly round rounding mode with zero edge case (#17065)
Fixes #17064
Closes #17065
2024-12-17 00:17:23 +09:00
Christoph M. Becker
aff044857f
Drop superfluous readline test skip conditions
The `--EXTENSIONS--` section already ensures that ext/readline is
available, so there's no need to additionally check for unconditionally
available readline functions.

Closes GH-17170.
2024-12-16 14:31:28 +01:00
Christoph M. Becker
75410eb457
Merge readline tests for POSIX and Windows (GH-17171)
These test cases differ only in some details, so it doesn't make much
sense to have separate test cases, given that POSIX/Windows test pairs
are not unlikely to diverge over time (as can be seen here, where the
POSIX tests are skipped for repeat runs, but the Windows tests are
not).
2024-12-16 13:46:44 +01:00
Christoph M. Becker
7e1a241b09
Reduce excessive stack reserve for testing in CI (GH-17166)
For some reason the stack reserve of php.exe and php-cgi.exe is very
large on Windows (64MB)[1].  While this might not be bad for production
purposes, it causes stack_limit_014.phpt to be unbearably slow; the
test may easily run for a minute, and due to a recent `stream_select()`
improvement[2], that can cause a timeout, what triggers the test to be
run again.  So this single test case may run for two minutes, and still
might fail (happened a couple of times).

Instead of skipping the test in CI, we reduce the stack reserve to 8MB,
what improves the performance of this test case (and maybe others), and
should still be good enough for CI.

[1] <54906c760f>
[2] <b614b4a69a>
2024-12-16 12:37:06 +01:00
Gina Peter Banyard
e02c226725
Merge branch 'PHP-8.4'
* PHP-8.4:
  ext/pcntl: Fix memory leak in cleanup code of pcntl_exec()
2024-12-15 22:14:25 +00:00
Gina Peter Banyard
47b262086a
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  ext/pcntl: Fix memory leak in cleanup code of pcntl_exec()
2024-12-15 22:13:54 +00:00
Niels Dossche
1371f50daa
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17162: zend_array_try_init() with dtor can cause engine UAF
2024-12-15 20:12:17 +01:00
Niels Dossche
08b14a57b8
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17162: zend_array_try_init() with dtor can cause engine UAF
2024-12-15 20:12:12 +01:00
David Carlier
fa8c6a552d
Merge branch 'PHP-8.4' 2024-12-15 16:05:20 +00:00
David Carlier
171cc5c6e0
fix pgsql config inclusion 2024-12-15 16:05:10 +00:00
David Carlier
36d5a0fdcd
Merge branch 'PHP-8.4' 2024-12-15 15:22:47 +00:00
David Carlier
1bb4bd657f
fix new pgsql test 2024-12-15 15:22:35 +00:00
David Carlier
9ba2667cf5
Merge branch 'PHP-8.4' 2024-12-15 14:56:29 +00:00
David Carlier
2309cac755
Merge branch 'PHP-8.3' into PHP-8.4 2024-12-15 14:55:36 +00:00
Niels Dossche
fe87ba41b8
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17137: Segmentation fault ext/phar/phar.c
2024-12-15 13:55:50 +01:00
Niels Dossche
57eb399700
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17137: Segmentation fault ext/phar/phar.c
2024-12-15 13:55:44 +01:00
Christoph M. Becker
1fd4771e59
Merge branch 'PHP-8.4'
* PHP-8.4:
  Don't run proc_open_cmd.phpt in parallel with other tests
2024-12-15 12:11:24 +01:00
Christoph M. Becker
fd25b79412
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Don't run proc_open_cmd.phpt in parallel with other tests
2024-12-15 12:10:47 +01:00
Christoph M. Becker
c14bc7b10f
Fail phpize early if config.w32 is missing (GH-17100)
On Windows, phpize happily builds configure even if there is no
config.w32, but running configure then error with "Must be run from the
root of the extension source".  This is confusing.

We bring phpize's behavior on par with POSIX systems, where the missing
config.m4 is detected and reported right away.
2024-12-15 12:02:19 +01:00
Niels Dossche
1ff68f58f7
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17153: SimpleXML crash when using autovivification on document
2024-12-15 11:32:08 +01:00
Niels Dossche
aea64c89f2
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17153: SimpleXML crash when using autovivification on document
2024-12-15 11:32:02 +01:00
Niels Dossche
57e9429e73
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17158: pg_fetch_result Shows Incorrect ArgumentCountError Message when Called With 1 Argument
2024-12-14 19:49:12 +01:00
Niels Dossche
e562b8cf8e
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17158: pg_fetch_result Shows Incorrect ArgumentCountError Message when Called With 1 Argument
2024-12-14 19:49:04 +01:00
Jakub Zelenka
7bfd19880f
Merge branch 'PHP-8.4' 2024-12-14 15:01:55 +01:00
Jakub Zelenka
0cc0c7c7d9
Merge branch 'PHP-8.3' into PHP-8.4 2024-12-14 15:01:17 +01:00
Niels Dossche
c015242947
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17145: DOM memory leak
2024-12-14 12:12:52 +01:00
Niels Dossche
4656c22526
Fix GH-17145: DOM memory leak
Because the use of RETURN instead of RETVAL, the freeing code could not
be executed. This only is triggerable if the content of the attribute is
mixed text and entities, so it wasn't noticed earlier.

Closes GH-17147.
2024-12-14 12:12:40 +01:00
Christoph M. Becker
bb6dbdcf94
Fix curl_multi_exec() overflow message (GH-17078)
As is, passing `2147484` as `$timeout`, throws a `ValueError` stating
the `$timeout` needs to be between 0 and 2147484, what is a confusing.
Thus we report the proper threshold as float.

While we're at it we also drop the superfluous `(double)` cast, and
rely on C's usual arithmetic conversions.
2024-12-13 16:06:39 +01:00
Christoph M. Becker
a7cf0725d8
Skip sapi_windows_set_ctrl_handler.phpt under ASan
For some reason, terminating the child process by sending CTRL+C won't
work under ASan instrumentation.  Since termination via CTRL+BREAK
works, there is apparently nothing fundamentally wrong, so we just
skip the test.

Closes GH-17086.
2024-12-13 14:29:40 +01:00
Dmitry Stogov
c630801ae7
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-15709: Crashing tests on Windows x64  (#17095)
2024-12-13 02:06:14 +03:00
Dmitry Stogov
ccc6c0f78c
Fix GH-15709: Crashing tests on Windows x64 (#17095)
This is a quick fix for the problem.
It'll work while all the JIT-ed functions have the same "fixed stack frame".
Unwinder uses hard-coded unwind data for this "fixed stack frame".

* Preallocate space for Win64 shadow args

* typo

* Setup unwinder for JIT functions

* Revert "Dynamically xfail test case which fails on CI"

This reverts commit 7cc327fd5a.

* Revert "Dynamically xfail test case which fails on CI"

This reverts commit bdde797159.

* Revert "Dynamically xfail test cases which fail on CI (GH-15710)"

This reverts commit 6d5962074f.

* Remove XFAIL sections

* Add hard-coded SEH unwind data for EXITCALL

* Fix unwind data

* Fix Windows multi-process support

* Typo
2024-12-13 02:05:45 +03:00
Christoph M. Becker
300811f1e2
Remove support for unsupported MSVC versions (GH-17128)
As of PHP 8.4.0, MSVC >= 1920 (aka. Visual Studio 2019 RTW 16.0) is
required anyway[1], so we can clean up a bit.

[1] <b3d6414b87>
2024-12-12 19:50:14 +01:00
David CARLIER
07cd468262
ext/sockets: socket_get_option/socket_set_option timeout type on win32. (#17123)
For SO_SNDTIMEO/SO_RCVTIMEO, normally the timeout ought to be of
DWORD/unsigned long.
2024-12-12 13:12:40 +00:00
Ilija Tovilo
3968dbf258
Merge branch 'PHP-8.4'
* PHP-8.4:
  Hide xfail/xleak test summary
2024-12-12 13:13:04 +01:00
Ilija Tovilo
b86308c222
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Hide xfail/xleak test summary
2024-12-12 13:12:58 +01:00
Ilija Tovilo
f1f266f953
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix ZEND_MATCH_ERROR misoptimization
2024-12-12 13:11:34 +01:00
Ilija Tovilo
901ce61105
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix ZEND_MATCH_ERROR misoptimization
2024-12-12 13:11:29 +01:00
Niels Dossche
4ef1c5fb91
Merge branch 'PHP-8.4'
* PHP-8.4:
  Update HTML5 serializer comments
2024-12-11 19:48:53 +01:00
Niels Dossche
901ebd1c1a
Update HTML5 serializer comments 2024-12-11 19:48:47 +01:00
Niels Dossche
44a2a5d3e9
Merge branch 'PHP-8.4'
* PHP-8.4:
  Resolve GH-17112 for lower branches
2024-12-11 19:33:03 +01:00
Niels Dossche
ab47c189f3
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Resolve GH-17112 for lower branches
2024-12-11 19:32:48 +01:00
Niels Dossche
75e7234f70
Drop redundant macro definitions from mbfl_defs.h
These are defined by the standard include headers we already use.
These cause conflicts which cause compiler warnings on some toolchains
(see GH-17112).

Closes GH-17114.
2024-12-11 19:22:32 +01:00
Christoph M. Becker
6e759e079f
Resolve some MSVC C4244 level 2 warnings
These got already approval by the respective code owners in GH-17076.
2024-12-11 00:12:13 +01:00
Christoph M. Becker
a7785e8edf
Simplify parsing of affine matrix arguments (GH-17094)
This code repetition is prone to errors and makes the code harder to
read than necessary.  We simplify at the cost of making parsing of ints
slightly less performant (what should not really matter in practice).
2024-12-10 16:08:27 +01:00
Tim Düsterhus
85f69a7a3f
zend_hrtime: Use clock_gettime_nsec_np() for macOS if available (#17089)
As per the Apple developer documentation:

> Prefer to use the equivalent clock_gettime_nsec_np(CLOCK_UPTIME_RAW) in
> nanoseconds.

and also

> This API has the potential of being misused to access device signals to try
> to identify the device or user, also known as fingerprinting. Regardless of
> whether a user gives your app permission to track, fingerprinting is not
> allowed. When you use this API in your app or third-party SDK (an SDK not
> provided by Apple), declare your usage and the reason for using the API in
> your app or third-party SDK’s PrivacyInfo.xcprivacy file.

see https://developer.apple.com/documentation/kernel/1462446-mach_absolute_time
2024-12-10 12:19:41 +01:00
Ilija Tovilo
2541b9f0de
Merge branch 'PHP-8.4'
* PHP-8.4:
  Backport flaky flag for phar tests
2024-12-10 10:36:39 +01:00
Ilija Tovilo
d90b5fa3f0
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Backport flaky flag for phar tests
2024-12-10 10:36:33 +01:00
Kamil Tekiela
b47d17188b
Improve mysqli test 066.phpt (#17022) 2024-12-10 02:11:43 +01:00
Jakub Zelenka
8ef9302c31
Merge branch 'PHP-8.4' 2024-12-09 23:38:20 +01:00
Jakub Zelenka
7d77082dca
Merge branch 'PHP-8.3' into PHP-8.4 2024-12-09 23:37:31 +01:00
Niels Dossche
6b7d1223a5
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix bug #79075: FFI header parser chokes on comments
2024-12-09 22:30:29 +01:00
Niels Dossche
226a0c5131
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix bug #79075: FFI header parser chokes on comments
2024-12-09 22:30:23 +01:00
Niels Dossche
b81bddd457
Merge branch 'PHP-8.4'
* PHP-8.4:
  Backport GH-16348
2024-12-09 21:01:03 +01:00
Niels Dossche
e9b3b9f8c4
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Backport GH-16348
2024-12-09 21:00:53 +01:00
Ilija Tovilo
3590890716
Fix duplicate pattern usage in Z_TRY_(ADD|DEL)REF_P (GH-17097)
GCC produces exactly the same binary with and without this change (without
extensions), which demonstrates two things:

* There is no additional register pressure.
* All usages of the macros were correct in older branches, i.e. the expressions
  did not have any side-effects.
2024-12-09 18:45:29 +01:00
Ilija Tovilo
5a482a139c
Fix enum to bool comparison
The compiler compiles $value == true to ZEND_BOOL, which always returns true for
objects (with the default cast_object handler). However, when compared to a
statically unknown rhs $value == $true, the resulting opcode ZEND_IS_EQUAL would
call the objects compare handler.

The zend_objects_not_comparable() handler, which is installed for enums and
other internal classes, blanketly returns false. This does not match the
ZEND_BOOL semantics.

Object to boolean comparison is now handled directly in zend_compare(),
analogous to object to null comparison. It continuous to call the cast_object
handler, but guarantees consistent behavior across ZEND_BOOL and ZEND_IS_EQUAL.

Fixes GH-16954
Closes GH-17031
2024-12-09 17:49:01 +01:00
Ilija Tovilo
fbb97aa6fc
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix unstable get_iterator pointer for hooked classes in shm on Windows
2024-12-09 17:14:46 +01:00
Ilija Tovilo
792f63df45
Fix unstable get_iterator pointer for hooked classes in shm on Windows
Closes GH-17034
2024-12-09 17:14:19 +01:00
Ilija Tovilo
f11d9b522d
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix duplicate dynamic properties in hooked object iterator properties table
2024-12-09 17:08:31 +01:00
Ilija Tovilo
84917300b2
Fix duplicate dynamic properties in hooked object iterator properties table
Ouch, Z_TRY_ADDREF_P() uses pz twice... Also make sure we actually reserve
enough Buckets for all dynamic properties.

Fixes OSS-Fuzz #382922236
Closes GH-17085
2024-12-09 17:07:57 +01:00
Ilija Tovilo
670f78f56c
Merge branch 'PHP-8.4'
* PHP-8.4:
  Backport JIT fix: set valid EX(opline) before calling gc_possible_root() (#16858)
2024-12-09 17:00:23 +01:00
Ilija Tovilo
7b5141b85d
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Backport JIT fix: set valid EX(opline) before calling gc_possible_root() (#16858)
2024-12-09 17:00:19 +01:00
Ilija Tovilo
067a17de48
Merge branch 'PHP-8.4'
* PHP-8.4:
  Drop intl on macOS + PHP 8.1 build
2024-12-09 16:57:27 +01:00
Ilija Tovilo
c52beea50e
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Drop intl on macOS + PHP 8.1 build
2024-12-09 16:57:20 +01:00
David Carlier
94d9cc1266
Merge branch 'PHP-8.4' 2024-12-09 13:17:29 +00:00
David Carlier
986dfd4e09
Merge branch 'PHP-8.3' into PHP-8.4 2024-12-09 13:16:50 +00:00
Christoph M. Becker
03731570cf
Fix GH-16843: Windows phpize builds ignore source subfolders
phpize builds on Windows ignore the paths of extension sources, and
build all object files in the same folder.  This can't work if there
are multiple source files with the same base name stored in separate
folders and registered as such (e.g. cls/worker.c and src/worker.c).
While extension authors can work around by avoiding duplicate base
names, they may not even be aware of the problem because on POSIX
systems, the object files are usually placed right besides the sources.

Thus we take the relative path (from `configure_module_dirname`) of the
source files into account even for phpize builds.  Since this may break
some extension builds (especially those which use Makefile fragments),
we do not apply this fix to stable branches.

Closes GH-17016.
2024-12-09 12:33:26 +01:00
Christoph M. Becker
85731e8830
[skip ci] Add nightly job for x64 Windows with ASan enabled
It seems reasonable to have an ASan job on Windows, especially to be
able to check Windows specific code.  Since the tests may take about
70 minutes, it doesn't make sense to add these for pushes, but for a
nightly job that should be okay.

Closes GH-17087.
2024-12-09 12:01:19 +01:00
Christoph M. Becker
e5b4743d38
Merge branch 'PHP-8.4'
* PHP-8.4:
  opcache_get_configuration() properly reports jit_prof_threshold
2024-12-09 11:47:26 +01:00
Christoph M. Becker
5eed224c6c
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  opcache_get_configuration() properly reports jit_prof_threshold
2024-12-09 11:46:51 +01:00
Christoph M. Becker
c0385e978a
Guard config.w32.h from multiple inclusion (GH-17021)
Besides that is generally good practice to avoid macro redefinitions
(and symbol redeclarations), and we're doing this on POSIX platforms
anyway, there is a particular issue regarding phpize builds, where
config.w32.h actually includes config.pickle.h.  The latter overrides
some macro definitions (e.g. `PHP_BUILD_SYSTEM`) to define the proper
values, but if config.w32.h is included multiple times, different macro
definitions eventually raise C4005 compiler warnings[1], which break
builds with `/WX /W1` enabled.

[1] <https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4005>
2024-12-08 23:42:34 +01:00
Niels Dossche
751eabb796
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17039: PHP 8.4: Incorrect MIME content type
2024-12-08 22:47:17 +01:00
Niels Dossche
f1b24da6b5
Fix GH-17039: PHP 8.4: Incorrect MIME content type
Backports file/file@ad925d3

Closes GH-17044.
2024-12-08 22:47:03 +01:00
David Carlier
ba432c7a47
Merge branch 'PHP-8.4' 2024-12-08 20:30:57 +00:00
David Carlier
fc3ac345d7
Merge branch 'PHP-8.3' into PHP-8.4 2024-12-08 20:30:16 +00:00
Christoph M. Becker
3ee522a31d
Merge branch 'PHP-8.4'
* PHP-8.4:
  Harden proc_open() against cmd.exe hijacking
2024-12-08 19:10:39 +01:00
Christoph M. Becker
e8bb0a8ba0
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Harden proc_open() against cmd.exe hijacking
2024-12-08 19:10:12 +01:00
Christoph M. Becker
7ce879189f
Unblock tests under ASan on Windows
These tests execute php.exe without passing the PATH, what might be a
more general issues, but at least with ASan enabled, the required DLLs
could usually not be found, resulting in the tests stalling.

Closes GH-17079.
2024-12-08 18:42:31 +01:00
Niels Dossche
c5d9c7da9e
Port Firebird x32 task to nightly (#17080) 2024-12-07 23:35:26 +01:00
Christoph M. Becker
b614b4a69a
GH-16889: stream_select() timeout useless for pipes on Windows
Pipes are blocking on Windows, but `php_select()` always returns them
as ready for read/write.  This renders the `stream_select()` timeout
useless, what can cause a following read to block for a very long time.

While there is no general fix (and least not within reach for a stable
version), we can at least cater to the important case of read pipes by
peeking the pipe to check whether data is available.  If there is none,
we do not add the handle to the read set.

We need to fix a couple of tests cases:

* bug60692.phpt and bug64770.phpt assume that at least the stdin and
  stdout pipes are always selected as readable, and that the select
  call will not change their order.  We're being more defensive now.
* the potentials warnings of bug49936_win32.phpt need to be suppressed,
  like it has been done earlier for the POSIX variant of this test
  case[1].  Possibly this test case should be dropped altogether[2].

[1] <c884d3782c>
[2] <2c6b85f6fe>

Closes GH-16917.
2024-12-07 16:44:11 +01:00
Christoph M. Becker
d98e1918cb
[skip ci] Fix UPGRADING
--enable-sanitizer is not supported with MSVC 16.9, but only 16.10.
2024-12-07 16:25:48 +01:00
Christoph M. Becker
c9cc89cd8e
Support --enable-sanitizer for MSVC builds
While it is already possible to enable ASan for MSVC (assuming Visual
Studio 2019 16.10 or later) by passing `/fsanitizer=address` in the
`CFLAGS`, it is only usable if `ZEND_DEBUG` is also enabled; otherwise
there are `STATUS_BACK_STACK` errors all the time.

Since it makes some sense to combine ASan instrumentation with debug
assertions enabled anyway (typical for fuzzing), we support the
configure option `--enable-sanitizer`, which is already supported for
Clang builds, also for MSVC builds.  Note that MSVC supports only ASan
for now; contrary to Clang which additionally supports UBSan on Windows.

Since ASan reports can be pretty useless without debug symbol
information, we require such builds to also produce PDBs (i.e.
`--enable-debug-pack`), but forbid actual debug builds (for performance
reasons, and because the way it is implemented it would not make sense;
that was already an issue with Clang builds with sanitizers enabled).

Closes GH-16999.
2024-12-07 16:21:16 +01:00
Christoph M. Becker
d18b7220a1
Merge branch 'PHP-8.4'
* PHP-8.4:
  Properly check for required icu4c libraries
2024-12-07 15:11:58 +01:00
Christoph M. Becker
0f5cc82fa6
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Properly check for required icu4c libraries
2024-12-07 15:11:40 +01:00
Christoph M. Becker
a7aba3571f
Merge branch 'PHP-8.4'
* PHP-8.4:
  Skip parse_ini_file_variation6.phpt on Windows
2024-12-06 23:54:19 +01:00
Christoph M. Becker
141ee868c0
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Skip parse_ini_file_variation6.phpt on Windows
2024-12-06 23:53:47 +01:00
Christoph M. Becker
d09cc33190
Fix typo in "private" function name (Windows configuration) (GH-17069)
This typo is particularly annoying if you search for "ldflags", because
you won't find this function.
2024-12-06 23:42:15 +01:00
Niels Dossche
fc48fd8653
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17040: SimpleXML's unset can break DOM objects
2024-12-06 20:10:08 +01:00
Niels Dossche
953f4ef2cb
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17040: SimpleXML's unset can break DOM objects
2024-12-06 20:10:03 +01:00
DanielEScherzer
b5c3c2d1d5
ext/date: reduce duplication in __wakeup() methods (#15791)
The only difference between `DateTime::__wakeup()` and
`DateTimeImmutable::__wakeup()` is which class name is included in the error
message if the initialization from the data fails. Factor out a helper method
that is given the class name, and use it for both methods.
2024-12-06 19:23:32 +01:00
Niels Dossche
b63db81086
Merge branch 'PHP-8.4'
* PHP-8.4:
  ext/dba/tests/gh16390.phpt: skip if inifile is disabled
2024-12-06 19:02:22 +01:00
Niels Dossche
f473e86978
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  ext/dba/tests/gh16390.phpt: skip if inifile is disabled
2024-12-06 19:02:17 +01:00
Niels Dossche
559eb7ff26
Fix integer overflows in timelib
There are edge cases where computations can cause an integer overflow,
which is undefined behaviour. Lately, some fuzzers seem to be hitting
these quite frequently. While this behaviour is undefined, it doesn't
actually matter in practice, the worst effect is having a wrong
computation result, but no sane person would do computations on e.g. the
year pow(2,63).

Still, undefined behaviour is bad.
Make the wrapping behaviour defined by using -fwrapv when possible.
The scope of this is limited to timelib and doesn't affect php_date.c.

The reason for this is that this may in theory prevent some
optimizations and it also seems bad to affect code that lives so close
to the PHP-native edge.

I tested all issues.
This fixes all but one issues, the remaining issue is in php_date.c.

Fixes GH-13881.
Fixes GH-14075.
Fixes GH-15150.
Fixes GH-16034.
Fixes GH-16035.
Fixes GH-16048.
Fixes GH-16050.
Fixes GH-16051.
Fixes GH-16052.
Fixes GH-16775.
Fixes GH-16864.
Fixes GH-16865.
Fixes GH-16975.
Fixes GH-17025.
Fixes GH-17059.
Closes GH-17060.
2024-12-06 18:56:57 +01:00
Saki Takamachi
2bf3db0907
Merge branch 'PHP-8.4'
* PHP-8.4:
  Now `Number::round()` does not remove trailing zeros (#17063)
2024-12-07 02:00:22 +09:00
Saki Takamachi
b88dcc9f3e
Now Number::round() does not remove trailing zeros (#17063)
Fixes #17061
Closes #17063
2024-12-07 02:00:04 +09:00
Saki Takamachi
bb13556240
Merge branch 'PHP-8.4'
* PHP-8.4:
  Correctly compare 0 and -0 (#17051)
2024-12-07 01:52:44 +09:00
Saki Takamachi
063c3c8522
Correctly compare 0 and -0 (#17051)
Fixes #17049
Closes #17051
2024-12-07 01:52:30 +09:00
Niels Dossche
e1e20892f9
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17047: UAF on iconv filter failure
2024-12-06 17:44:14 +01:00
Niels Dossche
c192a341ec
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17047: UAF on iconv filter failure
2024-12-06 17:44:01 +01:00
Niels Dossche
912b13a779
Test Firebird in 32-bit Linux CI (#17045)
Co-authored-by: =?UTF-8?q?=E6=AD=A6=E7=94=B0=20=E6=86=B2=E5=A4=AA=E9=83=8E?= <takeda@youmind.jp>
Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>
2024-12-06 17:27:59 +01:00
Dmitry Stogov
2b80b2e5ec
Merge branch 'PHP-8.4'
* PHP-8.4:
  Backport fix for GH-9011 (#17052)
2024-12-05 18:32:41 +03:00
Dmitry Stogov
3e2cfdfb28
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Backport fix for GH-9011 (#17052)
2024-12-05 18:32:30 +03:00
Christoph M. Becker
bef96f35fd
Merge branch 'PHP-8.4'
* PHP-8.4:
  Revert "Enable GHSA-9pqp-7h25-4f32.phpt on Windows"
2024-12-04 20:47:48 +01:00
Christoph M. Becker
88acd91683
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Revert "Enable GHSA-9pqp-7h25-4f32.phpt on Windows"
2024-12-04 20:47:11 +01:00
Niels Dossche
f108eecf7c
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17037: UAF in user filter when adding existing filter name due to incorrect error handling
2024-12-04 20:05:38 +01:00
Niels Dossche
d6d78545ea
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17037: UAF in user filter when adding existing filter name due to incorrect error handling
2024-12-04 20:05:32 +01:00
Christoph M. Becker
44e4f6d8f9
Merge branch 'PHP-8.4'
* PHP-8.4:
  Enable GHSA-9pqp-7h25-4f32.phpt on Windows
2024-12-04 19:06:20 +01:00
Christoph M. Becker
fbba6df626
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Enable GHSA-9pqp-7h25-4f32.phpt on Windows
2024-12-04 19:05:49 +01:00
Dmitry Stogov
7717df2c93
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-9011: Assertion failure with tracing JIT (#17042)
2024-12-04 19:51:39 +03:00
Dmitry Stogov
5ab2c02ea1
Fix GH-9011: Assertion failure with tracing JIT (#17042)
* Fix GH-9011: Assertion failure with tracing JIT

* Temporay SKIP the test on 64-bit Windows because of GH-15709
2024-12-04 19:49:17 +03:00
Christoph M. Becker
00bd5e21f5
Exclude further dependencies from dist (GH-16965)
These are Windows/Visual Studio DLLs which are not supposed to be
distributed, and would usually not even be found in the configured
paths.
2024-12-04 17:44:59 +01:00
brainpower
47942be18d
ext/gmp: add test for uses of gmp_pow with number sizes commonly used in cryptography (#16896)
With common number sizes used there

---------

Co-authored-by: Florian Moser <git@famoser.ch>
2024-12-04 16:17:00 +00:00
Jakub Zelenka
b01f5e367f
Merge branch 'PHP-8.4' 2024-12-03 18:47:25 +01:00
Jakub Zelenka
7eb7f62cff
Merge branch 'PHP-8.3' into PHP-8.4 2024-12-03 18:46:48 +01:00
Dmitry Stogov
a768a54e18
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16996: 8.4 tracing JIT phpseclib failures (#17030)
2024-12-03 20:43:26 +03:00
Dmitry Stogov
89b82ef709
Fix GH-16996: 8.4 tracing JIT phpseclib failures (#17030)
* Fix GH-16996: 8.4 tracing JIT phpseclib failures

This prevents conflicts caused by spilling to bound PHP stack slots by
creating copies.

* Fix build
2024-12-03 20:43:15 +03:00
Dmitry Stogov
0949e7acc7
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17003: Pecl 8.4 tracing JIT crash (#17032)
2024-12-03 20:43:02 +03:00
Dmitry Stogov
c5ce74c88c
Fix GH-17003: Pecl 8.4 tracing JIT crash (#17032) 2024-12-03 20:42:27 +03:00
Dmitry Stogov
bae4a01de1
Merge branch 'PHP-8.4'
* PHP-8.4:
  PHP-8.4 is now for PHP-8.4.3-dev
2024-12-03 20:42:10 +03:00
Calvin Buckley
f12cd1985e
PHP-8.4 is now for PHP-8.4.3-dev 2024-12-03 11:27:18 -04:00
Sergey Panteleev
083792880d
Merge branch 'PHP-8.4'
* PHP-8.4:
  PHP-8.2 is now for PHP 8.2.28-dev
2024-12-03 16:49:09 +03:00
Sergey Panteleev
a9a1ac2f8d
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  PHP-8.2 is now for PHP 8.2.28-dev
2024-12-03 16:48:57 +03:00
Christoph M. Becker
85f7e5477a
Fix GH-17017: OOB read when starting up file cache (GH-17023)
`zend_system_id` is not zero-terminated; as such we must constrain the
number of characters we print.
2024-12-03 12:13:53 +01:00
Dmitry Stogov
bcb7f9b018
Merge branch 'PHP-8.4'
* PHP-8.4:
  Update IR
2024-12-03 13:01:54 +03:00
Dmitry Stogov
f04a9f466f
Update IR
IR commit: 1a41bddcf0a41b9a3866d00b57591b3684c88443
2024-12-03 13:01:31 +03:00
Máté Kocsis
01093b7c13
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16990 "dba_list() is now zero-indexed instead of using resource ids"
2024-12-03 00:48:59 +01:00
Máté Kocsis
50264b03a0
Fix GH-16990 "dba_list() is now zero-indexed instead of using resource ids"
closes GH-17005
2024-12-03 00:48:34 +01:00
Kamil Tekiela
71edfd70b7
Remove incorrect information from INI (#17020) 2024-12-02 20:02:31 +01:00
Niels Dossche
e36dea065d
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix some MariaDB test failures
2024-12-02 19:22:27 +01:00
Niels Dossche
6753c55bdb
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix some MariaDB test failures
2024-12-02 19:21:37 +01:00
Tim Düsterhus
f6a0bb4d04
Support Closures in constant expressions (#16458)
RFC: https://wiki.php.net/rfc/closures_in_const_expr

Co-authored-by: Volker Dusch <volker@tideways-gmbh.com>
Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com>
Co-authored-by: Arthur Kurbidaev <artkurbidaev@gmail.com>
2024-12-02 18:25:43 +01:00
Christoph M. Becker
3b517e0825
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-15964: printf() can strip sign of -INF
2024-12-02 14:28:23 +01:00
divinity76
c2d3734e89
Fix GH-15964: printf() can strip sign of -INF
We need to cater to negative infinity explicitly.

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

Closes GH-15965.
2024-12-02 14:27:36 +01:00
hauk92
bc7902d99b
Added mysqlnd.collect_memory_statistics to ini quick reference (#16819)
Fixes #16818
Closes #16819
2024-12-02 20:15:38 +09:00
Dmitry Stogov
7c4ed6a423
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16984: function JIT overflow bug (#17015)
2024-12-02 13:30:45 +03:00
Dmitry Stogov
03bb112fb2
Fix GH-16984: function JIT overflow bug (#17015) 2024-12-02 13:30:26 +03:00
Christoph M. Becker
1d2c544cca
Refactor disp_invokeex() to avoid superfluous recheck (GH-17001)
Since we already know the method is callable, we can just call it
directly.
2024-12-01 18:55:38 +01:00
Niels Dossche
514cd2022e
Merge branch 'PHP-8.4'
* PHP-8.4:
  Add missing backslash for TokenList interfaces in stub (#17009)
2024-12-01 15:20:01 +01:00
Niels Dossche
d7a37cc9ad
Add missing backslash for TokenList interfaces in stub (#17009)
Discovered while trying to generate class synopses.
2024-12-01 15:18:44 +01:00
David Carlier
917e120b96
Merge branch 'PHP-8.4' 2024-12-01 13:58:47 +00:00
David Carlier
6419ae4c48
Merge branch 'PHP-8.3' into PHP-8.4 2024-12-01 13:58:38 +00:00
Niels Dossche
51aee3877b
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16998: UBSAN warning in rfc1867
2024-12-01 11:00:23 +01:00
Niels Dossche
c06a1a44f7
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16998: UBSAN warning in rfc1867
2024-12-01 11:00:17 +01:00
Máté Kocsis
b06f2bc67c
Improve documentation generation
- Really trim leading and trailing hyphens (single hyphens were not trimmed before)
- Create the necesary directories for even namespaced methods when generating methodsynopsis
2024-11-30 22:52:42 +01:00
DanielEScherzer
be69262137
gen_stub: drop support for @refcount 0 with scalar return (#16505)
* gen_stub: drop support for `@refcount 0` with scalar return

Currenty, if `@refcount` is omitted, it is assumed to be 0 for scalar return
types and "N" otherwise. On the other hand, if `@refcount` is provided, for a
scalar return type it *must* be 0, and for a non-scalar return type it
*must not* be 0. In other words, the ref count will be 0 if and only if the
return type is scalar, regardless of whether the `@refcount` tag is used.

In that case, adding `@refcount 0` does nothing, and since its presence
suggests it does something (why would a developer add code that does nothing?)
it is confusing and should be removed. As it happens, there are currently no
uses of `@refcount 0` in php-src, but why should we allow future uses?

Removing this support also allows simplifying the code a bit.
2024-11-30 20:47:56 +01:00
Christoph M. Becker
8b68274319
Fix method calls for PHP objects wrapped in variant
As is, methods of PHP can never be called, because we're first trying
to read the property with the name of the method.

We fix this by first checking for `DISPATCH_METHOD` and treat that as
method call, if the method would be callable.  Only otherwise we try to
access the respective property.

It needs to be noted that this breaks code which accesses a property of
an object, which defines a method of the same name.  However, instances
of such classes should never be wrapped in variants, because this can't
be distinguished by COM anyway.

Closes GH-16945.
2024-11-30 12:26:07 +01:00
Christoph M. Becker
fdd3839d80
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix potential OOB read in zend_dirname() on Windows
2024-11-29 22:11:27 +01:00
Christoph M. Becker
ba7dee5676
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix potential OOB read in zend_dirname() on Windows
2024-11-29 22:11:00 +01:00
hakre
1668a1602a
Improve php-src docs sphinx build, also on *nix (GH-16743)
* Document .rst file maximum line length of 100

In 19d2b84788 ("Create book for docs", 2024-01-30) the build of the
php-src documentation has been introduced.

It is based on reStructuredText (rst) [Docutils] for its source files,
this stems from the sphinx-build utility in use to build the static HTML
pages of the php-src documentation.

The maximum line length of these text files has been set to 100
characters in 19d2b84788 ("Create book for docs", 2024-01-30), the
rationale is unknown to the documenting author at time of writing this
message.

This formatting constraint is applied with the rstfmt utility [rstfmt]
via its invocation (documented in CI build instructions and README.md:)

    rstfmt -w 100 source

The `-w, --width` option takes a WIDTH argument that is "the
target line length in characters" (cf. `rstfmt --help`.)

There is also an `--ext EXT` argument option, that is "the extension of
files to look at when passed a directory" ("source" is the name of
a directory in the invocation above) and defaults to "rst".

Henceforth, the editor configuration [EditorConfig] can benefit from
documenting this expectation in the repositories .editorconfig file,
which has been introduced already earlier in 5c38fbe543 ("Added
editorconfig file", 2016-06-26).

[Docutils]: https://docutils.sourceforge.io/index.html "Docutils: Documentation Utilities — Written in Python, for General- and Special-Purpose Use"
[rstfmt]: https://github.com/dzhu/rstfmt "A formatter for reStructuredText"
[EditorConfig]: https://editorconfig.org/ "EditorConfig helps maintain consistent coding styles for multiple developers working on the same project across various editors and IDEs"

* Makefile for php-src docs build

In 19d2b84788 ("Create book for docs", 2024-01-30) the php-src
documentation (php-src docs) build has been introduced, yet the build
instructions, namely `make html`, did not yield the expected results
within the parenting setup of the php-src project on *nix systems.

The reason is that the `make html` build instruction does not execute
the make.bat file which contains the recipe to build the static HTML
pages.

It is an unused leftover file from initializing the project with
sphinx-quickstart. [1]

Removing it in and adding a Makefile suffices to recover the build of
php-src ./docs on a *nix system.

Formatting constraints checked in the docs workflow in CI update
use the make file to make sure the commands stay consistent and the
build is managed by the build manager.

[1]: https://www.sphinx-doc.org/en/master/man/sphinx-quickstart.html "sphinx-quickstart is an interactive tool that asks some questions about your project and then generates a complete documentation directory and sample Makefile to be used with sphinx-build(1)."

* Bind requirements.txt for php-src docs build

Define the required packages to install for the php-src docs build in
the docs/requirements.txt file:

1) Sphinx
2) sphinx-design
3) sphinxawesome-theme
4) rstfmt

This should also later on ease the use of a requirements_frozen.txt
file to pin the build dependencies if needed/wanted.

Additionally, some formatting corrections in README.md (based on the
profile in .editorconfig) as well as adding the recommendation to use
a Python virtual environment. Python3 and Pip were already named, and
with Python3 there is the venv module (Python 3.3; Sep 2012) to manage
these so-called python virtual environments [venv], which are commonly
a preferred way to install dependencies within development projects
and build systems.

[venv]: https://docs.python.org/3/library/venv.html "venv — Creation of virtual environments — Python documentation"

* Remove deprecated theme configuration

For the configured Awesome Sphinx Theme [1] highlighting extension, the
sphinx-build currently yields the following diagnostics:

     WARNING: while setting up extension sphinxawesome_theme.highlighting: \
     You no longer have to include the `sphinxawsome_theme.highlighting` \
     extension. This extension will be removed in the next major release.

(via `make html`, the configuration file is `source/conf.py`.)

The diagnostic message was introduced by sphinxawesome-theme 5.2.0,
  released May 31, 2024. [2], [3]

Removing the extension from the list of extensions in the configuration
file levitates.

No changes to requirements.txt, the extension was transitive as bundled
by the Awesome Sphinx Theme [1], and 5.2.0 deprecates it with the new
feature to "Support `pygments_style_dark` option that allows you to set
a different syntax highlighting scheme in light and dark modes." [3]

[1]: https://sphinxawesome.xyz/ "Awesome Sphinx Theme — Create functional and beautiful websites for your documentation with Sphinx."
[2]: https://pypi.org/project/sphinxawesome-theme/5.2.0/#history
[3]: https://github.com/kai687/sphinxawesome-theme/releases/tag/5.2.0
2024-11-29 19:29:00 +01:00
Niels Dossche
563da1b9d2
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16957: Assertion failure in array_shift with self-referencing array
2024-11-29 19:22:07 +01:00
Niels Dossche
ab7c3b1e7b
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16957: Assertion failure in array_shift with self-referencing array
2024-11-29 19:21:49 +01:00
Gina Peter Banyard
f8547b1d97 ext/gmp: Check for valid bit index/start consistently 2024-11-29 16:55:38 +00:00
Christoph M. Becker
38a28993fc
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16991: Getting typeinfo of non DISPATCH variant segfaults
2024-11-29 16:32:36 +01:00
Christoph M. Becker
8ea042d954
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16991: Getting typeinfo of non DISPATCH variant segfaults
2024-11-29 16:32:12 +01:00
Dmitry Stogov
e8154c6c7d
Merge branch 'PHP-8.4'
* PHP-8.4:
  Update IR
2024-11-29 16:28:53 +03:00
Dmitry Stogov
5ed438fe07
Update IR
IR commit: 673308a039eed5a2fdf4a2783b3dd3d6010a8c19
2024-11-29 16:28:27 +03:00
Saki Takamachi
5930278702
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fixed GH-16978: Avoid unnecessary padding with leading zeros (#16988)
2024-11-29 21:28:48 +09:00
Saki Takamachi
d17ed3445d
Fixed GH-16978: Avoid unnecessary padding with leading zeros (#16988)
Fixed an issue where leading zeros were padded beyond the allocated memory.

fixes #16978
closes #16988
2024-11-29 21:28:38 +09:00
Christoph M. Becker
2473f57ba7
Elevate C4013 to level 1 in CI (GH-16986)
C4013 warns about undefined functions[1], but for some reason it's only
a level 3 warning, and such suppressed by default (usually there will be
link errors afterwards, though).  It appears to be sensible to elevate
the warning to level 1, so it will be converted to a compile error.

[1] <https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4013>
2024-11-29 12:15:26 +01:00
Jakub Zelenka
284c4e3e31
Merge branch 'PHP-8.4' 2024-11-29 08:07:32 +01:00
Jakub Zelenka
8d25978d65
Merge branch 'PHP-8.3' into PHP-8.4 2024-11-29 08:06:10 +01:00
Dmitry Stogov
5c05e6c247
Merge branch 'PHP-8.4'
* PHP-8.4:
  Update IR
2024-11-29 02:40:52 +03:00
Dmitry Stogov
6fca900cc7
Update IR
IR commit: 7c26e26126123beac8dbaf811d5eac8d789d584f
2024-11-29 02:39:33 +03:00
Niels Dossche
c10f5ce9c1
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16905: Internal iterator functions can't handle UNDEF properties
2024-11-28 19:23:02 +01:00
Niels Dossche
3a80936391
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16905: Internal iterator functions can't handle UNDEF properties
2024-11-28 19:22:55 +01:00
Christoph M. Becker
f4289abffd
Merge branch 'PHP-8.4'
* PHP-8.4:
  PHP-8.4 is now for PHP 8.4.2-dev
2024-11-28 18:36:28 +01:00
Pierrick Charron
fb919e885a
PHP-8.4 is now for PHP 8.4.2-dev 2024-11-28 11:31:26 -05:00
DanielEScherzer
8ac8ec49f4
pcntl: remove unneeded module shutdown function (#16977)
Doesn't do anything, just returns `SUCCESS`
2024-11-28 08:40:52 +00:00
Jakub Zelenka
f953bd983e
Merge branch 'PHP-8.4' 2024-11-28 09:03:12 +01:00
Jakub Zelenka
e6997535f7 Update NEWS for GH-16932 fix 2024-11-28 09:02:21 +01:00
Jakub Zelenka
d165670d04
Fix GH-16932: wrong FPM status output
Closes GH-16974

Co-authored-by: James Lucas <james@lucas.net.au>
2024-11-28 08:59:55 +01:00
Peter Kokot
f12b23188a
Remove temporary actmp.W8yWyqxvkE file (#16968) 2024-11-28 02:26:35 +01:00
David Carlier
424ba0f2ff Finish reverting gmp_pow overflow check 2024-11-27 23:34:48 +00:00
Niels Dossche
0833f2376e Use specialised zend_new_pair() function to return array pairs in gmp
This is a bit faster, and more readable.
2024-11-27 23:34:23 +00:00
Máté Kocsis
8addc3c571
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix some odbc_*() parameter types
2024-11-27 23:06:34 +01:00
Máté Kocsis
3c70f5e976
Fix some odbc_*() parameter types 2024-11-27 23:05:50 +01:00
David Carlier
7b9b832be5
Merge branch 'PHP-8.4' 2024-11-27 19:55:04 +00:00
David Carlier
bceb3adb42
Merge branch 'PHP-8.3' into PHP-8.4 2024-11-27 19:54:23 +00:00
Gina Peter Banyard
eaffa1150a ext/gmp: Compare object CE to gmp_ce directly
The GMP class is now final, therefore we don't need to use the instanceof function.
2024-11-27 19:08:50 +00:00
Gina Peter Banyard
313886e22b ext/gmp: Refactor op overloading for ZEND_BW_NOT
The only way for the do_operation object handler to be called for unary operations is when the zval is an object.
Therefore we know we have a zval of the correct type and there is no need to check for it.
2024-11-27 19:08:50 +00:00
Christoph M. Becker
7e1d035077
Factor out SETUP_ZLIB_LIB() (GH-16798)
Note that this function is similar to `SETUP_OPENSSL`, but since the
zlib headers are not necessarily required, we append `_LIB`.

We are also more liberal regarding zlib(_a).lib, because
extensions requiring zlib are looking only for zlib.lib if ext/zlib has
been built as shared extension.  This is overly restrictive at best,
and actually makes no sense, since (a) we're not shipping shared zlib
builds for years, and (b) users could have a zlib.lib which is a static
build (they could even just rename zlib_a.lib to zlib.lib).
2024-11-27 18:35:34 +01:00
Gina Peter Banyard
0800c68be6 ext/gmp: Remove redundant parenthesis 2024-11-27 15:10:49 +00:00
Gina Peter Banyard
0b5b9472ff Normalize gmp_cmp() to -1/0/+1 2024-11-27 15:10:49 +00:00
Gina Peter Banyard
89eaa1fe5f ext/gmp: Refactor gmp_cmp() test 2024-11-27 15:10:49 +00:00
Gina Peter Banyard
601f6cd54d ext/gmp: Use new parsing mechanism in comparison operator overloading
This removes the last usages of the old GMP_FETCH API
2024-11-27 15:10:49 +00:00
Gina Peter Banyard
92ff44da12 ext/gmp: Use new parsing API in shift helper 2024-11-27 15:10:49 +00:00
Gina Peter Banyard
0831608c8b ext/gmp: Add weak mode support for parsing 2024-11-27 15:10:49 +00:00
Gina Peter Banyard
27044108d3 ext/gmp: Convert GMP operator overloading to new parsing mechanism 2024-11-27 15:10:49 +00:00
Gina Peter Banyard
8b2cd8fd2d ext/gmp: Start refactoring operator overloading to use new parsing mechanism 2024-11-27 15:10:49 +00:00
Gina Peter Banyard
2681da4531 ext/gmp: Refactor gmp_fact() to use new ZPP specifier
Not sure it is the best approach to do this one however
2024-11-27 15:10:49 +00:00
Gina Peter Banyard
5199904c57 ext/gmp: Remove now unused FETCH_GMP_ZVAL_DEP_DEP macro 2024-11-27 15:10:49 +00:00
Gina Peter Banyard
fabfb6fe00 ext/gmp: Refactor gmp_divexact() and gmp_mod() to use custom ZPP specifier 2024-11-27 15:10:49 +00:00
Gina Peter Banyard
8e9b944a83 ext/gmp: Refactor gmp_div_(q|r)() to use new ZPP specifier 2024-11-27 15:10:49 +00:00
Gina Peter Banyard
1f5ba59b61 ext/gmp: Refactor gmp_div_qr() to use new ZPP specifier 2024-11-27 15:10:49 +00:00
Gina Peter Banyard
376c148fb8 ext/gmp: Refactor gmp_random_range() to use new ZPP specifier 2024-11-27 15:10:49 +00:00
Gina Peter Banyard
3964efd729 ext/gmp: Use new specifier for gmp_cmp()
It seems that this also now normalizes the return value
2024-11-27 15:10:49 +00:00
Gina Peter Banyard
1e3876039f ext/gmp: Refactor generation of some binary GMP functions 2024-11-27 15:10:49 +00:00
Gina Peter Banyard
a9e2a96e69 ext/gmp: Refactor generation of unary GMP functions 2024-11-27 15:10:49 +00:00
Gina Peter Banyard
10003a3f5d ext/gmp: Use new custom ZPP specifier 2024-11-27 15:10:49 +00:00
Gina Peter Banyard
290f69662a ext/gmp: Create custom Fast ZPP specifier to parse into mpz_ptr
We define module globals to be used with ZPP, which also avoids excessive initializing and clearing of variables,
something recommended by the GMP documentation.
2024-11-27 15:10:49 +00:00
Gina Peter Banyard
2313a465b6 Inline gmp_unary_opl() as it was only used once
That use being gmp_popcount()
2024-11-27 15:10:49 +00:00
Gina Peter Banyard
9ee1265e0c ext/gmp: Use Fast ZPP for GMP functions 2024-11-27 15:10:49 +00:00
Gina Peter Banyard
57ae2c9530 ext/gmp: Split out non-existent inverse modulo cases 2024-11-27 15:10:49 +00:00
Máté Kocsis
17187c4646
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix the 1st parameter type casing of pg_set_chunked_rows_size()
2024-11-26 22:49:29 +01:00
Máté Kocsis
56fb910d9c
Fix the 1st parameter type casing of pg_set_chunked_rows_size() 2024-11-26 22:48:33 +01:00
Dmitry Stogov
2de0d8ebbe
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16821: runtime error: member access within misaligned address when running phpseclib tests (#16951)
2024-11-27 00:44:03 +03:00
Dmitry Stogov
b89d7ff92a
Fix GH-16821: runtime error: member access within misaligned address when running phpseclib tests (#16951) 2024-11-27 00:43:45 +03:00
Niels Dossche
c2a6a7da7b
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-15208: Segfault with breakpoint map and phpdbg_clear()
2024-11-26 22:27:40 +01:00
Niels Dossche
5ff67f8720
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-15208: Segfault with breakpoint map and phpdbg_clear()
2024-11-26 22:27:35 +01:00
Niels Dossche
408f5f835c
Merge branch 'PHP-8.4'
* PHP-8.4:
  Backport GH-14962 to stable versions
2024-11-26 21:25:25 +01:00
Niels Dossche
0d8c5ade72
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Backport GH-14962 to stable versions
2024-11-26 21:25:13 +01:00
Niels Dossche
30ec2de83f
Merge branch 'PHP-8.4'
* PHP-8.4:
  Extract call_level conditions out to separate functions (#16949)
2024-11-26 21:23:59 +01:00
Niels Dossche
ed556939df
Extract call_level conditions out to separate functions (#16949)
These are repeated a couple of times, so centralise it in 2 functions to
reduce repetition and make updating this less error-prone.
2024-11-26 21:22:12 +01:00
Niels Dossche
4591f0427f
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix various memory leaks in curl mime handling
2024-11-26 20:40:16 +01:00
Niels Dossche
8206de62f7
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix various memory leaks in curl mime handling
2024-11-26 20:40:09 +01:00
Dmitry Stogov
be27cbdc4a
Merge branch 'PHP-8.4'
* PHP-8.4:
  Avoid possible spill conflict (one of the problem that caused GH-16821) (#16947)
2024-11-26 21:44:32 +03:00
Dmitry Stogov
d31de85f5f
Avoid possible spill conflict (one of the problem that caused GH-16821) (#16947) 2024-11-26 21:44:15 +03:00
Niels Dossche
b3db7f7a9c
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16879: JIT dead code skipping does not update call_level
2024-11-26 19:27:29 +01:00
Niels Dossche
de30ba5042
Fix GH-16879: JIT dead code skipping does not update call_level
We intend to execute `MATCH_ERROR` in the VM and return to trace a hot
function in BB1. We generate a tail handler and skip all remaining
oplines of BB0. That means the `INIT_FCALL` in BB0 is missed and
`call_level` is not increased to 1. This leads to the assertion
failure.
This patch fixes the issue by updating the `call_level` for the skipped
oplines.

Closes GH-16939.
2024-11-26 19:27:17 +01:00
Niels Dossche
cef23c4853
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix is_zend_ptr() huge block comparison
2024-11-26 19:24:54 +01:00
Niels Dossche
8fdcd9f051
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix is_zend_ptr() huge block comparison
2024-11-26 19:24:47 +01:00
Christophe Coevoet
d411fdf615
Fix rST markup in the documentation about stubs (GH-16888) 2024-11-26 17:02:14 +01:00
Derick Rethans
a16ee2f1c3
Merge branch 'PHP-8.4' 2024-11-26 15:41:10 +00:00
Derick Rethans
118ed09ab2
Merge branch 'PHP-8.3' into PHP-8.4 2024-11-26 15:41:04 +00:00
Samuel Melrose
5191581e9c
Fix merge of GH-16551
Some commits were mistakenly discarded during the rebase and squash of GH-16551.
2024-11-26 16:35:14 +01:00
Dmitry Stogov
7b17313a7d
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16913: 8.4 function JIT memory corruption (#16943)
2024-11-26 17:00:16 +03:00
Dmitry Stogov
7892a0ec8a
Fix GH-16913: 8.4 function JIT memory corruption (#16943)
with '#' will be ignored, and an empty message aborts the commit.
2024-11-26 16:59:57 +03:00
Arnaud Le Blanc
ea39c2709f
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix setRawValueWithoutLazyInitialization() and skipLazyInitialization() on initialized proxy
2024-11-26 14:07:32 +01:00
Arnaud Le Blanc
c310be09ed
Fix setRawValueWithoutLazyInitialization() and skipLazyInitialization() on initialized proxy
Normally, accesses to properties marked as lazy trigger the object's
initialization, or forward to a real instance if the object is an initialized
proxy.

The purpose of ReflectionProperty::setRawValueWithoutLazyInitialization() and
ReflectionProperty::skipLazyInitialization() is to bypass auto-initialization,
so that some properties can be initialized without triggering initialization.

However, when the object is an initialized proxy, these methods would
unexpectedly update the proxy.

Here I make sure that these methods have an effect on the real instance, when
the object is an initialized proxy.

Fixes GH-16344
2024-11-26 14:04:58 +01:00
Máté Kocsis
02c2cfaaf3
Add support for non-parameter attribute rendering in stubs (#16926) 2024-11-26 13:47:09 +01:00
Christoph M. Becker
90b66edbca
Merge branch 'PHP-8.4'
* PHP-8.4:
  Add Windows Server 2025 build number
2024-11-26 13:35:37 +01:00
David Warner
f086eaa7b8
Add Windows Server 2025 build number
Closes GH-16838.
2024-11-26 13:35:08 +01:00
Samuel Melrose
37995c09b7
Add opcache.file_cache_read_only
Closes GH-16551
2024-11-26 13:06:52 +01:00
Niels Dossche
afa08b509e
Remove useless code in ext-enchant (#16940)
The MSHUTDOWN() does nothing, and the GET_BROKER macros are duplicated.
2024-11-26 07:27:19 +01:00
Christoph M. Becker
ba6c00505d
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16849: Error dialog causes process to hang
2024-11-25 23:09:36 +01:00
Christoph M. Becker
4c5710579a
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16849: Error dialog causes process to hang
2024-11-25 23:09:13 +01:00
Kamil Tekiela
3e1138e997 Remove disable_native_prepares 2024-11-25 22:27:43 +01:00
Christoph M. Becker
00e88b08d5
[skip ci] Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] chore: update minimum required PHP version.
2024-11-25 22:22:26 +01:00
Marcos Marcolin
7417c63413
[skip ci] chore: update minimum required PHP version.
Closes GH-16868.
2024-11-25 22:21:28 +01:00
Christoph M. Becker
d43879e224
Merge branch 'PHP-8.4'
* PHP-8.4:
  Use another for bug51056.phpt
2024-11-25 22:07:26 +01:00
Christoph M. Becker
8a5fd6c027
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Use another for bug51056.phpt
2024-11-25 22:06:59 +01:00
Niels Dossche
4c189ae585
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix test expectation for PHP 8.3+
2024-11-25 20:33:26 +01:00
Niels Dossche
ec9a606e5d
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix test expectation for PHP 8.3+
2024-11-25 20:33:20 +01:00
Niels Dossche
aa05c827e2
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16902: Set of opcache tests fail zts+aarch64 (8.4+)
  Fix GH-16902: Set of opcache tests fail zts+aarch64 (8.2-8.3)
2024-11-25 19:51:13 +01:00
Niels Dossche
f4ca6d2794
Fix GH-16902: Set of opcache tests fail zts+aarch64 (8.4+)
Accompanying IR PR: https://github.com/dstogov/ir/pull/95

Closes GH-16924.
2024-11-25 19:51:01 +01:00
Niels Dossche
8e57df237f
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16902: Set of opcache tests fail zts+aarch64 (8.2-8.3)
2024-11-25 19:50:47 +01:00
Niels Dossche
5e9273ad0a
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16908: _ZendTestMagicCallForward does not handle references well
2024-11-25 19:39:06 +01:00
Niels Dossche
43a3bd0608
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16908: _ZendTestMagicCallForward does not handle references well
2024-11-25 19:39:01 +01:00
Christoph M. Becker
288776e7f8
Drop duplicate macro definitions (GH-16848)
Apparently, these have been overlooked when the macro definitions have
been moved from dns.c to php_dns.h[1].

[1] <6f2f228e4a>
2024-11-25 13:56:58 +01:00
Christoph M. Becker
5683e8b46b
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix potential conflict of copy_variation5-win32.phpt
2024-11-25 13:50:40 +01:00
Christoph M. Becker
053af52835
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix potential conflict of copy_variation5-win32.phpt
2024-11-25 13:50:16 +01:00
Ayesh Karunaratne
877d0cadf2
Merge branch 'PHP-8.4'
* PHP-8.4:
  CI: FreeBSD on VM - set `copyback: false`
2024-11-25 19:34:17 +07:00
Ayesh Karunaratne
cb90566164
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  CI: FreeBSD on VM - set `copyback: false`
2024-11-25 19:33:38 +07:00
Christoph M. Becker
e87a433c20
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16890: array_sum() with GMP can loose precision (LLP64)
2024-11-25 12:56:25 +01:00
Christoph M. Becker
bd6b9df5dd
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16890: array_sum() with GMP can loose precision (LLP64)
2024-11-25 12:55:58 +01:00
Dmitry Stogov
de17e243d5
Merge branch 'PHP-8.4'
* PHP-8.4:
  Update IR
2024-11-25 10:35:11 +03:00
Dmitry Stogov
ba8e3e1d79
Update IR
IR commit: ff7ee6c1e6090ba0ba7b47cb77939518304fab6b
2024-11-25 10:29:41 +03:00
Christoph M. Becker
32ff46b633
Fix ZTS OPcache build on Cygwin
`configure --enable-opcache --disable-opcache-jit --enable-zts` won't
compile on Cygwin.  We fix this, but that does not imply that OPcache
properly works in this environment, let alone that JIT would be
functional.

Closes GH-16920.
2024-11-25 00:29:27 +01:00
Jakub Zelenka
b0b876d076
Merge branch 'PHP-8.4' 2024-11-24 23:50:09 +01:00
Jakub Zelenka
a5db8b3fe5
Merge branch 'PHP-8.3' into PHP-8.4 2024-11-24 23:49:55 +01:00
Jakub Zelenka
59ed9cebaa
Merge branch 'PHP-8.4' 2024-11-24 20:16:26 +01:00
Jakub Zelenka
17c93e6c51
Merge branch 'PHP-8.3' into PHP-8.4 2024-11-24 20:16:01 +01:00
Jakub Zelenka
b3a615391a
Merge branch 'PHP-8.4' 2024-11-24 19:48:06 +01:00
Jakub Zelenka
181b4c1861
Merge branch 'PHP-8.3' into PHP-8.4 2024-11-24 19:47:34 +01:00
Niels Dossche
f576b81340
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16906: Reloading document can cause UAF in iterator
2024-11-24 18:20:29 +01:00
Niels Dossche
52c7c74ebb
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16906: Reloading document can cause UAF in iterator
2024-11-24 18:20:21 +01:00
Jorg Adam Sowa
cd977ae6a1
[skip-ci] Removed wrapping comments (#16894) 2024-11-24 00:57:09 +00:00
Niels Dossche
c84b7ed0c5
Merge branch 'PHP-8.4'
* PHP-8.4:
  [ci skip] UPGRADING fixes (#16893)
2024-11-22 08:58:45 +01:00
Niels Dossche
9ee607823e
[ci skip] UPGRADING fixes (#16893)
It seems at one point these were (partially) rewritten, changing their
meaning. This patch fixes this.
2024-11-22 08:56:14 +01:00
David Carlier
ccda20b8d1
ext/sockets: Adding TCP_FUNCTION_BLK socket option for FreeBSD.
Allows to select an alternate TCP stack. For example with RACK,
a fast loss detection relying on timestamp per packet.

While it works system-wide, it can also apply in an individual socket level too.

close GH-16842
2024-11-21 23:00:06 +00:00
Ilija Tovilo
f44eaac48a
Simplify duplicate member flag check (GH-16874) 2024-11-21 14:54:57 +01:00
Christoph M. Becker
91f0b3bc04
Merge branch 'PHP-8.4'
* PHP-8.4:
  Reapply "Merge branch 'PHP-8.3' into PHP-8.4"
2024-11-20 23:25:33 +01:00
Christoph M. Becker
da81b5c8d2
Reapply "Merge branch 'PHP-8.3' into PHP-8.4"
This reverts commit 83ca37483c, and
fixes the previous bad merge.
2024-11-20 23:24:43 +01:00
Marcos Marcolin
6bf703ad98
chore: remove unused variable. (#16867)
Co-authored-by: Marcos Marcolin <marcos@ixcsoft.com.br>
2024-11-20 22:46:38 +01:00
Christoph M. Becker
7b99da42ee
Merge branch 'PHP-8.4'
* PHP-8.4:
  Revert "Merge branch 'PHP-8.3' into PHP-8.4"
2024-11-20 19:46:14 +01:00
Christoph M. Becker
83ca37483c
Revert "Merge branch 'PHP-8.3' into PHP-8.4"
This reverts commit ae62779386, reversing
changes made to 19e685ecc4.

This was a bad merge; I'll have a look shortly.
2024-11-20 19:45:36 +01:00
Christoph M. Becker
81779c2863
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16851: JIT_G(enabled) not set correctly on other threads
2024-11-20 19:15:19 +01:00
Christoph M. Becker
ae62779386
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16851: JIT_G(enabled) not set correctly on other threads
2024-11-20 19:14:57 +01:00
Christoph M. Becker
ce55152060
Merge branch 'PHP-8.4'
* PHP-8.4:
  Skip file_put_contents_variation7.phpt on Windows
2024-11-20 15:52:11 +01:00
Christoph M. Becker
19e685ecc4
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Skip file_put_contents_variation7.phpt on Windows
2024-11-20 15:51:48 +01:00
Ilija Tovilo
3aa4973acd
Merge branch 'PHP-8.4'
* PHP-8.4:
  Enable -Werror for FreeBSD build
  [skip ci] Add --no-progress to FreeBSD build
  Move FreeBSD build to GitHub actions with QEMU
2024-11-20 14:29:52 +01:00
Ilija Tovilo
b3ab930a2f
Enable -Werror for FreeBSD build 2024-11-20 14:28:40 +01:00
Ilija Tovilo
2b50534e27
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [skip ci] Add --no-progress to FreeBSD build
  Move FreeBSD build to GitHub actions with QEMU
2024-11-20 14:28:09 +01:00
Ilija Tovilo
73f1e1bb50
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Don't test mysqli with libmysqlclient 8.4
2024-11-20 14:19:41 +01:00
Ilija Tovilo
5d4ae656c8
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [skip ci] Don't test mysqli with libmysqlclient 8.4
2024-11-20 14:19:33 +01:00
Christoph M. Becker
7b9113178d
Merge branch 'PHP-8.4'
* PHP-8.4:
  Make MySQLnd protocol stmt test work on 32bit
2024-11-20 13:54:30 +01:00
Christoph M. Becker
2187d20e28
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Make MySQLnd protocol stmt test work on 32bit
2024-11-20 13:54:09 +01:00
Ilija Tovilo
0b8fe1af87
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Backport GA root workflow changes
2024-11-20 13:42:53 +01:00
Ilija Tovilo
72ab374d6b
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [skip ci] Backport GA root workflow changes
2024-11-20 13:42:45 +01:00
chx
e5c2bc41ed
Improve error message when overriding untyped property with typed property (GH-16866) 2024-11-20 11:59:29 +01:00
Jakub Zelenka
4b211a7769
Merge branch 'PHP-8.4' 2024-11-20 11:14:32 +01:00
Jakub Zelenka
7c96af42b7
Merge branch 'PHP-8.3' into PHP-8.4 2024-11-20 11:14:04 +01:00
Saki Takamachi
f2f9831ddc
Merge branch 'PHP-8.4'
* PHP-8.4:
  PHP-8.4 is now for PHP 8.4.1-dev
2024-11-20 17:20:17 +09:00
Saki Takamachi
1fd82aa13a
PHP-8.4 is now for PHP 8.4.1-dev 2024-11-20 17:19:18 +09:00
Dmitry Stogov
ba0ecaa107
Merge branch 'PHP-8.4'
* PHP-8.4:
  Use the immutable twin of temporary op_array (#16861)
2024-11-19 20:55:50 +03:00
Dmitry Stogov
d0c336a666
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Use the immutable twin of temporary op_array (#16861)
2024-11-19 20:55:40 +03:00
Saki Takamachi
86e2a48dc2
Merge branch 'PHP-8.4'
* PHP-8.4:
  Prepare NEWS for 8.4.0
2024-11-20 01:58:25 +09:00
Saki Takamachi
315fef2c72
Prepare NEWS for 8.4.0 2024-11-20 01:57:56 +09:00
Saki Takamachi
09d25b2964
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] NEWS for #16694
2024-11-20 00:43:00 +09:00
Saki Takamachi
fa36346a6c
[skip ci] NEWS for #16694 2024-11-20 00:42:40 +09:00
Saki Takamachi
9b3af0253f
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fixed a bug in BcMath\Number::pow() and bcpow() when raising negative powers of 0. (#16694)
2024-11-20 00:17:38 +09:00
Saki Takamachi
2c8662d6f9
Fixed a bug in BcMath\Number::pow() and bcpow() when raising negative powers of 0. (#16694)
Closes #16694
Fixes #16236
2024-11-20 00:16:52 +09:00
Patrick Allaert
cc308de069
Merge branch 'PHP-8.4' 2024-11-19 16:12:32 +01:00
Patrick Allaert
60e4f48fca
Merge branch 'PHP-8.3' into PHP-8.4 2024-11-19 16:12:17 +01:00
Dmitry Stogov
a691d340d1
Merge branch 'PHP-8.4'
* PHP-8.4:
  Backport JIT fix: set valid EX(opline) before calling gc_possible_root() (#16858)
2024-11-19 18:04:50 +03:00
Dmitry Stogov
9dade02569
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Backport JIT fix: set valid EX(opline) before calling gc_possible_root() (#16858)
2024-11-19 18:04:33 +03:00
Christoph M. Becker
2834f47031
Fix test expectation for single digit days
See <https://github.com/php/php-src/pull/16747#pullrequestreview-2444293792>.

Co-authored-by: Ayesh Karunaratne <ayesh@aye.sh>
2024-11-19 12:28:32 +01:00
Christoph M. Becker
ff5b42b839
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16839: Error on building Opcache JIT for Windows ARM64
2024-11-18 23:29:26 +01:00
Christoph M. Becker
e44b7625c5
Fix GH-16839: Error on building Opcache JIT for Windows ARM64
OPcache JIT does not support Windows ARM64, so we should not allow
`--enable-opcache-jit` in the first place.

Due to the way `ARG_ENABLE()` is handled on Windows, we do not attempt
to suppress the configure option, but just do not enable JIT when the
user attempts to, and adapt the help text.

Closes GH-16841.
2024-11-18 23:27:54 +01:00
Christoph M. Becker
6dec6a6dba
Add PHP_BUILD_DATE constant
This information can be occasionally useful, and would otherwise need
to be parsed from `phpinfo()` output.

However, maybe more importantly we unify the build date between what is
given by `php -v` and `php -i`, since these compilation units are not
necessarily preprocessed within the same second.

Closes GH-16747.
2024-11-18 20:53:28 +01:00
Christoph M. Becker
03cbb3ee58
Build com_dotnet shared by default
The official Windows builds and CI are doing this for ages, so it
appears to be overdue to finally switch the actual default.

Closes GH-16300.
2024-11-18 20:50:22 +01:00
Niels Dossche
dd4fc9aebb
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16630: UAF in lexer with encoding translation and heredocs
2024-11-18 19:59:16 +01:00
Niels Dossche
e00d684420
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16630: UAF in lexer with encoding translation and heredocs
2024-11-18 19:59:08 +01:00
Ilija Tovilo
4b517a969a
[skip ci] Document HASH_ constants (#16806)
Not all of these are straight-forward to understand.
2024-11-18 19:28:15 +01:00
Dmitry Stogov
14320df0f5
Merge branch 'PHP-8.4'
* PHP-8.4:
  JIT: Set valid EX(opline) before calling gc_possible_root()
2024-11-18 19:32:33 +03:00
Dmitry Stogov
997431dea2
JIT: Set valid EX(opline) before calling gc_possible_root() 2024-11-18 19:31:26 +03:00
Jakub Zelenka
07cef9fb65
Merge branch 'PHP-8.4' 2024-11-18 16:50:52 +01:00
Jakub Zelenka
e47f18156e
Merge branch 'PHP-8.3' into PHP-8.4 2024-11-18 16:50:05 +01:00
Ilija Tovilo
bd5939d57e
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix get_object_vars() for non-hooked props in hooked prop iter
2024-11-18 16:20:33 +01:00
Ilija Tovilo
048fa7bacc
Fix get_object_vars() for non-hooked props in hooked prop iter
The zend_hash_update_ind() variant unwraps indirects, rather than creating them.
Don't use _zend_hash_append_ind() because the property might already exist.

Fixes GH-16725
Closes GH-16805
2024-11-18 16:20:19 +01:00
Dmitry Stogov
1307d3037c
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fixed test
2024-11-18 15:35:21 +03:00
Dmitry Stogov
159b71c0f4
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fixed test
2024-11-18 15:35:13 +03:00
Dmitry Stogov
5882da22ec
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16829: Segmentation fault with opcache.jit=tracing enabled on aarch64
2024-11-18 14:35:05 +03:00
Dmitry Stogov
e55bf9a2ea
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16829: Segmentation fault with opcache.jit=tracing enabled on aarch64
2024-11-18 14:34:55 +03:00
Niels Dossche
b112d27ff5
[ci skip] Update last check date for compareDocumentPosition()
I validated there were no spec changes for this, so we can bump the last
check date.
2024-11-17 13:41:59 +01:00
David Carlier
5c6f18be5c
Merge branch 'PHP-8.4' 2024-11-17 12:28:12 +00:00
David Carlier
f7a508ca10
Merge branch 'PHP-8.3' into PHP-8.4 2024-11-17 12:27:36 +00:00
Gina Peter Banyard
27a1d69504
Merge branch 'PHP-8.4'
* PHP-8.4:
  ext/pdo_pgsql: Remove new PDO class constant specific to PGSQL driver
2024-11-16 16:30:55 +00:00
Gina Peter Banyard
5e360b6402
ext/pdo_pgsql: Remove new PDO class constant specific to PGSQL driver
Closes GH-16755
2024-11-16 16:30:19 +00:00
Niels Dossche
cfc8361fe6
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16777: Calling the constructor again on a DOM object after it is in a document causes UAF
  Fix GH-16808: Segmentation fault in RecursiveIteratorIterator->current() with a xml element input
2024-11-16 13:42:22 +01:00
Niels Dossche
d3fada3748
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16777: Calling the constructor again on a DOM object after it is in a document causes UAF
  Fix GH-16808: Segmentation fault in RecursiveIteratorIterator->current() with a xml element input
2024-11-16 13:42:14 +01:00
Christoph M. Becker
0de8e401db
Drop bogus ext/libxml dependency on ext/iconv (GH-16801)
There is no such dependency; only libxml2 depends on libiconv.  So when
php_libxml.dll is built, it needs to be linked against libiconv, or,
when ext/iconv has been configured as static extension, against
php8.dll.
2024-11-15 21:25:00 +01:00
Niels Dossche
2c532cf02b
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16802: open_basedir bypass using curl extension
2024-11-15 21:17:56 +01:00
Niels Dossche
1b803bc3f5
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16802: open_basedir bypass using curl extension
2024-11-15 21:17:51 +01:00
Niels Dossche
a0983a012c
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix test expectation for different closure name in 8.4
2024-11-15 20:33:06 +01:00
Niels Dossche
6a55beef90
Fix test expectation for different closure name in 8.4 2024-11-15 20:32:59 +01:00
Niels Dossche
4c88bfb96d
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16799: Assertion failure at Zend/zend_vm_execute.h:7469
2024-11-15 20:05:40 +01:00
Niels Dossche
4a5854ee62
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16799: Assertion failure at Zend/zend_vm_execute.h:7469
2024-11-15 20:03:26 +01:00
Christoph M. Becker
b7165f5d01
Merge branch 'PHP-8.4'
* PHP-8.4:
  Adapt ext/intl tests for ICU 75.1 and 76.1
2024-11-15 18:57:35 +01:00
Christoph M. Becker
54ae770cd6
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Adapt ext/intl tests for ICU 75.1 and 76.1
2024-11-15 18:57:12 +01:00
Christoph M. Becker
23d390ecb1
Merge branch 'PHP-8.4'
* PHP-8.4:
  Update FreeBSD CI
2024-11-15 18:24:58 +01:00
Christoph M. Becker
fb5fa4a689
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Update FreeBSD CI
2024-11-15 18:24:20 +01:00
David Carlier
4f76baba29
Merge branch 'PHP-8.4' 2024-11-15 16:51:10 +00:00
David Carlier
b8ba6f63a3
Fix GH-16812: UAF on readline_info() after readline_write_history() call.
close GH-16813
2024-11-15 16:50:24 +00:00
Christoph M. Becker
1922f41ef3
Merge branch 'PHP-8.4'
* PHP-8.4:
  Stick with icu4c 74.2 on macOS CI for PHP-8.1
2024-11-15 14:28:09 +01:00
Christoph M. Becker
0ed855aa07
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Stick with icu4c 74.2 on macOS CI for PHP-8.1
2024-11-15 14:27:34 +01:00
Niels Dossche
3f4bcd8cba
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16770: Tracing JIT type mismatch when returning UNDEF
2024-11-14 22:34:19 +01:00
Niels Dossche
4767c0626c
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16770: Tracing JIT type mismatch when returning UNDEF
2024-11-14 22:34:12 +01:00
Ilija Tovilo
f0b4847100
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix i386 release build warning
2024-11-14 20:39:46 +01:00
Ilija Tovilo
9ca19e9c52
[skip ci] Merge branch 'PHP-8.4'
* PHP-8.4:
  UPGRADING: Fix `CURLOPT_TCP_KEEPCNT` entry
2024-11-14 20:38:56 +01:00
Ilija Tovilo
ec3de14afb
Fix i386 release build warning
Closes GH-16730
2024-11-14 20:36:23 +01:00
Ayesh Karunaratne
efe4fc9f99
UPGRADING: Fix CURLOPT_TCP_KEEPCNT entry 2024-11-14 23:33:03 +07:00
Christoph M. Becker
2d1c3825a8
Simplify WBMP imagecreatefromstring() detection (GH-16782)
According to the WBMP specification[1], the first field (type) of a
WBMP is a multi-byte integer, but only type `0` is supported.  Thus
there is no need to read a multi-byte integer.  The second field (fix
header) is a single byte; reading a multi-byte integer is not really
wrong, since the fix header field is laid out in a way which allows it
to be treated as such, but the check whether the MBI is greater than
or equal to zero is pretty useless, because negative values could only
be returned if overflow occurs (MBIs are unsigned).

So the only useful assumption we can make is that the first byte is
zero; we let `gdImageCreateFromWBMPCtx()` figure out the rest.

[1] <https://www.wapforum.org/what/technical/SPEC-WAESpec-19990524.pdf> section 6
2024-11-14 14:00:19 +01:00
Christoph M. Becker
d4103b3570
Remove superfluous determination of cURL version (GH-16787)
This was originally meant to distinguish between libcurl 7.59.0 and
earlier; only the latter would need to be linked against normalize.lib,
libssh2.lib and nghttp2.lib[1].  That would only have catered to our
builds, and might not have been correct anyway.  However, the version
check was wrong (paren error), and has been removed in the meantime[2].

Given that cURL 7.59.0 is rather old, we do not reinstate the version
check, but rather drop the now superfluous (and improper) determination
of the cURL version.  A nice bonus is that we get rid of some global
variables.

[1] <a1ba3007a4>
[2] <94a12d5b31>
2024-11-14 12:25:08 +01:00
Christoph M. Becker
3815a773a1
Close GH-16659: Bump ICU requirement to ICU >= 57.1
This requirements bump should rarely affect anybody in practice.  All
major distros already ship more recent ICU versions, and even for
Solaris 11, ICU 57.1 is available via OpenCSW.  Note that ICU 57.1 has
been released on 2016-03-23[1].

[1] <https://icu.unicode.org/download/57>

Closes GH-16688.
2024-11-14 01:30:48 +01:00
Christoph M. Becker
0db7e53b84
Merge branch 'PHP-8.4'
* PHP-8.4:
  Need to define BREW_OPT
2024-11-13 21:25:50 +01:00
Christoph M. Becker
f2dbad6f04
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Need to define BREW_OPT
2024-11-13 21:24:54 +01:00
Christoph M. Becker
fa3421cd10
Merge branch 'PHP-8.4'
* PHP-8.4:
  Patch libcurl.pc for macOS builds
2024-11-13 19:40:52 +01:00
Christoph M. Becker
3d07b9e771
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Patch libcurl.pc for macOS builds
2024-11-13 19:40:21 +01:00
Niels Dossche
28344e0445
Get rid of HASH_OF() in ext/dom (#16767)
The cases where this is used are only where an array is possible, so we
can replace them with Z_ARRVAL_P. This reduces some overhead.
2024-11-13 17:32:27 +01:00
David Carlier
b948332779
Merge branch 'PHP-8.4' 2024-11-13 12:49:44 +00:00
David Carlier
ec05cd559b
Merge branch 'PHP-8.3' into PHP-8.4 2024-11-13 12:49:13 +00:00
David Carlier
53e5c09052
Merge branch 'PHP-8.4' 2024-11-13 12:12:25 +00:00
David Carlier
b8115d6c5e
Fix GH-16769: php_pcntl_set_user_signal_infos aborts when a signal is a reference.
close GH-16772
2024-11-13 12:11:43 +00:00
Dmitry Stogov
7b029a318b
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix incorrect handling of ZEND_ACC_FINAL flag in JIT (#16778)
2024-11-13 14:43:54 +03:00
Dmitry Stogov
f6256fa2c0
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix incorrect handling of ZEND_ACC_FINAL flag in JIT (#16778)
2024-11-13 14:43:43 +03:00
Dmitry Stogov
3b115e6e9b
Fix zend_jit_class_may_be_modified() fon non linked classes 2024-11-13 12:51:21 +03:00
David Carlier
33ba1a4ab9
ext/sockets: adding IPPROTO_ICMP* constants for socket creations.
Is to create socket for Internet Control Message Protocol context.
Due to their nature, they are meant to be used via
raw sockets rather than TCP/UDP.

close GH-16737
2024-11-12 18:52:22 +00:00
Niels Dossche
7202d119cd
Fix parameter list generation in build/gen_stub.php (#16764)
[ci skip]

<variablelist> is not valid within <simpara>, this should not be wrapped
at all in a paragraph.
Regressed in 32789c0047.
2024-11-12 19:31:00 +01:00
Arnaud Le Blanc
a087442259
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix the name of the initializer parameter of ReflectionClass::resetAsLazyGhost()
2024-11-12 18:52:16 +01:00
Arnaud Le Blanc
a8151fc511
Fix the name of the initializer parameter of ReflectionClass::resetAsLazyGhost()
Closes GH-16758
2024-11-12 18:51:33 +01:00
Dmitry Stogov
b106feae71
Improve zend_jit_may_be_modified() check (#16760) 2024-11-12 13:41:49 +03:00
Niels Dossche
7f5a888bdb
Change dom_node_is_read_only() to return bool (#16757)
Returning int or zend_result doesn't make sense, it's a yes/no question.
2024-11-11 20:57:52 +01:00
Calvin Buckley
cec9a98bc6
Clean up ODBC header (#16754)
Remove an unused field from globals, fix indentation.
2024-11-11 15:05:45 -04:00
Niels Dossche
dfba04e807
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16727: Opcache bad signal 139 crash in ZTS bookworm (frankenphp)
2024-11-11 16:20:44 +01:00
Niels Dossche
382be923ae
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16727: Opcache bad signal 139 crash in ZTS bookworm (frankenphp)
2024-11-11 16:20:39 +01:00
Gina Peter Banyard
234219dc33 ext/phar: Refactor phar_call_openssl_signverify() 2024-11-11 15:00:08 +00:00
Gina Peter Banyard
2684a5ef91 ext/phar: Fix test that is only run when ext/openssl is not built 2024-11-11 15:00:08 +00:00
Gina Peter Banyard
7ba978806b
ext/intl: Refactor internal callable handling for UConverter (#16749) 2024-11-11 14:16:12 +00:00
Gina Peter Banyard
573ad05a8d
Merge branch 'PHP-8.4'
* PHP-8.4:
  ext/standard: Sync parameter names for fpow() to be identical to pow()
2024-11-11 13:07:02 +00:00
Gina Peter Banyard
e7891838a1
ext/standard: Sync parameter names for fpow() to be identical to pow()
Closes GH-16751
2024-11-11 13:04:46 +00:00
Gina Peter Banyard
53df3ae1e5
ext/curl: Use Z_ARRVAL_P instead of HASH_OF
We already check in advance that it is an array
2024-11-10 21:45:24 +00:00
Gina Peter Banyard
23b8d64cf7
Zend: Minor refactorings to zend_exceptions() (#16684) 2024-11-10 21:44:30 +00:00
Gina Peter Banyard
b48fdcb6e6
Merge branch 'PHP-8.4'
* PHP-8.4:
  ext/hash: Fix deprecation message output for new tests
2024-11-10 20:35:04 +00:00
Gina Peter Banyard
883d3c8113
ext/hash: Fix deprecation message output for new tests 2024-11-10 20:34:45 +00:00
Gina Peter Banyard
46431487f7
Merge branch 'PHP-8.4'
* PHP-8.4:
  ext/hash: Fix GH-16711: Segfault in mhash()
  ext/hash: Add failing tests for GH-16711
2024-11-10 20:17:28 +00:00
Gina Peter Banyard
c1d67c2415
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  ext/hash: Fix GH-16711: Segfault in mhash()
  ext/hash: Add failing tests for GH-16711
2024-11-10 20:17:09 +00:00
Christoph M. Becker
067ac63196
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Fix MYSQLND_HAVE_SSL preprocessor help texts
2024-11-10 20:41:35 +01:00
Peter Kokot
41347f017b
[skip ci] Fix MYSQLND_HAVE_SSL preprocessor help texts
The MYSQLND_HAVE_SSL indicate that mysqlnd has extended SSL support
enabled through either OpenSSL when building with Autotools, and through
crypt32 library on Windows.

Fixes https://github.com/php/php-src/pull/15164#discussion_r1803834585

Closes GH-16474.
2024-11-10 20:41:06 +01:00
DanielEScherzer
62e53e6f49
Inline and remove reflection_instantiate() (#16739)
Since the return value is never used, the only difference between using this
method and using `object_init_ex()` directly is the flipped order of
parameters, and the added level of indirection - remove that level of
indirection by replacing its uses.
2024-11-09 17:40:45 +01:00
Niels Dossche
4e21e80400
Merge branch 'PHP-8.4'
* PHP-8.4:
  [ci skip] Add credit for test
2024-11-09 17:10:07 +01:00
Niels Dossche
896eb80d07
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [ci skip] Add credit for test
2024-11-09 17:09:59 +01:00
Niels Dossche
37d53d5a04
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16695: phar:// tar parser and zero-length file header blocks
2024-11-09 17:08:55 +01:00
Niels Dossche
c6d7d07a1d
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16695: phar:// tar parser and zero-length file header blocks
2024-11-09 17:08:49 +01:00
Niels Dossche
89e750a201
Fix macOS CI
Install curl via brew.

Closes GH-16735.

Co-authored-by: "Christoph M. Becker" <cmbecker69@gmx.de>
2024-11-09 15:34:37 +01:00
DanielEScherzer
54003aecc4
Fix description of ReflectionParameter::getPosition() (GH-16738)
Appears to have been copied from `ReflectionParameter::isOptional()`.

[skip ci]
2024-11-09 15:32:53 +01:00
Christoph M. Becker
07d4c541cb
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fail early in *nix build script
2024-11-09 14:10:15 +01:00
Hans Krentel (hakre)
329890c149
Fail early in *nix build script
Adding one more [1] exit early safeguard in *nix build scripts:

Given the initial cd into the build tree fails (the project root),
   the `buildconf` script exits with non-zero status (failure).

Additionally quoting the pathname to cd into and the empty CD_PATH
parameter for portability, also for systems that are using a
non-portable pathname [2] for the build tree.

[1]: https://github.com/php/php-src/pull/16717
[2]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_271

Closes GH-16724.
2024-11-09 14:09:58 +01:00
Christoph M. Becker
f603d9c703
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fail early in *nix configuration build script
2024-11-09 14:07:12 +01:00
Christoph M. Becker
257387b9e5
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fail early in *nix configuration build script
2024-11-09 14:06:35 +01:00
Christoph M. Becker
9ebbe1e3f3
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16723: CURLMOPT_PUSHFUNCTION issues
2024-11-09 12:44:16 +01:00
Christoph M. Becker
3a1a205f2a
Fix GH-16723: CURLMOPT_PUSHFUNCTION issues
We copy the source handler's FCCs to those of the destination.

We also fix the erroneous test assumption that the trampoline wouldn't
be called.

Closes GH-16732.
2024-11-09 12:43:29 +01:00
Niels Dossche
cc54e66ad8
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix wrong merge
2024-11-09 11:49:25 +01:00
Niels Dossche
ef1e1868ed
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix wrong merge
2024-11-09 11:49:16 +01:00
Niels Dossche
56bd057123
[ci skip] NEWS for ReflectionConstant additions 2024-11-09 11:09:36 +01:00
DanielEScherzer
10f1f924cf
Add ReflectionConstant::getExtension() and ::getExtensionName() (#16603) 2024-11-09 11:08:02 +01:00
Niels Dossche
f8f9ac8206
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix memory leak in php_openssl_pkey_from_zval()
  Fix various memory leaks related to openssl exports
  Prevent unexpected array entry conversion when reading key
2024-11-09 11:01:36 +01:00
Niels Dossche
fd68e9ba2c
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix memory leak in php_openssl_pkey_from_zval()
  Fix various memory leaks related to openssl exports
  Prevent unexpected array entry conversion when reading key
2024-11-09 11:01:29 +01:00
Niels Dossche
a3b27c083f
Add Dom\Element::insertAdjacentHTML() (#16614) 2024-11-09 10:52:06 +01:00
Niels Dossche
963511bffa
Merge branch 'PHP-8.4'
* PHP-8.4:
  ext/soap: fix `make check` being invoked in `ext/soap`
2024-11-08 20:48:21 +01:00
Niels Dossche
a85a5ef339
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  ext/soap: fix `make check` being invoked in `ext/soap`
2024-11-08 20:48:06 +01:00
Christoph M. Becker
e5654b75ac
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Fix typo in test name
2024-11-08 20:10:31 +01:00
Christoph M. Becker
6e6373ab89
[skip ci] Fix typo in test name 2024-11-08 20:10:14 +01:00
Christoph M. Becker
f3203f3409
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Fix array_any() and array_all() descriptions
2024-11-08 20:02:32 +01:00
FraOre
7bbf2eae8c
[skip ci] Fix array_any() and array_all() descriptions
Closes GH-16731.
2024-11-08 20:02:14 +01:00
Jakub Zelenka
efcd72029c
Merge branch 'PHP-8.4' 2024-11-08 17:04:18 +01:00
Jakub Zelenka
27b4df4247 Fix 8.4 NEWS file 2024-11-08 17:01:02 +01:00
Jakub Zelenka
84400eefbb
Merge branch 'PHP-8.4' 2024-11-08 16:51:19 +01:00
Jakub Zelenka
49bc011c9f
Merge branch 'PHP-8.3' into PHP-8.4 2024-11-08 16:50:41 +01:00
Ilija Tovilo
3b609ab0e4
[skip ci] Fix asan ubuntu image condition in nightly
This was meant only for master. 8.4 should still use 22.04.
2024-11-08 13:56:56 +01:00
David Carlier
9216436186
Merge branch 'PHP-8.4' 2024-11-08 12:28:44 +00:00
David Carlier
5252e8b511
Merge branch 'PHP-8.3' into PHP-8.4 2024-11-08 12:27:35 +00:00
Gina Peter Banyard
f3b150a6a6 ext/standard: Move array_walk(_recursive)() tests into subfolder 2024-11-08 07:04:00 +00:00
Gina Peter Banyard
f011684206 ext/standard: Split sort tests that contain escape sequences 2024-11-08 07:04:00 +00:00
Gina Peter Banyard
d8a63a38c6 ext/standard: Move sort() related tests into subfolder 2024-11-08 07:04:00 +00:00
Christoph M. Becker
c1bf3acf44
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix rename_variation12*.phpt parallel test conflicts
2024-11-08 00:26:52 +01:00
Christoph M. Becker
e68970d455
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix rename_variation12*.phpt parallel test conflicts
2024-11-08 00:26:19 +01:00
David Carlier
600da8cffc
Merge branch 'PHP-8.4' 2024-11-07 22:53:08 +00:00
David Carlier
7477c1b4ab
Merge branch 'PHP-8.3' into PHP-8.4 2024-11-07 22:52:57 +00:00
Ilija Tovilo
93c9c7c5c1
[skip ci] Update to ubuntu 24.04 for asan in nightly 2024-11-07 22:05:54 +01:00
Ilija Tovilo
fb257ee83c
Upgrade master to Ubuntu 24.04 (GH-16704) 2024-11-07 16:32:45 +01:00
Arnaud Le Blanc
40997c2c62
[ci skip] NEWS for GH-16702 2024-11-07 15:56:45 +01:00
Michael Orlitzky
4dc0b40f42 ext/standard/crypt.c: handle musl failure tokens
Musl's crypt() returns "*" to indicate failure in contrast with the
"*0" returned by PHP/libxcrypt. This causes test failures, but more
importantly, is a pretty silly thing to expect the user to know.
This commit catches the musl value and turns it into "*0".
2024-11-07 15:54:50 +01:00
Michael Orlitzky
f5d2e7b779 ext/standard/tests/crypt/des_fallback_invalid_salt.phpt: less valid salt
Musl's crypt() implementation of DES tries to handle invalid salts and
can make this test fail because it returns an answer and not an
error. Even musl however will reject a salt with a ':' in it, so we
can make this test cross-platform by supplying an even less valid
salt.
2024-11-07 15:54:50 +01:00
Michael Orlitzky
8a712003aa ext/standard/tests/strings/crypt_sha256.phpt: fix on musl
Among other things, this test tries to run too few and too many rounds
of SHA256. In both cases, it is expecting an error, but that behavior
depends on the implementation:

  * PHP's own implementation raises an error in either case
  * libxcrypt raises an error in either case
  * Older versions of glibc would clamp the number of rounds
    to a valid amount (newer versions don't have libcrypt)
  * Musl libc clamps values that are too low, but raises an error
    for values that are too high

If PHP is built with --with-external-libcrypt, the musl implementation
above can be used. Even if libxcrypt is installed, PHP will notice
that no additional -lfoo flags are needed to use the crypt
implementation in musl. To pass on such a system, we must not test
for the "too few rounds" behavior.
2024-11-07 15:54:50 +01:00
Ilija Tovilo
452c5ac989
Fix incorrect filename of dl()'d internal consts (#16721)
We should only attempt to fetch the current filename for user constants. dl()
may attempt to register internal constants after execution has already started,
thus incorrectly linking the user file invoking dl().

See GH-16663
2024-11-07 14:53:12 +01:00
Christoph M. Becker
5c76ef78cb
Fix GH-10992: Improper long path support for relative paths
Relative paths are passed to the ioutils APIs, these are not properly
converted to long paths.  If the path length already exceeds a given
threshold (usually 259 characters, but only 247 for `mkdir()`), the
long path prefix is prepended, resulting in an invalid path, since long
paths have to be absolute.  If the path length does not exceed that
threshold, no conversion to a long path is done, although that may be
necessary.

Thus we take the path length of the current working directory into
account when checking the threshold, and prepend it to the filename if
necessary.

Since this is only relevant for NTS builds, and using the current
working directory of the process would be erroneous for ZTS builds, we
skip the new code for ZTS builds.

Closes GH-16687.
2024-11-07 13:34:41 +01:00
Christoph M. Becker
59fe79fb45
Merge branch 'PHP-8.4'
* PHP-8.4:
  Skip tests if ldap_set_rebind_proc() is not available
2024-11-07 13:24:33 +01:00
Christoph M. Becker
6b754d9e81
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Skip tests if ldap_set_rebind_proc() is not available
2024-11-07 13:24:00 +01:00
Niels Dossche
96d1cd00b7
Fix GH-16665: \array and \callable should not be usable
This list was initially introduced in 53a40386, but never included array or
callable. I suppose this is because int & friends are not actual tokens,
while array and callable are. This means it was never possible to do class
array, which is probably the reason this was overlooked.

Closes GH-16683.
2024-11-06 18:16:06 +01:00
Niels Dossche
bc4fa01de7
Get rid of reserved name usage in ext/libxml (#16707)
Names starting with an _ are reserved in C.
2024-11-06 17:47:48 +01:00
Niels Dossche
6366da48ec
Use unsigned int for the reference count APIs in ext/libxml (#16706)
Also removes impossible conditions.
2024-11-06 17:47:35 +01:00
David Carlier
3942972bef
Merge branch 'PHP-8.4' 2024-11-06 12:53:40 +00:00
David Carlier
a0c7550886
Merge branch 'PHP-8.3' into PHP-8.4 2024-11-06 12:53:07 +00:00
Saki Takamachi
91eda57680
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fixed the test because libmysql results type is string. (#16709)
2024-11-06 21:07:22 +09:00
Saki Takamachi
5faef8e6c9
Fixed the test because libmysql results type is string. (#16709)
closes #16709
2024-11-06 21:07:03 +09:00
Saki Takamachi
74218530b6
Merge branch 'PHP-8.4'
* PHP-8.4:
  Added gc_handler to properly handle circular references. (#16703)
2024-11-06 20:32:53 +09:00
Saki Takamachi
a800a03562
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Added gc_handler to properly handle circular references. (#16703)
2024-11-06 20:32:33 +09:00
Niels Dossche
228c27112a
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix test with shared zend_test (#16705)
2024-11-05 21:36:54 +01:00
Niels Dossche
2f5021b6bd
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix test with shared zend_test (#16705)
2024-11-05 21:36:48 +01:00
Pierrick Charron
24a4cb2f0e
Merge branch 'PHP-8.4'
* PHP-8.4:
  PHP-8.2 is now for PHP 8.2.27-dev
2024-11-05 12:50:58 -05:00
Pierrick Charron
815a4a8878
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  PHP-8.2 is now for PHP 8.2.27-dev
  PHP-8.3 is now for PHP-8.3.15-dev
2024-11-05 12:49:49 -05:00
Ilija Tovilo
06b99c059e
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix compiler warning in zend_test
2024-11-05 16:52:00 +01:00
Arnaud Le Blanc
8d30ed4f80
Fix compiler warning in zend_test
Closes GH-16650
2024-11-05 16:51:43 +01:00
Eric Mann
f2602f3200
Merge branch 'PHP-8.3' 2024-11-05 07:01:41 -08:00
Dmitry Stogov
e3756c64d2
Merge branch 'PHP-8.4'
* PHP-8.4:
  Update IR
  [ci skip] Update NEWS for PHP 8.4.0RC4
2024-11-05 17:53:54 +03:00
Dmitry Stogov
56381e8f1d
Update IR
IR commit: 23c188cff0594d3af23517537e74e9e3b9b7f120
2024-11-05 17:52:37 +03:00
Calvin Buckley
a94ead4be0
[ci skip] Update NEWS for PHP 8.4.0RC4 2024-11-05 10:41:29 -04:00
Máté Kocsis
a47d823405
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16314 "Pdo\Mysql object is uninitialized" when opening a persistent connection (#16369)
2024-11-05 08:33:11 +01:00
Máté Kocsis
a5f137821a
Fix GH-16314 "Pdo\Mysql object is uninitialized" when opening a persistent connection (#16369) 2024-11-05 08:32:44 +01:00
Saki Takamachi
f464298c8e
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fixed a bug where size_t underflows (#16696)
  Added early return case when result is 0 (#16697)
2024-11-05 08:43:58 +09:00
Saki Takamachi
fd1dff988e
Fixed a bug where size_t underflows (#16696)
fixes #16262
closes #16696
2024-11-05 08:41:09 +09:00
Saki Takamachi
2fe7719a44
Added early return case when result is 0 (#16697)
fixes #16265
closes #16697
2024-11-05 08:38:38 +09:00
Niels Dossche
173bdb2c06
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16590: UAF in session_encode()
  Fix various memory leaks on error conditions in openssl_x509_parse()
2024-11-04 20:05:42 +01:00
Niels Dossche
cc39bc21e3
Fix GH-16590: UAF in session_encode()
The `PS_ENCODE_LOOP` does not protect the session hash table that it
iterates over. Change it by temporarily creating a copy.

Closes GH-16640.
2024-11-04 20:05:32 +01:00
Niels Dossche
faef0dfb49
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix various memory leaks on error conditions in openssl_x509_parse()
2024-11-04 20:04:51 +01:00
Ilija Tovilo
0ce151b8fe
Merge branch 'PHP-8.4'
* PHP-8.4:
  Add NEWS entry
  Also fix same issue in ArrayObject::exchangeArray()
  Fix use-after-free in ArrayObject::unset() with destructor
2024-11-04 17:50:37 +01:00
Ilija Tovilo
66ad4ce699
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Add NEWS entry
  Also fix same issue in ArrayObject::exchangeArray()
  Fix use-after-free in ArrayObject::unset() with destructor
2024-11-04 17:49:08 +01:00
Ilija Tovilo
0ad6e4efb0
[skip ci] Document --repeat flag as internal (GH-16698)
Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>
2024-11-04 17:40:08 +01:00
Ilija Tovilo
dbcdd4e4a7
Merge branch 'PHP-8.4'
* PHP-8.4:
  Postpone zend_array_sort() in ext-intl
  Use bool for zend_array_sort()
2024-11-04 16:02:47 +01:00
Ilija Tovilo
085c151481
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Postpone zend_array_sort() in ext-intl
  Use bool for zend_array_sort()
2024-11-04 16:02:31 +01:00
Ilija Tovilo
ecb87ca5f1
Mark new zend_array_sort_ex() as ZEND_API 2024-11-04 15:53:51 +01:00
Ilija Tovilo
d82fa6adf6
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix array going away during sorting
2024-11-04 15:53:03 +01:00
Ilija Tovilo
230defc198
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix array going away during sorting
2024-11-04 15:51:24 +01:00
Ilija Tovilo
fa15ac542e
[skip ci] Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Fix nightly workflow dispatch
2024-11-04 15:04:25 +01:00
Ilija Tovilo
ea39a89a74
[skip ci] Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [skip ci] Fix nightly workflow dispatch
2024-11-04 15:04:14 +01:00
David Carlier
f37fd7fa1a
Merge branch 'PHP-8.4' 2024-11-03 13:40:34 +00:00
David Carlier
f5b0a9ad19
Merge branch 'PHP-8.3' into PHP-8.4 2024-11-03 13:40:25 +00:00
Niels Dossche
64f2d11e38
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16628: FPM logs are getting corrupted with this log statement
  Fix GH-16601: Memory leak in Reflection constructors
2024-11-02 19:39:00 +01:00
Niels Dossche
bfd9e0cca3
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16628: FPM logs are getting corrupted with this log statement
  Fix GH-16601: Memory leak in Reflection constructors
2024-11-02 19:38:54 +01:00
Gina Peter Banyard
5d7fe139b5
Merge branch 'PHP-8.4'
* PHP-8.4:
  ext/gmp: Fix segfault when null is encountered on an overloaded operator
  ext/gmp: Add behavioural tests for operator overloading
2024-11-02 17:41:46 +00:00
Gina Peter Banyard
9e2367f29f
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  ext/gmp: Fix segfault when null is encountered on an overloaded operator
  ext/gmp: Add behavioural tests for operator overloading
2024-11-02 17:41:27 +00:00
Christoph M. Becker
9afc66fb51
Fix ICU version specific skip reasons of intl tests (GH-16661)
* Some tests have this backwards, probably reading "skip for ICU …".
  However, that is not how skip reasons are handled.
* Some test seems to have typos in the skip reason version.
* Some tests checked for a certain version, but reported the
  *presumably* next version, which is confusing at best.
* Some tests checked versions in descending order, what is not wrong,
  but confusing.
* Some tests had off by one errors.

For all tests, we assume that the skipif conditions are correct, and
fix the reasons.
2024-11-02 15:48:43 +01:00
David Carlier
ca5fd05536
ext/posix: adding POSIX_SC_OPEN_MAX constant.
returns the number of file descriptors that a process can handle.
e.g. useful after pcntl_fork() to close all the file descriptors up
to that boundary.

close GH-16681
2024-11-02 14:28:07 +00:00
Markus Staab
cf5ded9cc5
run-tests: removed unused code (#16675) 2024-11-02 11:39:40 +01:00
Markus Staab
cda67fb544
run-tests: drop hrtime() polyfill (#16677) 2024-11-02 10:27:47 +01:00
Markus Staab
836bd22257
run-tests.php: fix wrong comment
[ci skip]

Closes GH-16666.
2024-11-02 10:24:16 +01:00
Christoph M. Becker
2b10cd1beb
Deprecate mhash constants
The mhash functions already have been deprecated as of PHP 8.1.0[1],
but the respective constants appear to have been missed.  We catch up
on that.

[1] <https://wiki.php.net/rfc/deprecations_php_8_1#mhash_function_family>

Closes GH-16569.
2024-11-02 01:07:03 +01:00
Christoph M. Becker
7c37c25ef2
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-14732: date_sun_info() fails for non-finite values
2024-11-01 23:51:06 +01:00
Christoph M. Becker
68d3000902
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-14732: date_sun_info() fails for non-finite values
2024-11-01 23:50:40 +01:00
Christoph M. Becker
dd5c8f7737
Merge branch 'PHP-8.4'
* PHP-8.4:
  Adapt ext/intl tests for ICU 76.1
2024-11-01 22:22:03 +01:00
Christoph M. Becker
3245a65034
Adapt ext/intl tests for ICU 76.1
Regarding the test names, see PR #9800.

Closes GH-16660.
2024-11-01 22:21:23 +01:00
Christoph M. Becker
c0136f0cb9
Avoid dl() in bug77578.phpt (GH-16663)
Avoid dl() in bug77578.phpt

`dl()` has known issues regarding permanent strings[1], so we better
avoid it, even if that means that we need to spawn two sub-processes.

[1] <https://github.com/php/php-src/issues/9196>
2024-11-01 22:13:02 +01:00
Niels Dossche
aafcf997f9
Use spl_RecursiveIteratorIterator_free_iterators() 2024-11-01 20:46:29 +01:00
Niels Dossche
2b17168ac1
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16604: Memory leaks in SPL constructors
2024-11-01 20:43:49 +01:00
Niels Dossche
7a78ffcbb2
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16604: Memory leaks in SPL constructors
2024-11-01 20:43:43 +01:00
Christoph M. Becker
063de1fbdf
Merge branch 'PHP-8.4'
* PHP-8.4:
  Properly initialize _override executor globals
2024-10-31 23:41:28 +01:00
Christoph M. Becker
1fa8187c7b
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Properly initialize _override executor globals
2024-10-31 23:40:48 +01:00
Daniel Scherzer
f5e743a520
Add ReflectionConstant::getFileName()
Allow determining the name of the file that defined a constant, when the
constant was defined in userland code via const or define(). For constants
defined by PHP core or extensions, false is returned, matching the existing
getFileName() methods on other reflection classes.

Fixes GH-15723
Closes GH-15847
2024-10-31 16:47:45 +01:00
Christoph M. Becker
94ac1cd1df
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16450: PDO_ODBC can inject garbage into field values
2024-10-31 16:18:25 +01:00
Christoph M. Becker
331bd9571a
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16450: PDO_ODBC can inject garbage into field values
2024-10-31 16:17:50 +01:00
Arnaud Le Blanc
50a3f019dc
Merge branch 'PHP-8.4'
* PHP-8.4:
  Add ReflectionProperty::isLazy()
2024-10-31 14:15:49 +01:00
Arnaud Le Blanc
54a40f3bde
Add ReflectionProperty::isLazy()
Closes GH-16342
2024-10-31 14:14:20 +01:00
Ilija Tovilo
ee19427a86
[skip ci] Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Properly disable -Werror for libmysqlclient + mysqli
  [skip ci] Revert "Remove -Werror for libmysql test on 8.1 only"
2024-10-31 13:48:13 +01:00
Ilija Tovilo
c9a30c9cc3
[skip ci] Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [skip ci] Properly disable -Werror for libmysqlclient + mysqli
  [skip ci] Revert "Remove -Werror for libmysql test on 8.1 only"
2024-10-31 13:47:55 +01:00
Ilija Tovilo
9577734278
[skip ci] Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Fix nightly job name for 8.1
2024-10-31 13:38:58 +01:00
Ilija Tovilo
a15ba083f6
[skip ci] Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [skip ci] Fix nightly job name for 8.1
2024-10-31 13:38:44 +01:00
Niels Dossche
1a5ef4bb3f
Merge branch 'PHP-8.4'
* PHP-8.4:
  Add missing cache invalidation for innerHTML (#16652)
2024-10-30 22:15:39 +01:00
Niels Dossche
d5e6dd8f2b
Add missing cache invalidation for innerHTML (#16652)
* Add test with wrong output

* Add missing cache invalidation for innerHTML
2024-10-30 22:14:20 +01:00
Niels Dossche
df2436d359
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix static analysis warning
2024-10-30 20:56:16 +01:00
Niels Dossche
65fbf47472
Fix static analysis warning
The condition is already checked at the start of the function, mark this
code properly as unreachable.
2024-10-30 20:55:50 +01:00
Ilija Tovilo
e122152373
Simplify (bitset & flag) == flag conditions
Closes GH-16558
2024-10-30 17:27:52 +01:00
Ilija Tovilo
e00079daa1
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Move nightly to workflow_call
2024-10-30 16:54:39 +01:00
Ilija Tovilo
1b6320b0f5
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [skip ci] Move nightly to workflow_call
2024-10-30 16:54:27 +01:00
Dmitry Stogov
f4f6c13841
Update trace type inference and abstract stack to be consistent with #16339 (JIT support for ASSIGN_DIM[_OP] with IS_VAR op1) (#16651) 2024-10-30 17:00:16 +03:00
Ilija Tovilo
3c3a1df730
Merge branch 'PHP-8.4'
* PHP-8.4:
  Remove -Werror for libmysql test on 8.1 only
2024-10-30 14:48:39 +01:00
Ilija Tovilo
c13d6df2fb
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Remove -Werror for libmysql test on 8.1 only
2024-10-30 14:48:17 +01:00
Ilija Tovilo
bf5496149b
Merge branch 'PHP-8.4'
* PHP-8.4:
  Partial backport of e7462bf
2024-10-30 14:24:26 +01:00
Ilija Tovilo
b60a4ebba9
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Partial backport of e7462bf
2024-10-30 14:24:08 +01:00
Ilija Tovilo
584120003a
Merge branch 'PHP-8.4'
* PHP-8.4:
  [CI] Backport usage of db service for 8.1
2024-10-30 12:22:50 +01:00
Ilija Tovilo
eba4ce7791
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [CI] Backport usage of db service for 8.1
2024-10-30 12:22:34 +01:00
Arnaud Le Blanc
43de8ff19f
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix assertion failure in zend_std_read_property
2024-10-30 12:02:59 +01:00
Arnaud Le Blanc
3d3b22ddf2
Fix assertion failure in zend_std_read_property
We asserted that Z_PROP_FLAG_P(retval) was exactly IS_PROP_UNINIT, but this is a
bit field and it may contain irrelevant bits. For instance it may contain
IS_PROP_REINITABLE during clone, or IS_PROP_LAZY if the object is lazy.

Fixes GH-16615
Closes GH-16639
2024-10-30 12:02:52 +01:00
Ilija Tovilo
b564ccd504
Merge branch 'PHP-8.4'
* PHP-8.4:
  Backport nightly.yml and nightly_matrix.php to PHP-8.1
2024-10-29 15:34:26 +01:00
Ilija Tovilo
ef56241483
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Backport nightly.yml and nightly_matrix.php to PHP-8.1
2024-10-29 15:34:18 +01:00
David Carlier
cb6212b073
Merge branch 'PHP-8.4' 2024-10-28 21:25:49 +00:00
David Carlier
6a0035b7f4
Merge branch 'PHP-8.3' into PHP-8.4 2024-10-28 21:25:39 +00:00
Niels Dossche
99cdd670af
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16595: Another UAF in DOM -> cloneNode
  Fix GH-16593: Assertion failure in DOM->replaceChild
2024-10-28 19:45:27 +01:00
Niels Dossche
6e82ae9990
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16595: Another UAF in DOM -> cloneNode
  Fix GH-16593: Assertion failure in DOM->replaceChild
2024-10-28 19:45:22 +01:00
Niels Dossche
91270aafa5
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16594: Assertion failure in DOM -> before
  Fix GH-16572: Incorrect result with reflection in low-trigger JIT
  Fix GH-16577: EG(strtod_state).freelist leaks with opcache.preload
2024-10-28 19:33:24 +01:00
Niels Dossche
947e319b76
Fix GH-16594: Assertion failure in DOM -> before
The invalid parent condition can actually happen because PHP's DOM is
allows to get children of e.g. attributes; something normally not
possible.

Closes GH-16597.
2024-10-28 19:32:20 +01:00
Niels Dossche
38e1b0ac8c
Fix GH-16572: Incorrect result with reflection in low-trigger JIT
When a recursive call happens with invalid arguments, the maximum valid
arguments are computed and stored in `num_args`, but the RECV entry
block we jump to is `call_num_args` instead. This can skip argument
validation checks. Fix this by using `num_args` instead.

Closes GH-16575.
2024-10-28 19:31:52 +01:00
Niels Dossche
757781a142
Fix GH-16577: EG(strtod_state).freelist leaks with opcache.preload
This happens because on ZTS we execute `executor_globals_ctor` which reset the
`freelist` and `p5s` pointers, while on NTS we don't.
On NTS we can reuse the caches but on ZTS we can't, the easiest fix is
to call `zend_shutdown_strtod` when preloading is shut down.
This regressed in GH-13974 and therefore only exists in PHP 8.4 and
higher.

Closes GH-16602.
2024-10-28 19:30:52 +01:00
Ilija Tovilo
562677a6dc
[skip ci] Run all branches in nightly on Monday (GH-16625)
See GH-16286. The objective is to identify failed builds in security branches
semi-early. Previously, they would only be run when a fix was backported, which
would almost always result in a red build.
2024-10-28 17:18:05 +01:00
Ilija Tovilo
fc1582d2b7
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Remove duplicate icu dep on 8.4+
2024-10-28 16:48:40 +01:00
Ilija Tovilo
d6839f77ee
[skip ci] Remove duplicate icu dep on 8.4+
I see those were already added there
2024-10-28 16:47:53 +01:00
Ilija Tovilo
33483f9f21
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix icu dependency for macos build
2024-10-28 16:41:31 +01:00
Ilija Tovilo
21165a83ca
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix icu dependency for macos build
2024-10-28 16:41:25 +01:00
Ilija Tovilo
0b4aed09d5
Merge branch 'PHP-8.4'
* PHP-8.4:
  Backport CI fixes to security branches
2024-10-28 16:08:07 +01:00
Ilija Tovilo
fbddf0d6f9
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Backport CI fixes to security branches
2024-10-28 16:06:08 +01:00
DanielEScherzer
aeb2d5cfa6
ext/[ef]*: fix a bunch of typos (GH-16621) 2024-10-28 11:28:32 +01:00
Gina Peter Banyard
e8a1781c52 ext/standard: Transform tentative return types into proper types for Directory class
This class is now final
2024-10-27 22:41:27 +00:00
Gina Peter Banyard
0640fbab60 ext/standard/dir.c: Directory class should behave like other resource objects 2024-10-27 22:41:27 +00:00
Gina Peter Banyard
76f6592d12 ext/standard: Add tests for Directory class 2024-10-27 22:41:27 +00:00
Niels Dossche
6bf5bde107
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16589: UAF in SplDoublyLinked->serialize()
2024-10-27 19:12:21 +01:00
Niels Dossche
396b995d76
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16589: UAF in SplDoublyLinked->serialize()
2024-10-27 19:12:16 +01:00
Christoph M. Becker
836a162089
Don't fiddle with NDEBUG in C code (GH-16511)
* Don't fiddle with NDEBUG in C code

It is way to late to do this in php.h, since assert.h has already been
included.  Even pushing that down to zend_portability.h may not have
the desired effect.  Instead we define or undefine NDEBUG as CFLAG, so
that it works in all circumstances.

As a last resort we fail at build time, if `NDEBUG` is defined when
`ZEND_DEBUG` is enabled.

We also remove the useless workaround in zend_test to include assert.h
again, since that usually won't have any effect anyway.

Co-authored-by: Arnaud Le Blanc <arnaud.lb@gmail.com>
2024-10-27 18:20:59 +01:00
Christoph M. Becker
361fb400ef
Merge branch 'PHP-8.4'
* PHP-8.4:
  Adapt ext/intl tests for ICU 75.1
2024-10-27 18:17:45 +01:00
Christoph M. Becker
e111bf72d7
Adapt ext/intl tests for ICU 75.1
Closes GH-16616.
2024-10-27 18:17:08 +01:00
Niels Dossche
d8d388eb3a
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16591: Assertion error in shm_put_var
2024-10-26 15:08:22 +02:00
Niels Dossche
dd84953cda
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16591: Assertion error in shm_put_var
2024-10-26 15:08:17 +02:00
DanielEScherzer
f4e203103d
ext/reflection: use ZEND_PARSE_PARAMETERS_NONE(); macro (#16605) 2024-10-26 10:57:43 +02:00
Gina Peter Banyard
bfca4c7ba9
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16477 (Segmentation fault when calling __debugInfo() after failed SplFileObject::__constructor)
  Fix GH-16477 (Segmentation fault when calling __debugInfo() after failed SplFileObject::__constructor)
  Fix GH-16477 (Segmentation fault when calling __debugInfo() after failed SplFileObject::__constructor)
2024-10-25 22:06:12 +01:00
Gina Peter Banyard
7854248638
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16477 (Segmentation fault when calling __debugInfo() after failed SplFileObject::__constructor)
  Fix GH-16477 (Segmentation fault when calling __debugInfo() after failed SplFileObject::__constructor)
2024-10-25 22:05:50 +01:00
Gina Peter Banyard
5d993e9641
Fix GH-16477 (Segmentation fault when calling __debugInfo() after failed SplFileObject::__constructor)
Closes GH-16480
Closes GH-16604
2024-10-25 22:05:10 +01:00
Niels Dossche
1740d94626
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16588: UAF in Observer->serialize
2024-10-25 23:00:52 +02:00
Niels Dossche
3599fd0c51
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16588: UAF in Observer->serialize
2024-10-25 23:00:46 +02:00
DanielEScherzer
922bd2fe52
ext/readline: update return typehints from bool to true (#16545)
These always return true
2024-10-25 17:35:48 +01:00
Niels Dossche
0b3684c48e
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16574: Incorrect error "undefined method" messages
2024-10-25 18:33:36 +02:00
Niels Dossche
e9283c0819
Fix GH-16574: Incorrect error "undefined method" messages
The `get_method` object handler may change the object pointer. SPL does
this in its iterator implementations. This causes the error message
to change to another class which is confusing to the user. JIT handles
this correctly. This patch aligns behaviour with JIT.

Closes GH-16576.
2024-10-25 18:33:24 +02:00
Christoph M. Becker
91e6f2621c
Add sanitity checks regarding num_args and arg_info (GH-16538)
`num_args > 0` implies that `arg_info != NULL`.  We explicitly assert
that during compilation and execution to make it easier for developers
to not miss this[1].

[1] <https://github.com/php/php-src/issues/16266>
2024-10-25 15:52:53 +02:00
David Carlier
c40e6be82b
Merge branch 'PHP-8.4' 2024-10-25 14:06:02 +01:00
David Carlier
9ee204f2e3
Merge branch 'PHP-8.3' into PHP-8.4 2024-10-25 14:05:16 +01:00
Bob Weinand
1e08c15512 Merge branch 'PHP-8.4' 2024-10-25 01:31:15 +02:00
Bob Weinand
824c81602b Fix test without extra curl features
The empty line would otherwise be required in the test and make it fail.
2024-10-25 01:30:21 +02:00
Niels Dossche
a3bcbb5c8a
Merge branch 'PHP-8.4'
* PHP-8.4:
  [ci skip] Fix NEWS formatting
2024-10-24 23:02:43 +02:00
Niels Dossche
1e7eba0b30
[ci skip] Fix NEWS formatting 2024-10-24 23:02:37 +02:00
Tianfeng.Han
4a4371d31c
Modify zend_max_execution_timer.h to export the symbols with C format (#16550) 2024-10-24 16:01:31 +02:00
Arnaud Le Blanc
c5a5707450
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix tests: Prevent stack overflow during dtor
2024-10-24 15:58:23 +02:00
Arnaud Le Blanc
4c212b305f
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix tests: Prevent stack overflow during dtor
2024-10-24 15:58:12 +02:00
Niels Dossche
551a9ef5e6
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16559: UBSan abort in ext/gd/libgd/gd_interpolation.c:1007
2024-10-23 20:10:10 +02:00
Niels Dossche
d7e7e2b338
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16559: UBSan abort in ext/gd/libgd/gd_interpolation.c:1007
2024-10-23 20:10:04 +02:00
Ilija Tovilo
5fc238f675
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Add unused asan param to configure-x64 action
2024-10-23 19:16:35 +02:00
Ilija Tovilo
80d2cf71ff
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [skip ci] Add unused asan param to configure-x64 action
2024-10-23 19:16:26 +02:00
DanielEScherzer
0b94cf65e4
GH-16067: prevent invalid abstract during compilation of methods (GH-16069)
For classes that are not declared `abstract`, produce a compiler error for any
`abstract` methods. For anonymous classes, since they cannot be made abstract,
the error message is slightly different.

Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com>
2024-10-23 15:04:18 +02:00
Christoph M. Becker
e64e531e3d
Merge branch 'PHP-8.4'
* PHP-8.4:
  Dynamically xfail test case which fails on CI
2024-10-23 13:58:23 +02:00
Christoph M. Becker
7cc327fd5a
Dynamically xfail test case which fails on CI
This is a stop-gap measure for GH-15709 to keep CI green.

Sorry, xfailed the wrong test case previously.
2024-10-23 13:58:07 +02:00
Christoph M. Becker
cfcf39f0e7
Merge branch 'PHP-8.4'
* PHP-8.4:
  Dynamically xfail test case which fails on CI
2024-10-23 13:11:57 +02:00
Christoph M. Becker
bdde797159
Dynamically xfail test case which fails on CI
This is a stop-gap measure for GH-15709 to keep CI green.
2024-10-23 13:11:12 +02:00
Máté Kocsis
55e8ebe29b
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16131: Prevent mixing PDO sub-classes with different DSN
2024-10-22 22:54:08 +02:00
Máté Kocsis
5892991941
Fix GH-16131: Prevent mixing PDO sub-classes with different DSN 2024-10-22 22:51:29 +02:00
Ilija Tovilo
96f83f7ca3
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix gh16508.phpt test expectation
2024-10-22 22:07:43 +02:00
Ilija Tovilo
dded6fdcad
Fix gh16508.phpt test expectation
The error changed in master, not 8.4. My bad.
2024-10-22 22:07:03 +02:00
Niels Dossche
207883e72b
Merge branch 'PHP-8.4'
* PHP-8.4:
  [ci skip] Update EXTENSIONS and CODEOWNERS for ext/soap (#16542)
  [ci skip] Update NEWS for PHP 8.4.0RC4
2024-10-22 20:15:08 +02:00
Niels Dossche
18a925b3db
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [ci skip] Update EXTENSIONS and CODEOWNERS for ext/soap (#16542)
2024-10-22 20:14:57 +02:00
Saki Takamachi
bb6cf5e920
[ci skip] Update NEWS for PHP 8.4.0RC4 2024-10-23 01:29:46 +09:00
Gina Peter Banyard
32789c0047
[skip ci] gen_stub: Use simpara by default instead of para tags for documentation 2024-10-22 15:18:47 +01:00
Ilija Tovilo
e05b56fdb1
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Fix overwritten observer ini setting for gh16514.phpt
2024-10-22 15:21:31 +02:00
Ilija Tovilo
0c297bab21
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [skip ci] Fix overwritten observer ini setting for gh16514.phpt
2024-10-22 15:21:26 +02:00
Ilija Tovilo
a4a1c67b9e
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Fix test expectation of gh16508.phpt for 8.4+
2024-10-22 15:18:55 +02:00
Ilija Tovilo
5a639c5522
[skip ci] Fix test expectation of gh16508.phpt for 8.4+ 2024-10-22 15:18:24 +02:00
Ilija Tovilo
9fa2f116c3
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix lineno for inheritance errors of early bound classes
2024-10-22 15:17:36 +02:00
Ilija Tovilo
077d69db44
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix lineno for inheritance errors of early bound classes
2024-10-22 15:17:29 +02:00
Ilija Tovilo
7862b15679
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix lineno in function redeclaration error
2024-10-22 15:06:12 +02:00
Ilija Tovilo
cd8ee4dad1
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix lineno in function redeclaration error
2024-10-22 15:06:06 +02:00
Ilija Tovilo
178ee5b879
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix handling of nested generator in zend_test observer
2024-10-22 14:52:19 +02:00
Ilija Tovilo
289f59ad48
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix handling of nested generator in zend_test observer
2024-10-22 14:52:07 +02:00
Ilija Tovilo
9018d9aa37
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix propagation of ZEND_ACC_RETURN_REFERENCE for call trampoline
2024-10-22 14:49:33 +02:00
Ilija Tovilo
9a093e753a
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix propagation of ZEND_ACC_RETURN_REFERENCE for call trampoline
2024-10-22 14:49:27 +02:00
Peter Kokot
7f6ad37e5d
Sync exif and mbstring INI settings (#16549)
A follow-up of 9ee9c0e674.

The mbstring extension is added as ZEND_MOD_OPTIONAL dependency at
runtime, so INI directives configuration order here is no longer
relevant and can be done in any way.
2024-10-22 14:07:34 +02:00
Arnaud Le Blanc
96ac2c425f
Merge branch 'PHP-8.4'
* PHP-8.4:
  Lazy objects: Update class constants earlier
2024-10-22 12:20:18 +02:00
Arnaud Le Blanc
64081d1380
Lazy objects: Update class constants earlier
If a lazy object is created for a class whose constants can not be updated, then
we have created an instance of a non-instantiable class. This breaks the
expectations of clone.

Here I ensure that a class has its constants updated before creating a lazy
instance of it.

Fixes OSS-Fuzz #71407
Closes GH-15856
2024-10-22 12:19:31 +02:00
Gina Peter Banyard
8143eca499
ext/standard: Change return value of array_multisort() to true (#16520)
It stopped being able to return false since PHP 8.0 when all warnings and false returns were converted to ValueErrors and TypeErrors
2024-10-22 11:07:42 +01:00
Niels Dossche
935fef29bd
Optimize DOM HTML serialization for UTF-8 (#16376)
* Use a direct call for decoding the UTF-8 buffer

* Add fast path for UTF-8 HTML serialization

This patch adds a fast path to the HTML serialization encoding that has
to encode to UTF-8. Because the DOM internally represents all strings
using UTF-8, we only need to validate here.

Tested on Wikipedia English home page on an i7-4790:
```
Benchmark 1: ./sapi/cli/php x.php
  Time (mean ± σ):     516.0 ms ±   6.4 ms    [User: 511.2 ms, System: 3.5 ms]
  Range (min … max):   506.0 ms … 527.1 ms    10 runs

Benchmark 2: ./sapi/cli/php_old x.php
  Time (mean ± σ):     682.8 ms ±   6.5 ms    [User: 676.8 ms, System: 3.8 ms]
  Range (min … max):   675.8 ms … 695.6 ms    10 runs

Summary
  ./sapi/cli/php x.php ran
    1.32 ± 0.02 times faster than ./sapi/cli/php_old x.php
```

(And if you're interested: it takes over a second on my machine using the old DOMDocument class)

Future optimizations are certainly possible, but let's start here.
2024-10-22 07:18:36 +02:00
Christoph M. Becker
6dd67bbb76
Merge branch 'PHP-8.4'
* PHP-8.4:
  Updates for libxml2 >= 2.13.0
2024-10-22 00:17:44 +02:00
Christoph M. Becker
30dd291628
Updates for libxml2 >= 2.13.0
libxml2 2.13.0 introduced some relevant changes regarding the treatment
of file paths on Windows[1].  Thus we un-xfail bug69753.phpt and its
companion, and we adjust dom004.phpt.  And we also disable the
workaround for erroneous file:/ URIs on Windows.

[1] <8ab1b122c4>

Closes GH-16536.
2024-10-22 00:17:12 +02:00
Christoph M. Becker
4214d78847
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16523: FILTER_FLAG_HOSTNAME accepts ending hyphen
2024-10-21 21:23:00 +02:00
Christoph M. Becker
6715860286
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16523: FILTER_FLAG_HOSTNAME accepts ending hyphen
2024-10-21 21:22:26 +02:00
Niels Dossche
7c6c8e110e
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16535: UAF when using document as a child
  Fix GH-16533: Segfault when adding attribute to parent that is not an element
2024-10-21 20:57:53 +02:00
Niels Dossche
a0266920e4
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16535: UAF when using document as a child
  Fix GH-16533: Segfault when adding attribute to parent that is not an element
2024-10-21 20:57:42 +02:00
Christoph M. Becker
50acf5eb15
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16266: _ZendTestClass::test() segfaults on named parameter
2024-10-21 19:46:34 +02:00
Christoph M. Becker
241e3e0e27
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16266: _ZendTestClass::test() segfaults on named parameter
2024-10-21 19:46:02 +02:00
Christoph M. Becker
65f885738d
Drop useless retrieval of opened_path (GH-16522)
There is no point in retrieving the real path, if we don't use it.
2024-10-21 14:42:43 +02:00
Dmitry Stogov
eef3e5ebca
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16499: [JIT] Undefined to null coercion issues for return
2024-10-21 14:51:52 +03:00
Dmitry Stogov
cfd954f5f9
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16499: [JIT] Undefined to null coercion issues for return
2024-10-21 14:51:41 +03:00
Christoph M. Becker
bd6ddcf21f
Fix leak of accel_shared_globals for file_cache_only (GH-16517)
If `opcache.file_cache_only` is enabled, `accel_shared_globals` is
allocated as true global, and we need to free that memory when we shut
down the accelerator.
2024-10-21 12:37:21 +02:00
Christoph M. Becker
c2459d8cc2
Merge branch 'PHP-8.4'
* PHP-8.4:
  Free internal_runtime_cache on shutdown for NTS
2024-10-21 11:39:20 +02:00
Christoph M. Becker
fd39e230fd
Free internal_runtime_cache on shutdown for NTS
As is, the `internal_runtime_cache` is only free for ZTS builds; we
also free it for NTS builds on shutdown.

Co-authored-by: Bob Weinand <bobwei9@hotmail.com>

Closes GH-16402.
2024-10-21 11:38:52 +02:00
Christoph M. Becker
514c2b3587
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16390: dba_open() can segfault for "pathless" streams
2024-10-21 00:38:54 +02:00
Christoph M. Becker
2c0fd883b2
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16390: dba_open() can segfault for "pathless" streams
2024-10-21 00:38:18 +02:00
David Carlier
c025ce4d66
Merge branch 'PHP-8.4' 2024-10-20 21:44:41 +01:00
David Carlier
bde23d0843
Merge branch 'PHP-8.3' into PHP-8.4 2024-10-20 21:44:04 +01:00
Christoph M. Becker
01aeaf2e95
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16414: zend_test.observer.observe_function_names may segfault
2024-10-20 12:11:42 +02:00
Christoph M. Becker
909cecb7fa
Fix GH-16414: zend_test.observer.observe_function_names may segfault
Unless `zend_test.observer.enabled` is on, we must not add observer
handlers, so we let the INI modify handler fail early.

We also need to ensure that the functions to observe have already been
called, so that their begin and end handlers are properly initialized.
Otherwise we will not observe the function execution, but a segfault.

Co-authored-by: Bob Weinand <bobwei9@hotmail.com>

Closes GH-16438.
2024-10-20 12:11:08 +02:00
Christoph M. Becker
ae717797e5
Fix Windows x86 build for ext/ffi
PR #16351 introduced `EnumProcessModules()` calls, but this function is
undefined; thus, the compiler mangles the name according to the default
calling convention.  This lets linking succeed for x64, but fail for
x86.

To properly fix this, we include <Psapi.h> where the function is
declared.
2024-10-20 11:57:44 +02:00
Christoph M. Becker
d19fdaa4b7
Drop legacy fallback for isc_get_client_version() (GH-16343)
The respective code had been introduced 20 years ago, and we can assume
that the function is available at least of Firebird 3.0, what we
require anyway.
2024-10-19 16:05:46 +02:00
Christoph M. Becker
db991bc0f1
FFI: support symbol lookup without specifying lib on Windows
This works similar to `dlsym(RTLD_DEFAULT, …)` with the caveat that
symbols on Windows may not be unique, and are usually qualified by the
module they are exported from.  That means that wrong symbols may be
fetched, potentially causing serious issues; therefore this usage is
not recommended for production purposes, but is a nice simplification
for quick experiments and the ext/ffi test suite.

Closes GH-16351.
2024-10-19 15:36:49 +02:00
Christoph M. Becker
9504fcfc0f
Move ARG_ENABLE() "macros" out of confutils.js (GH-16398)
While these "macros" work perfectly fine in confutils, it is somewhat
strange to have these two there, while all others are in config.w32
files.

In particular, there is no need for a `MODE_PHPIZE` guard, since there
are already config.w32 and config.w32.phpize.in.

However, we need to replace the semicolon in the helptext, because the
regex which parses ARG_(ENABLE|WITH) calls is restricted, and does not
accept semicolons.
2024-10-19 15:26:53 +02:00
Ilija Tovilo
a00c73458f
[skip ci] Fix test expectation for Windows
No clue why the line reports 0 on Windows...
2024-10-18 23:31:18 +02:00
Daniel Scherzer
cb1d4ba97a
GH-16315: Improve error messages when extending enums
Closes GH-16491
2024-10-18 22:22:54 +02:00
Ilija Tovilo
4704f00fc2
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Mark another phar test as flaky on macOS
2024-10-18 15:25:02 +02:00
Ilija Tovilo
fe310181e4
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [skip ci] Mark another phar test as flaky on macOS
2024-10-18 15:24:55 +02:00
Derick Rethans
b63167f9e6
Merge branch 'PHP-8.4' 2024-10-18 12:38:28 +01:00
Derick Rethans
9923e14d97
Merge branch 'PHP-8.3' into PHP-8.4 2024-10-18 12:38:21 +01:00
Christoph M. Becker
a920afd2d2
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16454: Unhandled INF in date_sunset() with tiny $utcOffset
2024-10-18 13:25:41 +02:00
Christoph M. Becker
66fe549daf
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16454: Unhandled INF in date_sunset() with tiny $utcOffset
2024-10-18 13:25:05 +02:00
Dmitry Stogov
e61e2c1eb8
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix invalid target opline with jit->reuse_ip active (#16457)
2024-10-18 12:52:45 +03:00
Dmitry Stogov
8b5668efef
Fix invalid target opline with jit->reuse_ip active (#16457)
This is an alternative for #16440
2024-10-18 12:48:23 +03:00
Gina Peter Banyard
42e179ef9d ext/soap: Minor refactoring to wsdl_message() 2024-10-17 22:46:34 +01:00
Gina Peter Banyard
d48bc086d3 ext/soap: Reduce scope and use proper names for XML attribute variables 2024-10-17 22:46:34 +01:00
Gina Peter Banyard
617136296c ext/soap: Indentation fix 2024-10-17 22:46:34 +01:00
Gina Peter Banyard
f0a35e2cd2 ext/soap: Check services are not empty via an if guard 2024-10-17 22:46:34 +01:00
Gina Peter Banyard
81132bb2f4 ext/soap: Eliminate some variable shadowing 2024-10-17 22:46:34 +01:00
Gina Peter Banyard
cfe2e1130e ext/soap: Use bool instead of int 2024-10-17 22:46:34 +01:00
Gina Peter Banyard
5e7c876282 ext/soap: Replace memset with 0 initialization 2024-10-17 22:46:34 +01:00
Gina Peter Banyard
e2dee956b8 ext/soap: Reduce scope of variable 2024-10-17 22:46:34 +01:00
Gina Peter Banyard
6ddab74d55
sapi: Fix some variable shadowing (#16485)
sapi_module, mime_type_map, zend_extensions, php_cgi_globals, and phpdbg_globals are true globals which are being shadowed
2024-10-17 22:46:23 +01:00
Niels Dossche
b6f59d2a6b
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16473: dom_import_simplexml stub is wrong
2024-10-17 23:28:59 +02:00
Niels Dossche
55266d420b
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16473: dom_import_simplexml stub is wrong
2024-10-17 23:28:34 +02:00
Niels Dossche
7aeafe4bae
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16406: Assertion failure in ext/phar/phar.c:2808
2024-10-17 21:24:13 +02:00
Niels Dossche
d8e516631f
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16406: Assertion failure in ext/phar/phar.c:2808
2024-10-17 21:24:08 +02:00
Niels Dossche
a73754fece
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix various document ref pointer mismanagements
2024-10-17 21:21:56 +02:00
Niels Dossche
81a2cd4dac
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix various document ref pointer mismanagements
2024-10-17 21:21:49 +02:00
Ilija Tovilo
ee41549263
Merge branch 'PHP-8.4'
* PHP-8.4:
  Revert undoing of partial spl_filesystem_object initialization
2024-10-17 18:44:50 +02:00
Ilija Tovilo
1c542af144
Revert undoing of partial spl_filesystem_object initialization
We're intentionally not initializing spl_filesystem_object.u.dir.entry, as it
will later be initialized, and we don't need to zero the entire buffer anyway.
2024-10-17 18:44:06 +02:00
Ilija Tovilo
76138d6f0f
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix uaf in SplFixedArray::unset()
2024-10-17 18:26:01 +02:00
Ilija Tovilo
c82cea0c34
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix uaf in SplFixedArray::unset()
2024-10-17 18:25:56 +02:00
Ilija Tovilo
9cb0f03808
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix use-after-free in SplObjectStorage::setInfo()
2024-10-17 18:21:57 +02:00
Ilija Tovilo
6d6b20f561
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix use-after-free in SplObjectStorage::setInfo()
2024-10-17 18:21:51 +02:00
Calvin Buckley
84d6cb8cf0
Unify headers already sent/session already started error handler (#16451)
* Unify headers already sent errors

Now whenever we need to check where headers were already sent in
ext/session, we call a single location that prints where, keeping it
consistent output wise.

* Unify session aready started errors

Similar to the one for headers.

* Also change session active checks too

This usually go hand in hand with the headers already sent checks, but
is in a separate commit because of the amount of tests it changes.
2024-10-17 13:13:56 -03:00
Dmitry Stogov
39fa9cfd1a
Merge branch 'PHP-8.4'
* PHP-8.4:
  Add test for GH-16355 (fixed by previous commit)
  Update IR
  UPGRADING: Fix `IntlTimeZone::getIanaID` new method notice
2024-10-17 17:39:54 +03:00
Dmitry Stogov
c98c198623
Add test for GH-16355 (fixed by previous commit) 2024-10-17 17:37:52 +03:00
Dmitry Stogov
6896756929
Update IR
IR commit: abbdbf2ad7f66b02106f3b51602a21f10f508808
2024-10-17 17:31:47 +03:00
Ayesh Karunaratne
951dab74fa
UPGRADING: Fix IntlTimeZone::getIanaID new method notice
This was previously written as `IntlDateFormatter::getIanaID()`, but
the new method is added to the `IntlTimeZone` class.

[skip ci]
2024-10-17 19:31:47 +07:00
Dmitry Stogov
95dbc33fb2
Merge branch 'PHP-8.4'
* PHP-8.4:
  Making zend_hash_str_find_ptr_lc && zend_hash_find_ptr_lc C++ friendly (#16476)
2024-10-17 15:18:44 +03:00
Kasey Jenkins
cf3ecfff25
Making zend_hash_str_find_ptr_lc && zend_hash_find_ptr_lc C++ friendly (#16476) 2024-10-17 15:18:14 +03:00
Christoph M. Becker
3351daee61
Merge branch 'PHP-8.4'
* PHP-8.4:
  Download enchant dict from downloads.php.net
2024-10-17 00:56:29 +02:00
Christoph M. Becker
89f10e6e92
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Download enchant dict from downloads.php.net
2024-10-17 00:55:59 +02:00
Ilija Tovilo
1a2b370ad6
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix uaf in SplDoublyLinkedList::offsetSet()
2024-10-16 23:05:55 +02:00
Ilija Tovilo
d15e227750
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix uaf in SplDoublyLinkedList::offsetSet()
2024-10-16 23:05:36 +02:00
Ilija Tovilo
ec152105f2
Merge branch 'PHP-8.4'
* PHP-8.4:
  Disallow asymmetric visibility on static properties
2024-10-16 23:00:41 +02:00
Ilija Tovilo
a8bbc84551
Disallow asymmetric visibility on static properties
This check was forgotten in the original implementation. Relaxing this
restriction shouldn't be hard, but needs some work. We either need to prevent
merging of cache slots for R/RW/W, or we need to introduce an additional check
when writing to the property indirectly. This check is currently present only
for direct writes.

Closes GH-16462
2024-10-16 23:00:11 +02:00
Niels Dossche
1083872a08
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16465: Heap buffer overflow in DOMNode->getElementByTagName
2024-10-16 22:55:29 +02:00
Niels Dossche
d70f3ba9a5
Fix GH-16465: Heap buffer overflow in DOMNode->getElementByTagName
If the input contains NUL bytes then the length doesn't match the actual
duplicated string's length. Note that libxml can't handle this properly
anyway so we just reject NUL bytes and too long strings.

Closes GH-16467.
2024-10-16 22:55:18 +02:00
Tim Düsterhus
cb6025cdac
curl: Add curl_multi_get_handles() (#16363)
see https://curl.se/libcurl/c/curl_multi_get_handles.html
2024-10-16 16:24:04 +02:00
Christoph M. Becker
b7fd773cc6
Refactor zlib dictionary processing (GH-16407)
Co-authored-by: Tim Düsterhus <tim@bastelstu.be>
2024-10-16 12:21:50 +02:00
Dmitry Stogov
6d9f040d29
Stop trace recording only on ENTER to FAKE_CLOSURE (continue on EXIT) (#16455) 2024-10-16 12:26:40 +03:00
Christoph M. Becker
99aa43a65a
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16433: Large values for openssl_csr_sign() $days overflow
2024-10-16 11:10:43 +02:00
Christoph M. Becker
ef1c3b82ff
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16433: Large values for openssl_csr_sign() $days overflow
2024-10-16 11:10:12 +02:00
Dmitry Stogov
097edc86c8
Allow JIT for passing arguments to trampolines and "bad" functions (#16365)
* Better trace coverage (JIT trampoline calls)

* clenup trampoline by zend_jit_free_trampoline()

* Fix ZEND_JIT_TRACE_INIT_CALL/ZEND_JIT_TRACE_DO_ICALL num_args mismatch

It may be caused by SEND_UNPACK/SEND_ARRAY

* cleanup

* cleanup

* Don't record function that may be temporary

* cleanup

* Prevent invalid run_time_cache allocation for "bad" internal functions

* Update zend_jit_trace_record_fake_init_call_ex() accordingly

* Better handling of "bad" functions and fake closures
2024-10-15 22:31:05 +03:00
Gina Peter Banyard
2d9eb54732
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Group similar entries in UPGRADING (#16420)
2024-10-15 19:39:00 +01:00
Gina Peter Banyard
9a4ec4015a
[skip ci] Group similar entries in UPGRADING (#16420)
* [skip ci] Group similar entries in UPGRADING

This groups together:
- Class constants being typed
- Resource to object conversions
- New warnings and exceptions

Drive-by wording improvements
---------

Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>
2024-10-15 19:38:19 +01:00
Niels Dossche
5e2e49af82
Merge branch 'PHP-8.4'
* PHP-8.4:
  [ci skip] Fix UPGRADING section
2024-10-15 19:24:04 +02:00
Niels Dossche
0be5dd129e
[ci skip] Fix UPGRADING section 2024-10-15 19:23:55 +02:00
Christoph M. Becker
dbdcc95c9c
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16411: gmp_export() can cause overflow
2024-10-15 16:00:26 +02:00
Christoph M. Becker
b1fbdd8a67
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16411: gmp_export() can cause overflow
2024-10-15 15:59:53 +02:00
Dmitry Stogov
b9a64c5e34
Fix GH-16358: Segmentation fault (access null pointer) in Zend/zend_operators.c:2495 2024-10-15 15:37:30 +03:00
Arnaud Le Blanc
23c60d6b72
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix handling of invalid iterator in zend_weakmap_iterator_get_current_key()
2024-10-15 12:24:01 +02:00
Arnaud Le Blanc
8aa32601dc
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix handling of invalid iterator in zend_weakmap_iterator_get_current_key()
2024-10-15 12:23:45 +02:00
Dmitry Stogov
023d66dc1f
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16393: Assertion failure in ext/opcache/jit/zend_jit.c:2897
2024-10-15 12:03:46 +03:00
Dmitry Stogov
f68dcc5a1c
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16393: Assertion failure in ext/opcache/jit/zend_jit.c:2897
2024-10-15 12:03:36 +03:00
Calvin Buckley
edf351ce6d
Mention where headers were already sent if session_start fails (#16378)
We had previously improved where sessions were already started, and
where headers were already sent when setting headers, but not where a
header has been sent if we try to set the header cookie.

Fixes GH-16372
2024-10-14 21:13:43 -03:00
Niels Dossche
275c7f21ab
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16429: Segmentation fault (access null pointer) in SoapClient
2024-10-14 22:00:49 +02:00
Niels Dossche
37db2edd26
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16429: Segmentation fault (access null pointer) in SoapClient
2024-10-14 22:00:45 +02:00
Niels Dossche
8f1543a76e
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16397: Segmentation fault when comparing FFI object (#16401)
2024-10-14 19:24:23 +02:00
Niels Dossche
7a7ab73d3b
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16397: Segmentation fault when comparing FFI object (#16401)
2024-10-14 19:24:17 +02:00
Tim Düsterhus
3401d55726
zend_weakrefs: Add zend_weakrefs_hash_(clean|destroy)() (#16439)
These are equivalent to `zend_hash_clean()` and `zend_hash_destroy()`
respectively, but take care of correctly unregistering the weak references to
the keys.

This addition rounds off the weakmap functionality added in
471102edcd by taking one possible footgun away
from the user.
2024-10-14 18:57:08 +02:00
Ilija Tovilo
6292e5c878
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Fix new closure dump syntax in test
2024-10-14 15:04:10 +02:00
Ilija Tovilo
253f4af90e
[skip ci] Fix new closure dump syntax in test 2024-10-14 15:03:53 +02:00
Ilija Tovilo
fc210b44a6
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix deprecation warnings in tests
2024-10-14 14:28:12 +02:00
Ilija Tovilo
b1bd4e6a5c
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix deprecation warnings in tests
2024-10-14 14:28:04 +02:00
Ilija Tovilo
b55b957adf
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix segfault on debug_backtrace() in _ZendTestFiber
2024-10-14 14:05:26 +02:00
Ilija Tovilo
e7dc0d2c40
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix segfault on debug_backtrace() in _ZendTestFiber
2024-10-14 14:05:21 +02:00
Ilija Tovilo
8e3a7731cd
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix segfault in zend_test_execute_internal()
2024-10-14 14:03:34 +02:00
Ilija Tovilo
7d99355dad
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix segfault in zend_test_execute_internal()
2024-10-14 14:03:09 +02:00
Ilija Tovilo
41958082bd
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix exception in assert() callback with bail enabled
2024-10-14 14:01:26 +02:00
Ilija Tovilo
5f2f1a5702
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix exception in assert() callback with bail enabled
2024-10-14 14:01:16 +02:00
Christoph M. Becker
d531fbd8b0
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16427: Unchecked libavif return values
2024-10-14 13:55:22 +02:00
Christoph M. Becker
055b15f08c
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16427: Unchecked libavif return values
2024-10-14 13:54:52 +02:00
Ilija Tovilo
16d25da76b
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix op2 caching for static properties
  Split expression
2024-10-14 13:46:04 +02:00
Ilija Tovilo
67318e91bc
Fix op2 caching for static properties
op2.num may contain other flags, like ZEND_FETCH_CLASS_EXCEPTION. These
currently circumvent caching. Once the property is cached, these flags have no
influence on the result, so it doesn't seem like this was done on purpose.

Closes GH-16380
2024-10-14 13:45:06 +02:00
Ilija Tovilo
60562175ed
Split expression 2024-10-14 13:43:48 +02:00
David Carlier
323c9f4981
[skip ci] UPGRADING/NEWS changes 2024-10-14 12:42:01 +01:00
David Carlier
6d1881b42d
ext/zlib: gzfile/gzopen/readgzfile converting use_include_path argument to actual boolean.
close GH 16424
2024-10-14 12:40:57 +01:00
Ilija Tovilo
0f172715b0
Merge branch 'PHP-8.4'
* PHP-8.4:
  Skip shebang in cli-server router script
2024-10-14 13:35:48 +02:00
Ilija Tovilo
3074cbf5b6
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Skip shebang in cli-server router script
2024-10-14 13:35:41 +02:00
Ilija Tovilo
39533af024
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix array to string conversion warning emitted in optimizer
2024-10-14 13:25:39 +02:00
Ilija Tovilo
3546733065
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix array to string conversion warning emitted in optimizer
2024-10-14 13:25:31 +02:00
DanielEScherzer
275f63e7fd
Zend/tests: organize some tests with subdirectories (2) (#16423)
Move more low-hanging fruit, creating new directories for the tests for:

* comparisons
* dynamic calls
* error messages
* `error_reporting()`
* exceptions
* `foreach()`
* garbage collection
* group `use` statements
* heredoc and nowdoc
* `goto` jumps
* late static binding
* magic methods
* namespaces
* numeric literal separators
* objects
* `settype()`
* cleaning of temporary values
* `unset()`

Additionally, move some tests into the existing subdirectory for `list()`
tests.

Drive-by fixes of some test numbers in the names of the `goto` tests.

Work towards GH-15631
2024-10-14 12:14:42 +01:00
Christoph M. Becker
fe76b396f5
Move ARG_(WITH|ENABLE) to the toplevel (GH-16391)
`buildconf` (and `phpize`) have special treatment for these "macros".
When configure.js is built, all config.w32 are grepped, these "macros"
are appended to configure.js, and all config.w32 contents are appended
with the "macros" commented out.  That means that for `configure` they
are in the toplevel anyway, so having them inside of `if` statements in
config.w32 is confusing.

Note that this matches autoconf behavior.
2024-10-14 10:42:19 +02:00
Niels Dossche
41c55d18f5
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16409: Segfault in exif_thumbnail when not dealing with a real file
2024-10-13 21:13:12 +02:00
Niels Dossche
63c9d12a1e
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16409: Segfault in exif_thumbnail when not dealing with a real file
2024-10-13 21:13:06 +02:00
Gina Peter Banyard
810a121201
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Some more organisational fixes to UPGRADING
2024-10-13 18:49:58 +01:00
Gina Peter Banyard
da4eab6c5c
[skip ci] Some more organisational fixes to UPGRADING
Closes GH-16415
2024-10-13 18:49:10 +01:00
David Carlier
79c71c9f0b
Merge branch 'PHP-8.4' 2024-10-13 14:27:24 +01:00
David Carlier
61d34b3ebc
Merge branch 'PHP-8.3' into PHP-8.4 2024-10-13 14:26:59 +01:00
DanielEScherzer
8475d5fea1
Zend/tests: organize some tests with subdirectories (#15638)
Move some low-hanging fruit, creating new directories for the tests for

* access modifiers
* `class_alias()`
* constant expressions
* constructor property promotion
* `__debugInfo()`
* dereferencing
* first class callable syntax

Additionally, move some tests into the existing subdirectory for
closure-related tests

Work towards GH-15631
2024-10-13 14:21:07 +01:00
David Carlier
ecccb36a41
Merge branch 'PHP-8.4' 2024-10-13 14:20:04 +01:00
David Carlier
4d008e300b
Merge branch 'PHP-8.3' into PHP-8.4 2024-10-13 14:19:45 +01:00
DanielEScherzer
150599e5ac
win32/dllmain.c: drop some unused code (#16353)
The code block is guarded by `#if 0`, and even if it wasn't it is a switch that
only contains breaks, i.e. it wouldn't actually do anything if enabled.
2024-10-13 11:24:22 +01:00
Christoph M. Becker
b2ff871e38
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16326: Memory management is broken for bad dictionaries
2024-10-13 02:31:16 +02:00
Christoph M. Becker
a7918a7ac3
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16326: Memory management is broken for bad dictionaries
2024-10-13 02:30:38 +02:00
Ilija Tovilo
50b6713a25
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Mark some more macOS tests as flaky
2024-10-13 02:07:27 +02:00
Ilija Tovilo
b7e39970d3
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [skip ci] Mark some more macOS tests as flaky
2024-10-13 02:07:19 +02:00
Daniel Scherzer
6c9db6085a
ext/standard/exec.c: combine conditions, update docs
While `php_escape_shell_cmd()` did indeed `emalloc` a string that needed to be
freed by the caller in the original implementation that was put in GitHub
(see commit 257de2bade) a few months ago the
return type was changed to use `zend_string`, see #14353.

Closes GH-16313
2024-10-13 01:33:03 +02:00
Niels Dossche
e150b0b3a1
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16318: Recursive array segfaults soap encoding
2024-10-12 23:30:50 +02:00
Niels Dossche
f108c1675e
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16318: Recursive array segfaults soap encoding
2024-10-12 23:30:44 +02:00
Christoph M. Becker
7a1f4b65a3
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16388: UB when freeing a cloned _ZendTestFiber
2024-10-12 22:50:15 +02:00
Christoph M. Becker
8a5c716eb8
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16388: UB when freeing a cloned _ZendTestFiber
2024-10-12 22:49:45 +02:00
David Carlier
35c8a010c6
Merge branch 'PHP-8.4' 2024-10-12 15:24:53 +01:00
David Carlier
10dbdc5608
Merge branch 'PHP-8.3' into PHP-8.4 2024-10-12 15:23:48 +01:00
Christoph M. Becker
40052b3461
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16357: openssl may modify member types of certificate arrays
2024-10-12 16:08:16 +02:00
Christoph M. Becker
33fab73730
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16357: openssl may modify member types of certificate arrays
2024-10-12 16:07:50 +02:00
Christoph M. Becker
9402121a46
Fix potentially erroneous php_win32_crt_compatible() (GH-16374)
Whether we link with a debug runtime or a normal runtime is not really
related to `PHP_DEBUG`, but rather to `_DEBUG`[1].

We also stop defining that flag, since the compiler already does that.

[1] <https://learn.microsoft.com/en-us/cpp/c-runtime-library/debug>
2024-10-12 16:00:15 +02:00
David Carlier
2e263d26a2
Merge branch 'PHP-8.4' 2024-10-12 14:54:02 +01:00
David Carlier
42f877659d
Fix GH-16359 curl write callback crash on FCC usage w/o user function.
close GH-16362
2024-10-12 14:53:22 +01:00
Niels Dossche
18ab3b9e6d
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix error message for newer libxml
  Backport 061058a9: Test fixes for libxml2 2.12.0
  Workaround deprecation warning in zend_test on 8.1
  Backport 3ec5919e: Update error message for libxml 2.13
  Backport f74f9b07: Update libxml test for the directory field behaviour change
  Backport 4fe82131: Backport libxml2 2.13.2 fixes (#14816)
  Backport e2d97314: Backport deprecation warning ignores to unbreak CI
  Backport 0a39890c: Fix libxml2 2.12 build due to API breaks
2024-10-12 15:14:32 +02:00
Niels Dossche
2577b89b8d
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix error message for newer libxml
  Backport 061058a9: Test fixes for libxml2 2.12.0
  Workaround deprecation warning in zend_test on 8.1
  Backport 3ec5919e: Update error message for libxml 2.13
  Backport f74f9b07: Update libxml test for the directory field behaviour change
  Backport 4fe82131: Backport libxml2 2.13.2 fixes (#14816)
  Backport e2d97314: Backport deprecation warning ignores to unbreak CI
  Backport 0a39890c: Fix libxml2 2.12 build due to API breaks
2024-10-12 15:14:25 +02:00
Niels Dossche
a1974e6db0
Merge branch 'PHP-8.4'
* PHP-8.4:
  Restore accidentally deleted check
2024-10-12 13:41:29 +02:00
Niels Dossche
b7b0b954be
Restore accidentally deleted check 2024-10-12 13:41:24 +02:00
Niels Dossche
105cf92a13
Merge branch 'PHP-8.4'
* PHP-8.4:
  Add missing hierarchy checks to replaceChild
  Fix GH-16337: Use-after-free in SplHeap
2024-10-12 13:39:13 +02:00
Niels Dossche
c31eac7284
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Add missing hierarchy checks to replaceChild
  Fix GH-16337: Use-after-free in SplHeap
2024-10-12 13:39:06 +02:00
Niels Dossche
baa76be615
Use SWAR to seek for non-ASCII UTF-8 in DOM parsing (#16350)
GitHub FYP test case:
```
Benchmark 1: ./sapi/cli/php test.php
  Time (mean ± σ):     502.8 ms ±   6.2 ms    [User: 498.3 ms, System: 3.2 ms]
  Range (min … max):   495.2 ms … 509.8 ms    10 runs

Benchmark 2: ./sapi/cli/php_old test.php
  Time (mean ± σ):     518.4 ms ±   4.3 ms    [User: 513.9 ms, System: 3.2 ms]
  Range (min … max):   511.5 ms … 525.5 ms    10 runs

Summary
  ./sapi/cli/php test.php ran
    1.03 ± 0.02 times faster than ./sapi/cli/php_old test.php
```

Wikipedia English homepage test case:
```
Benchmark 1: ./sapi/cli/php test.php
  Time (mean ± σ):     301.1 ms ±   4.2 ms    [User: 295.5 ms, System: 4.8 ms]
  Range (min … max):   296.3 ms … 308.8 ms    10 runs

Benchmark 2: ./sapi/cli/php_old test.php
  Time (mean ± σ):     308.2 ms ±   1.7 ms    [User: 304.6 ms, System: 2.9 ms]
  Range (min … max):   306.9 ms … 312.8 ms    10 runs

Summary
  ./sapi/cli/php test.php ran
    1.02 ± 0.02 times faster than ./sapi/cli/php_old test.php
```
2024-10-12 13:29:33 +02:00
Niels Dossche
497dbaa2df
Fix GH-16389: Assertion failure in ext/ldap/ldap.c:2718 (#16392) 2024-10-12 13:19:23 +02:00
Niels Dossche
7fae9f7397
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16385: Unexpected null returned by session_set_cookie_params
2024-10-12 13:09:31 +02:00
Niels Dossche
45f7f87b75
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16385: Unexpected null returned by session_set_cookie_params
2024-10-12 13:09:24 +02:00
DanielEScherzer
24d11b7e6f
RecursiveTreeIterator::__construct(): switch @param to typehint (#16215)
The type is enforced, and `TypeError`s are already thrown, but the
information about the required type is not provided to Reflection. Replace the
`@param` comment with a real typehint so that the information is also available
via Reflection.
2024-10-12 11:42:34 +01:00
Christoph M. Becker
89533482a4
Merge branch 'PHP-8.4'
* PHP-8.4:
  Backport 3237b8f471
2024-10-11 23:58:11 +02:00
Christoph M. Becker
e35380c2c2
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Backport 3237b8f471
2024-10-11 23:57:47 +02:00
Christoph M. Becker
0258b9d5a2
Run PHP-8.4 nightly on macOS 13
Cf. <https://github.com/php/php-src/pull/16375#issuecomment-2407919040>
2024-10-11 23:14:09 +02:00
Christoph M. Becker
7dda2deae8
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16367: macOS CI fails to configure ext/intl on master
2024-10-11 23:11:35 +02:00
Christoph M. Becker
37561823e9
Fix GH-16367: macOS CI fails to configure ext/intl on master
Closes GH-16375.
2024-10-11 23:10:29 +02:00
Niels Dossche
7ff940f2a2
Fix GH-16356: Segmentation fault with $outerHTML and next node (#16364)
`$outerHTML` should only serialize the current node, not its siblings.
2024-10-11 20:44:50 +02:00
David Carlier
2b39e72fac
Merge branch 'PHP-8.4' 2024-10-11 19:38:58 +01:00
David Carlier
be370edbd7
Merge branch 'PHP-8.3' into PHP-8.4 2024-10-11 19:38:39 +01:00
Christoph M. Becker
b14076a4e6
Fix property access of PHP objects wrapped in variant
First, we fix the long standing issue that property access throws a
`com_exception` ("0x80020003: member not found), because the `HRESULT`
was not properly set after accessing the property.

Next, we fix an issue introduced as of PHP 7.0.0, where the string
length for write access had been properly adapted, but the string
length for read access had been overlooked.

Then we fix an issue introduced as of PHP 8.0.0, where new `HashTable`s
no longer set `nNextFreeElement` to zero, but to `ZEND_LONG_MIN`.  This
doesn't work well with the `DISPID` lookup, which is a `LONG`.

Finally we fix a potential double-free due to erroneously destroying
the return value of `zend_read_property()`.

Closes GH-16331.
2024-10-11 16:50:35 +02:00
Christoph M. Becker
9345582471
XLEAK bug78270_2.phpt (GH-16352)
This test leaks memory as some other ext/ffi tests, so we treat it in
the same way.

We also fix a typo in another test.
2024-10-11 10:27:37 +02:00
David Carlier
0323fffd4b
Merge branch 'PHP-8.4' 2024-10-11 08:49:19 +01:00
David Carlier
f47a45ecff
Merge branch 'PHP-8.3' into PHP-8.4 2024-10-11 08:49:00 +01:00
Niels Dossche
5bb987b3a3
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16168: php 8.1 and earlier crash immediately when compiled with Xcode 16 clang on macOS 15
2024-10-11 09:14:32 +02:00
Niels Dossche
5b0b151bb2
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16168: php 8.1 and earlier crash immediately when compiled with Xcode 16 clang on macOS 15
2024-10-11 09:14:26 +02:00
Niels Dossche
543c168314
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix OSS-Fuzz #371445205: Heap-use-after-free in attr_free
2024-10-11 09:07:25 +02:00
Niels Dossche
e0b1b693e3
Fix OSS-Fuzz #371445205: Heap-use-after-free in attr_free
zend_hash_get_current_key() does not return a string with incremented
refcount, so it shouldn't get released. This release caused a UAF later
when the attribute was destroyed. This wasn't noticed earlier because
object_init_with_constructor() was only ever tested with interned
strings.

Closes GH-16349.
2024-10-11 09:07:08 +02:00
Christoph M. Becker
6e172f0ac1
Drop fallback for PathCchCanonicalizeEx() (GH-16341)
This function is only available as of Windows 8 and Windows Server 2012,
respectively, and thus needed a fallback (albeit a non working one).
However, as of PHP 8.3.0 Windows 8/Server 2012 is required anyway, so
we can drop the fallback as well as the dynamic loading in favor of
linking to the import library.
2024-10-11 00:03:37 +02:00
DanielEScherzer
018e7f5842
ext/standard/html.c: clean up a bit (GH-16311)
- Instead of manually wrapping `assert()` statements with a `ZEND_DEBUG`
condition, use `ZEND_ASSERT()`, so that for non-debug builds the compiler is
told to assume that the assertion is correct.

- Update some return types for methods that return `zend_result`.
2024-10-10 23:30:03 +02:00
Niels Dossche
c597f92be9
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16316: DOMXPath breaks when not initialized properly
2024-10-10 19:29:22 +02:00
Niels Dossche
25d0661d21
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16316: DOMXPath breaks when not initialized properly
2024-10-10 19:29:16 +02:00
Dmitry Stogov
57bfca9045
JIT support for ASSIGN_DIM[_OP] with IS_VAR op1 (#16339) 2024-10-10 15:47:20 +03:00
Tim Düsterhus
3da6818c9e
reflection: Use fast ZPP for ReflectionProperty::(get|set)Value() (#16329)
During the Doctrine Core Team Meetup 2024 the Doctrine team investigated the
performance overhead of using `setRawValueWithoutLazyInitialization()` instead
of `setValue()` and came to the surprising conclusion that
`setRawValueWithoutLazyInitialization()` outperformed `setValue()`, despite
doing more work.

These two scripts are used as the benchmark:

    <?php

    class Foo
    {
        public $id;
        public $foo1;
        public $foo2;
        public $foo3;
        public $foo4;
    }

    $reflection = new ReflectionClass(Foo::class);
    $properties = $reflection->getProperties();

    for ($i = 0; $i < 1000000; $i++) {
        $foo = new Foo();
        foreach ($properties as $property) {
            $property->setValue($foo, 1);
        }
    }

and

    <?php

    class Foo
    {
        public $id;
        public $foo1;
        public $foo2;
        public $foo3;
        public $foo4;
    }

    $reflection = new ReflectionClass(Foo::class);
    $properties = $reflection->getProperties();

    for ($i = 0; $i < 1000000; $i++) {
        $foo = new Foo();
        foreach ($properties as $property) {
            $property->setRawValueWithoutLazyInitialization($foo, 1);
        }
    }

Benchmarking these with a current git master shows that `setValue()` is 50%
slower:

    $ hyperfine -L script setValue,setRawValueWithoutLazyInitialization '/tmp/php-before /tmp/test/{script}.php'
    Benchmark 1: /tmp/php-before /tmp/test/setValue.php
      Time (mean ± σ):     216.0 ms ±   5.8 ms    [User: 212.0 ms, System: 3.7 ms]
      Range (min … max):   208.2 ms … 225.3 ms    13 runs

    Benchmark 2: /tmp/php-before /tmp/test/setRawValueWithoutLazyInitialization.php
      Time (mean ± σ):     145.6 ms ±   3.6 ms    [User: 141.6 ms, System: 3.8 ms]
      Range (min … max):   140.4 ms … 152.8 ms    20 runs

    Summary
      /tmp/php-before /tmp/test/setRawValueWithoutLazyInitialization.php ran
        1.48 ± 0.05 times faster than /tmp/php-before /tmp/test/setValue.php

Looking into the “why” revealed that the `setValue()` script spent quite some
time in `zend_parse_parameters()`.

A 50% overhead can be significant, given that `setValue()` is commonly called
several thousand times in a single request when using Doctrine.

This commit changes the non-static property case of `setValue()` to make use of
the fast parameter parsing API and adjusts `getValue()` for consistency.

The resulting comparison shows that both `setValue()` and
`setRawValueWithoutLazyInitialization()` are now (almost) equal:

    $ hyperfine -L script setValue,setRawValueWithoutLazyInitialization 'sapi/cli/php /tmp/test/{script}.php'
    Benchmark 1: sapi/cli/php /tmp/test/setValue.php
      Time (mean ± σ):     143.0 ms ±   6.4 ms    [User: 139.4 ms, System: 3.4 ms]
      Range (min … max):   134.8 ms … 157.7 ms    18 runs

    Benchmark 2: sapi/cli/php /tmp/test/setRawValueWithoutLazyInitialization.php
      Time (mean ± σ):     147.0 ms ±   5.5 ms    [User: 143.0 ms, System: 3.6 ms]
      Range (min … max):   139.9 ms … 159.8 ms    19 runs

    Summary
      sapi/cli/php /tmp/test/setValue.php ran
        1.03 ± 0.06 times faster than sapi/cli/php /tmp/test/setRawValueWithoutLazyInitialization.php
2024-10-10 09:19:53 +02:00
Christoph M. Becker
df8f298d8d
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Allow to run push workflows manually
2024-10-10 02:14:20 +02:00
Christoph M. Becker
279e952159
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [skip ci] Allow to run push workflows manually
2024-10-10 02:13:57 +02:00
Christoph M. Becker
a1d4595d65
Fix calculation of aligned buffer size
As is, for requested size which are already aligned, we over-allocate,
so we fix this.  We also fix the allocation for chunk size 1.

This issue has been reported by @kkmuffme.

Thanks to @iluuu1994 for improving the fix!

Closes GH-16161.
2024-10-10 01:56:47 +02:00
Christoph M. Becker
4d3240261d
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16174: Empty string is an invalid expression for phpdbg-ev
2024-10-10 01:47:52 +02:00
Christoph M. Becker
980d41cb3a
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16174: Empty string is an invalid expression for phpdbg-ev
2024-10-10 01:47:23 +02:00
Dmitry Stogov
0ef2a22673
Fix JIT support for static properties of self and parent 2024-10-10 02:24:54 +03:00
Christoph M. Becker
b63e161012
Merge branch 'PHP-8.4'
* PHP-8.4:
  Revert "Fix GH-16322: overflow on imageaffine matrix argument."
2024-10-10 01:16:40 +02:00
Christoph M. Becker
7bf3f708d5
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Revert "Fix GH-16322: overflow on imageaffine matrix argument."
2024-10-10 01:15:52 +02:00
Christoph M. Becker
f77c4c0f2b
Merge branch 'PHP-8.4'
* PHP-8.4:
  Revert "Fix GH-16322: overflow on imageaffine matrix argument."
  Fix GH-16322: overflow on imageaffine matrix argument.
2024-10-10 01:00:33 +02:00
Christoph M. Becker
07f1b5a414
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Revert "Fix GH-16322: overflow on imageaffine matrix argument."
  Fix GH-16322: overflow on imageaffine matrix argument.
2024-10-10 00:59:58 +02:00
Niels Dossche
c78f0e3f73
[ci skip] Fix bug description 2024-10-09 22:45:35 +02:00
Nikita Popov
517ac20127 Remove special handling of exit/die in stubs
PHP-Parser 5.3.1 allows these as function names to allow direct
use in stubs.
2024-10-09 21:43:50 +02:00
Christoph M. Becker
8ca1313e38
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix out of bound writes to SafeArray data
2024-10-09 21:16:52 +02:00
Christoph M. Becker
42a2b046fe
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix out of bound writes to SafeArray data
2024-10-09 21:16:29 +02:00
DanielEScherzer
41996e8d4f
ext/[cd]*: fix a bunch of typos (#16298)
Only functional change is the renaming of the functions
`dom_document_substitue_entities_(read|write)` to replace `substitue` with
`substitute`.
2024-10-09 17:40:42 +02:00
DanielEScherzer
e34eebb854
GDB: format output for class entries and class constants (#15955)
For `zend_string` pointers in class entries, show the string contents (if not
`NULL`).

For class constants, the `ce` (class entry pointer) field is shown with the
name of the class, and the `doc_comment` field is shown with the string
contents if possible.
2024-10-09 13:10:48 +02:00
Tim Düsterhus
b675db4c56
Merge branch 'PHP-8.4'
* PHP-8.4:
  curl: Prevent a CurlMultiHandle from holding onto a CurlHandle if `add_handle` fails (#16302)
2024-10-09 09:38:25 +02:00
Tim Düsterhus
f2fbb75f30
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  curl: Prevent a CurlMultiHandle from holding onto a CurlHandle if `add_handle` fails (#16302)
2024-10-09 09:38:16 +02:00
Niels Dossche
dd0ced3046
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16292: Segmentation fault in ext/xmlreader/php_xmlreader.c:1282
2024-10-08 20:58:26 +02:00
Niels Dossche
1f84f5c27a
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16292: Segmentation fault in ext/xmlreader/php_xmlreader.c:1282
2024-10-08 20:58:20 +02:00
Jakub Zelenka
c8194a1788
Merge branch 'PHP-8.4' 2024-10-08 19:23:07 +01:00
Jakub Zelenka
3bb06bc728
Merge branch 'PHP-8.3' into PHP-8.4 2024-10-08 19:22:44 +01:00
Niels Dossche
dcd51beac0
Merge branch 'PHP-8.4'
* PHP-8.4:
  Update Lexbor (#16288)
2024-10-08 19:16:30 +02:00
Niels Dossche
98e5308488
Update Lexbor (#16288)
Sync up to lexbor/lexbor@72236d31da.
Reason: pulling in mainly
lexbor/lexbor@cbf1263e78 for the WHATWG
encoding update.
2024-10-08 19:15:45 +02:00
Sergey Panteleev
f899a3ed2c
Merge branch 'PHP-8.4'
* PHP-8.4:
  PHP-8.2 is now for PHP 8.2.26-dev
  [ci skip] Update NEWS for PHP 8.4.0RC2
2024-10-08 19:56:24 +05:00
Sergey Panteleev
564db544bb
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  PHP-8.2 is now for PHP 8.2.26-dev
2024-10-08 19:56:14 +05:00
Calvin Buckley
7f2d1928cd
[ci skip] Update NEWS for PHP 8.4.0RC2 2024-10-08 10:59:50 -03:00
Calvin Buckley
3d6b80a33c Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix regression on platforms without `ZEND_CHECK_STACK_LIMIT` set (8.4) (#16285)
2024-10-08 10:24:03 -03:00
Calvin Buckley
4643386703
Fix regression on platforms without ZEND_CHECK_STACK_LIMIT set (8.4) (#16285)
The check called an API only available with this def set.
Gate the check behind ifdef and change control flow to better fit it.

Co-authored-by: Arnaud Le Blanc <arnaud.lb@gmail.com>
2024-10-08 10:22:23 -03:00
Tim Düsterhus
35a681d717
curl: Remove unnecessary dynamic allocation for HashTable in _php_curl_free (#16297)
Given that the lifecycle of the `slist` HashTable exactly matches the lifecycle
of the `_php_curl_free` struct, we might as well embed the HashTable directly
and avoid a pointer indirection.
2024-10-08 15:07:32 +02:00
Ilija Tovilo
4b97e7bf02
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix various hooked object iterator issues
2024-10-08 13:37:38 +02:00
Ilija Tovilo
d76ef13757
Fix various hooked object iterator issues
Fixes GH-16185
Closes GH-16281
2024-10-08 13:35:33 +02:00
Dmitry Stogov
edc94a8d21
Merge branch 'PHP-8.4'
* PHP-8.4:
  Update IR
2024-10-07 21:18:55 +03:00
Dmitry Stogov
3fcf8caca8
Update IR
IR commit: 88c71c9572bdd9dd8aed99c80ad4a54fcbcfe082
2024-10-07 21:18:35 +03:00
Christoph M. Becker
85cf4a39d7
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix PDO_Firebird tests for 32bit
2024-10-07 19:53:04 +02:00
Christoph M. Becker
626dc50989
Fix PDO_Firebird tests for 32bit
These tests are failing because the integers are too large to be cast
to a PHP int.  We fix this by expecting either an int or a string.

Closes GH-16278.
2024-10-07 19:52:39 +02:00
Arnaud Le Blanc
f8796aac39
Merge branch 'PHP-8.4'
* PHP-8.4:
  NEWS for GH-16200
  Use original op_array when JIT compiling a Closure
2024-10-07 18:19:42 +02:00
Arnaud Le Blanc
6f70cd3f04
NEWS for GH-16200 2024-10-07 18:19:26 +02:00
Arnaud Le Blanc
82f70dba7d
Use original op_array when JIT compiling a Closure
zend_jit() assumes that Closure op_arrays have no scope, but this is not true
when using the hot counters, first exec, or trace triggers as they use the
executed op_array, which is in case of Closures is a copy, with a scope.

In the tracing JIT this problem is avoided as we fetch the original op_array
when compiling a Closure. Here I replicate this for the hot counters and first
exec triggers.

Fixes GH-16186
Closes GH-16200
2024-10-07 18:06:14 +02:00
Niels Dossche
1e6e7bff78
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16261: Reference invariant broken in mb_convert_variables()
2024-10-07 17:50:05 +02:00
Niels Dossche
07e418abfb
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16261: Reference invariant broken in mb_convert_variables()
2024-10-07 17:49:56 +02:00
Niels Dossche
0d564deed8
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16259: Soap segfault when classmap instantiation fails
2024-10-07 17:43:16 +02:00
Niels Dossche
82d58c4842
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16259: Soap segfault when classmap instantiation fails
2024-10-07 17:43:10 +02:00
Niels Dossche
5b1f1b4a70
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fixed GH-16233: Observer segfault when calling user function in internal function via trampoline
2024-10-07 17:18:38 +02:00
Niels Dossche
b24cc7386b
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fixed GH-16233: Observer segfault when calling user function in internal function via trampoline
2024-10-07 17:18:32 +02:00
Arnaud Le Blanc
6c5749f34a
Merge branch 'PHP-8.4'
* PHP-8.4:
  NEWS for GH-16196
  NEWS for GH-16196
  NEWS for GH-16196
  Handle references properties of the Exception class
2024-10-07 15:06:37 +02:00
Arnaud Le Blanc
befe404419
NEWS for GH-16196 2024-10-07 15:04:43 +02:00
Arnaud Le Blanc
c1ea9b173f
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  NEWS for GH-16196
  NEWS for GH-16196
  Handle references properties of the Exception class
2024-10-07 15:04:24 +02:00
Dmitry Stogov
4e071b9f3e
Merge branch 'PHP-8.4'
* PHP-8.4:
  Update IR
2024-10-07 15:31:25 +03:00
Dmitry Stogov
64214d286b
Update IR
IR commit: eff4b4109aed08d4864bd5bd7228575d8fd01158
2024-10-07 15:31:04 +03:00
Dmitry Stogov
33b4bdc448
JIT for INIT_STATIC_METHOD_CALL (#16206)
* JIT for INIT_STATIC_METHOD_CALL

* Fixed typo

* Fix missing LOAD

* Separate zend_get_known_class()
2024-10-07 15:28:23 +03:00
Ilija Tovilo
b34f22d801
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16162: No ReflectionProperty::IS_VIRTUAL
2024-10-07 14:18:36 +02:00
Daniel Scherzer
76e5d82eb2
Fix GH-16162: No ReflectionProperty::IS_VIRTUAL
Closes GH-16166
2024-10-07 14:17:40 +02:00
David Carlier
27985472d9
Merge branch 'PHP-8.4' 2024-10-07 13:06:00 +01:00
David Carlier
7f1fd0646b
Merge branch 'PHP-8.3' into PHP-8.4 2024-10-07 13:05:41 +01:00
Ilija Tovilo
1b4bb0bb6b
Make %a/%A placeholders in tests lazy (#16088)
This reduces backtracking, which should improve performance and avoid hitting
the backtrack limit in tests with a large output.

See https://github.com/php/php-src/pull/16087
2024-10-07 14:01:54 +02:00
Christoph M. Becker
a74eb24e69
Unify types of PHP_VERSION and friends on Windows
For `phpize` builds, all three version variables are numbers, but for
`buildconf` builds, all are strings.  This can yield surprising results
when extensions create their `PHP_VERSION_ID` like

10000 * PHP_VERSION + 100 * PHP_MINOR_VERSION + PHP_RELEASE_VERSION

Since `phpize` builds are way more common for external extensions
nowadays, we change the types for `buildconf` builds.

Closes GH-16247.
2024-10-07 13:30:07 +02:00
Christoph M. Becker
2f52dbd7b7
Prevent direct instantiation of com_safearray_proxy (GH-10278)
* Prevent direct instantiation of com_safearray_proxy

The `com_safearray_proxy` class is meant for internal usage, but so far
it was possible to instantiate it from userland, although that made no
sense.  However, a while ago there was a relevant change[1], namely
that its `default_object_handlers` are now assigned when the class is
registered, while previously they only have been assigned when an
instance had been created internally.  So now when freeing a manually
created object, `free_obj()` is called, although the object never has
been properly initialized (causing segfaults).

We fix this by introducing a `create_object()` handler which properly
initializes the object with dummy values.  Since a manually created
`com_safearray_proxy` still does not make sense, we disallow its
instantiation.

[1] <94ee4f9834>

Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
2024-10-07 11:35:59 +02:00
Matteo Beccati
1cc913bc69
Merge branch 'PHP-8.4'
* PHP-8.4:
  PDO_MYSQL: Properly quote binary strings
  Reproduce unexpected MySQL warnings for binary values
2024-10-07 11:17:46 +02:00
Matteo Beccati
cba92beac3
PDO_MYSQL: Properly quote binary strings
Closes GH-15949
2024-10-07 11:04:50 +02:00
Luís Cobucci
93c68caeb5
Reproduce unexpected MySQL warnings for binary values
The prepared statement emulation layer is handling binary content in a
way that creates warnings in MySQL.

When analysing the query logs, we saw that the content sent to the
server is missing `0x5C` characters when the using emulated prepares.

This introduces a minimal test case that reproduces the issue to aid the
solution.

More info: https://github.com/doctrine/dbal/pull/6522#issuecomment-2340939347

Signed-off-by: Luís Cobucci <lcobucci@gmail.com>
2024-10-07 09:29:02 +02:00
Ayesh Karunaratne
a8f544289b
UPGRADING: Fix parameter name in bzcompress work_factor param
Follow-up to GH-16108, to add the `$` sign to the `work_factor`
paremter mention in the `UPGRADING` file.
2024-10-07 13:49:04 +07:00
Christoph M. Becker
2d3990c50a
Merge branch 'PHP-8.4'
* PHP-8.4:
  Install 32bit Firebird server on x86
2024-10-07 01:40:20 +02:00
Christoph M. Becker
5c7c5d93ae
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Install 32bit Firebird server on x86
2024-10-07 01:39:51 +02:00
Gina Peter Banyard
2d217f08b8
sapi/phpdbg: Use HASH_FOREACH macro (#16211) 2024-10-07 00:17:30 +01:00
Christoph M. Becker
6436eaa16b
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix failing openssl_private_decrypt tests
  Update Windows CI to use php-sdk-2.3.0
2024-10-07 01:09:17 +02:00
Christoph M. Becker
526d858417
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix failing openssl_private_decrypt tests
  Update Windows CI to use php-sdk-2.3.0
2024-10-07 01:08:51 +02:00
Jakub Zelenka
00cdbcf110
Merge branch 'PHP-8.4' 2024-10-06 21:27:06 +01:00
Jakub Zelenka
ee7e21020e
Fix FPM tester params type 2024-10-06 21:26:42 +01:00
Jakub Zelenka
665ea46c1c
Merge branch 'PHP-8.3' into PHP-8.4 2024-10-06 21:25:36 +01:00
Jakub Zelenka
ba0336c5b9
Merge branch 'PHP-8.4' 2024-10-06 19:43:44 +01:00
Jakub Zelenka
10d2d862a6
Merge branch 'PHP-8.3' into PHP-8.4 2024-10-06 19:43:19 +01:00
David Carlier
828a21792c
Merge branch 'PHP-8.4' 2024-10-06 19:26:29 +01:00
David Carlier
062b3ca2f2
Merge branch 'PHP-8.3' into PHP-8.4 2024-10-06 19:26:10 +01:00
David Carlier
c4532c8e98
Merge branch 'PHP-8.4' 2024-10-06 18:08:08 +01:00
David Carlier
d1a313e12c
Merge branch 'PHP-8.3' into PHP-8.4 2024-10-06 18:07:48 +01:00
Niels Dossche
09614f4f14
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16256: Assertion failure in ext/soap/php_encoding.c:460
2024-10-06 18:02:38 +02:00
Niels Dossche
fa52f5f08c
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16256: Assertion failure in ext/soap/php_encoding.c:460
2024-10-06 18:02:33 +02:00
Niels Dossche
d197162033
Merge branch 'PHP-8.4'
* PHP-8.4:
  Add SKIPIF for ZendMM for observer_fiber_functions_03.phpt
2024-10-06 18:00:54 +02:00
Niels Dossche
589da5b008
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Add SKIPIF for ZendMM for observer_fiber_functions_03.phpt
2024-10-06 18:00:49 +02:00
Niels Dossche
5b0792f74b
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix Soap leaking http_msg on error
2024-10-06 17:59:54 +02:00
Niels Dossche
ce3869b547
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix Soap leaking http_msg on error
2024-10-06 17:59:49 +02:00
David Carlier
a7edde7c40
Merge branch 'PHP-8.4' 2024-10-06 16:43:08 +01:00
David Carlier
0ee170b261
Merge branch 'PHP-8.3' into PHP-8.4 2024-10-06 16:42:48 +01:00
David Carlier
1feb210e93
Merge branch 'PHP-8.4' 2024-10-06 11:02:43 +01:00
David Carlier
3caa5f8592
Merge branch 'PHP-8.3' into PHP-8.4 2024-10-06 11:02:12 +01:00
Niels Dossche
39ae00fa0a
NEWS and UPGRADING for outerHTML
Closes GH-15887.
2024-10-05 23:29:12 +02:00
Niels Dossche
7d678875c0
Rename inner_html_mixin.c to inner_outer_html_mixin.c 2024-10-05 23:26:33 +02:00
Niels Dossche
e4e65aa255
Add Dom\Element::$outerHTML setter
Reference: https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#the-outerhtml-property
2024-10-05 23:24:27 +02:00
Niels Dossche
402b1c29b6
Add Dom\Element::$outerHTML getter
Reference: https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#the-outerhtml-property
2024-10-05 23:24:27 +02:00
David Carlier
f0e184767e
Merge branch 'PHP-8.4' 2024-10-05 19:34:05 +01:00
David Carlier
78767de197
Merge branch 'PHP-8.3' into PHP-8.4 2024-10-05 19:33:56 +01:00
Gina Peter Banyard
b445641dd7 ext/dba: php_dba_make_key() only returns NULL when an exception occurs 2024-10-05 17:48:28 +01:00
Gina Peter Banyard
41217bb06c ext/dba: Use zend_string for resource key instead of char*
At multiple time we would be creating a zend_string anyway
2024-10-05 17:48:28 +01:00
Niels Dossche
50d515b9a7
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix edge-case in DOM parsing decoding
2024-10-05 18:27:33 +02:00
Niels Dossche
1e949d189a
Fix edge-case in DOM parsing decoding
There are three connected subtle issues:
1) The fast path didn't correctly handle the case where the decoder
   requests more data. This caused a bogus additional replacement
   sequence to be outputted when encountering an incomplete sequence at
   the edges of a buffer.
2) The finishing of decoding incorrectly assumed that the fast path
   cannot be in a state where the last few bytes were an incomplete
   sequence, but this is not true as shown by test 08.
3) The finishing of decoding could output bytes twice because it called
   into dom_process_parse_chunk() twice without clearing the decoded
   data. However, calling twice is not even necessary as the entire
   buffer cannot be filled up entirely.

Closes GH-16226.
2024-10-05 18:27:18 +02:00
Christoph M. Becker
0b757be7cc
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Mention AVX(2) detection fix for MSVC in UPGRADING
2024-10-05 17:40:06 +02:00
Christoph M. Becker
9939a990fb
[skip ci] Mention AVX(2) detection fix for MSVC in UPGRADING
This is likely more important than the possibility to build for AVX-512
since our official binaries have build time support for SSE2 only.  So
proper detection of AVX may make a huge performance difference for
`base64_*()` and some MBString functionality.

Closes GH-16248.
2024-10-05 17:39:39 +02:00
Gina Peter Banyard
7f4a1275ab
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Cirrus CI: Skip on doc changes
2024-10-05 13:20:15 +01:00
Gina Peter Banyard
5ddc8f71fa
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [skip ci] Cirrus CI: Skip on doc changes
2024-10-05 13:19:14 +01:00
Niels Dossche
3d3c192666
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16237: Segmentation fault when cloning SoapServer
2024-10-05 14:14:28 +02:00
Niels Dossche
70203c7781
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16237: Segmentation fault when cloning SoapServer
2024-10-05 14:14:20 +02:00
David Carlier
671200ac95
Merge branch 'PHP-8.4' 2024-10-05 13:10:18 +01:00
David Carlier
cb044174a7
Merge branch 'PHP-8.3' into PHP-8.4 2024-10-05 13:09:57 +01:00
Gina Peter Banyard
e01cde7b1b ext/ldap: Pass a HashTable directly to parse individual control
Rename function to not have a leading "_" at the same time
2024-10-05 12:48:59 +01:00
Gina Peter Banyard
d7f946d28b ext/ldap: Use bool instead of int 2024-10-05 12:48:59 +01:00
Gina Peter Banyard
f60487821d ext/ldap: Remove an unnecessary duplication 2024-10-05 12:48:59 +01:00
Gina Peter Banyard
636b6a1a59 ext/ldap: Parse attribute value via new API in do_modify
Add a new API to free a zend_string via its char*
2024-10-05 12:48:59 +01:00
Gina Peter Banyard
495837bfa9 ext/ldap: Add API parsing zval to LDAP value 2024-10-05 12:48:59 +01:00
David Carlier
9709887815
Merge branch 'PHP-8.4' 2024-10-05 11:35:57 +01:00
David Carlier
215c61f9c7
Merge branch 'PHP-8.3' into PHP-8.4 2024-10-05 11:34:59 +01:00
David Carlier
3b9676762b
Merge branch 'PHP-8.4' 2024-10-05 10:48:08 +01:00
David Carlier
71e5d77f39
Merge branch 'PHP-8.3' into PHP-8.4 2024-10-05 10:47:36 +01:00
Yuya Hamada
4ac65b4c6b Merge branch 'PHP-8.4' 2024-10-05 18:29:39 +09:00
Yuya Hamada
f815310c98 Merge branch 'PHP-8.3' into PHP-8.4 2024-10-05 18:28:43 +09:00
Niels Dossche
b9aaef46ec
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] UPGRADING: mention SID deprecation (#16238)
2024-10-05 10:54:41 +02:00
Juliette
820037d0e0
[skip ci] UPGRADING: mention SID deprecation (#16238)
Refs: https://wiki.php.net/rfc/deprecate-get-post-sessions / PR 13578

Co-authored-by: jrfnl <jrfnl@users.noreply.github.com>
2024-10-05 10:54:05 +02:00
Niels Dossche
5ffe6f1644
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16187: ReflectionClass::__toString() with packed properties hash table
2024-10-05 10:21:30 +02:00
Niels Dossche
6631aa9cc3
Merge branch 'PHP-8.3' into PHP-8.4 2024-10-05 10:20:49 +02:00
Niels Dossche
ed8d6b5b25
Merge branch 'PHP-8.4'
* PHP-8.4:
  Use standard error message for stack limit in serialize()
2024-10-04 20:10:04 +02:00
Niels Dossche
612a6ad0af
Use standard error message for stack limit in serialize()
With GH-16204 merged, we can use the standard error message for the
recently-merged GH-16159.

Closes GH-16225.
2024-10-04 20:09:45 +02:00
Christoph M. Becker
bb3a3d025b
[skip ci] Don't build bless_tests.patch (GH-16224)
The bless_tests.patch had been introduced via PR #7204, but is no
longer available due to PR #11566.  Since apparently the patch is not
that helpful, we remove the code which generates it.
2024-10-04 18:22:52 +02:00
DanielEScherzer
2501cad25a
Stubs and generated arginfo: remove tentative returns from final methods (#16213)
A tentative return type is used to allow userland code that overrides a method
to not include a typehint without a fatal error; this is inapplicable to final
methods (including all methods of final classes), which cannot be overridden.
Remove the tentative return declarations, and update the build script to
complain about future additions.
2024-10-04 07:43:59 +02:00
David Carlier
c8791e5581
Merge branch 'PHP-8.4' 2024-10-03 22:46:50 +01:00
David Carlier
139accecb4
Merge branch 'PHP-8.3' into PHP-8.4 2024-10-03 22:46:02 +01:00
Christoph M. Becker
e3bcbb26b6
Merge branch 'PHP-8.4'
* PHP-8.4:
  Declare zend_call_stack_size_error() as ZEND_API
2024-10-03 22:47:26 +02:00
Christoph M. Becker
6f7f32c330
Declare zend_call_stack_size_error() as ZEND_API
This is necessary at least on Windows to be able to actually call the
function from a different module (in this case php8phpdbg.dll could not
be build).

Closes GH-16204.
2024-10-03 22:46:53 +02:00
Niels Dossche
0624eb4118
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16184: UBSan address overflowed in ext/pcre/php_pcre.c
2024-10-03 21:13:13 +02:00
Niels Dossche
5839fc5dd9
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16184: UBSan address overflowed in ext/pcre/php_pcre.c
2024-10-03 21:12:42 +02:00
David CARLIER
dbcc77d0c2
Fix GH-15893: Pdo\Pgsql backport fixes from GH-16124 (#16158) 2024-10-03 19:25:39 +01:00
Niels Dossche
8a6de2ca14
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix bugs GH-16150 and GH-16152: intern document mismanagement
2024-10-03 19:33:15 +02:00
Niels Dossche
ba0834bc2c
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix bugs GH-16150 and GH-16152: intern document mismanagement
2024-10-03 19:33:09 +02:00
Niels Dossche
807a74a7ac
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16190: Using reflection to call Dom\Node::__construct causes assertion failure
2024-10-03 19:26:14 +02:00
Niels Dossche
3be6ff66b8
Fix GH-16190: Using reflection to call Dom\Node::__construct causes assertion failure
Closes GH-16193.
2024-10-03 19:25:58 +02:00
Gina Peter Banyard
2609127acb
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] UPGRADING: Move more stuff to the correct place
2024-10-03 17:50:40 +01:00
Gina Peter Banyard
96ae694a4f
[skip ci] UPGRADING: Move more stuff to the correct place
Closes GH-16201
2024-10-03 17:50:21 +01:00
Christoph M. Becker
850a5a49ee
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16199: GREP_HEADER() is broken
2024-10-03 18:33:37 +02:00
Peter Kokot
e915ed75ea
Fix GH-16199: GREP_HEADER() is broken
This also fixes the libxml version check when the libxml/xmlversion.h
is located elsewhere than libxml2 include directory.

Closes GH-15619.
2024-10-03 18:33:17 +02:00
Christoph M. Becker
d7f09eb0ed
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Fix UPGRADING entries (#16176)
2024-10-03 18:32:33 +02:00
Gina Peter Banyard
50dfc436cd
[skip ci] Fix UPGRADING entries (#16176)
* [skip ci] Fix UPGRADING entries

* [skip ci] Add DBA new class
2024-10-03 16:14:33 +01:00
Arnaud Le Blanc
2d8a93cbb6
Merge branch 'PHP-8.4'
* PHP-8.4:
  [ci skip] NEWS for GH-16055
  Support stack limit in phpdbg SAPI
2024-10-03 15:25:57 +02:00
Arnaud Le Blanc
7c31e5f9e6
[ci skip] NEWS for GH-16055 2024-10-03 15:25:29 +02:00
Arnaud Le Blanc
443aa29dbe
Support stack limit in phpdbg SAPI
Fixes GH-16041
Closes GH-16055
2024-10-03 15:22:51 +02:00
Arnaud Le Blanc
8b41bca615
Merge branch 'PHP-8.4'
* PHP-8.4:
  [ci skip] NEWS for GH-15960
  Deny resetting an object as lazy during property iteration
  Ensure to initialize lazy object in foreach
  Do not null out obj->properties when resetting object
  Fix handling of undef property during foreach by ref on hooked class
2024-10-03 15:14:08 +02:00
Arnaud Le Blanc
e02e6be633
[ci skip] NEWS for GH-15960 2024-10-03 15:13:42 +02:00
Arnaud Le Blanc
c9dfb77446
Deny resetting an object as lazy during property iteration
Supporting object reset while its properties are being iterated would increase
complexity for little benefit. Furthermore it may not be possible to ensure a
consistent behavior between ghosts and proxies (wrt to iteration position).

Iteration is detected by checking if the object's properties ht has iterators.
This requires refactoring the hooked get_iterator() implementation to ensure
that it creates a properties ht iterator immediately.

Closes GH-15960
2024-10-03 15:12:21 +02:00
Arnaud Le Blanc
3151117987
Ensure to initialize lazy object in foreach
foreach() by-passes the get_properties() handler and did not always trigger
initialization.
2024-10-03 15:12:21 +02:00
Arnaud Le Blanc
52fec6958c
Do not null out obj->properties when resetting object
Engine expects the properties ht to be separated, assigned a new ht, or resized,
but never to be nulled.
2024-10-03 15:12:21 +02:00
Arnaud Le Blanc
4d7fcea5da
Fix handling of undef property during foreach by ref on hooked class 2024-10-03 15:12:21 +02:00
Christoph M. Becker
57c4b941b7
Always exclude dl_test from test php.ini (GH-16098)
The dl_test extension is not supposed to be loaded via php.ini
settings, so we exclude it from the typical case on Windows where
`--enable-test-ini` is enabled by `--enable-snapshot-build`.
2024-10-03 14:35:12 +02:00
David Carlier
95fa39dce8
Merge branch 'PHP-8.4' 2024-10-03 12:49:42 +01:00
David Carlier
f5d4781ee0
Merge branch 'PHP-8.3' into PHP-8.4 2024-10-03 12:48:46 +01:00
Christoph M. Becker
3e9f2fa071
Avoid dl() in run-tests.php (GH-16126)
Prior to running the tests, the test runner checks for all generally
available extensions; it does this by scanning the `extension_dir` for
files matching the typical extension pattern, but verifies that the
file is actually a PHP extension by calling `dl()`.  However, `dl()`
has known issues[1].  On Windows CI we always get an ugly "zend_mm_heap
corrupted" message, and we even can't `dl()` ext/mysql when OPcache is
enabled[2].  So we better avoid the double-check with `dl()`, which is
unlikely to be necessary anyway.

[1] <https://github.com/php/php-src/issues/9196>
[2] <https://github.com/php/php-src/issues/8508>
2024-10-03 12:58:27 +02:00
Christoph M. Becker
fbfc89944d
x86 builds on Windows are warning level 1 clean (GH-16170)
The only issue that was left was due to the old build of net-snmp 5.7.3; since updating to net-snmp 5.9.4, this is resolved.

The patch has originally been provided by @mvorisek.
2024-10-03 12:55:42 +02:00
Christoph M. Becker
2f09c0ed0f
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16181: phpdbg: exit in exception handler reports fatal error
2024-10-03 11:39:34 +02:00
Christoph M. Becker
3c1af3febb
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16181: phpdbg: exit in exception handler reports fatal error
2024-10-03 11:39:03 +02:00
Niels Dossche
c77a1291d6
Don't use recursion when transferring a DOM internal document pointer (#16180)
Recursion is typically slower than iteration, and furthermore, this can
cause problems in theory with deep trees.
2024-10-03 07:56:12 +02:00
DanielEScherzer
8b8a6733d1
ext/reflection: fix some typos [skip ci] (#16183) 2024-10-03 07:55:25 +02:00
Gina Peter Banyard
524f6dfb19 ext/ldap: Use zend_string_equals() API 2024-10-02 23:22:34 +01:00
Gina Peter Banyard
355f320a27 ext/ldap: Use HashTable* for controls 2024-10-02 23:22:34 +01:00
Niels Dossche
a165f1fffc
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-15169: stack overflow when var serialization in ext/standard/var
2024-10-02 21:32:50 +02:00
Niels Dossche
577eb68212
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-15169: stack overflow when var serialization in ext/standard/var
2024-10-02 21:32:20 +02:00
Dmitry Stogov
3f913c123a
Implement JIT for ZEND_FETCH_STATIC_PROP_* and improve interpretation (#16157)
* Implement JIT for ZEND_FETCH_STATIC_PROP_* and improve interpretation

* Revert incorrect change

* Use FASTCALL calling convention

* Use EMPTY_SWITCH_DEFAULT_CASE

* Move the loading of the property info into zend_jit_uninit_static_prop()
2024-10-02 21:02:33 +03:00
Dmitry Stogov
83bbf4b339
Merge branch 'PHP-8.4'
* PHP-8.4:
  Improve JIT TRACE coverage (#16171)
2024-10-02 19:27:52 +03:00
Dmitry Stogov
ddc49153f1
Improve JIT TRACE coverage (#16171)
Now it's possible that PHP tracing JIT loses some parts of the "hot"
code. In case we have a root LOOP trace with an inlined call of some
function, and we get a SIDE exit inside that function - we recorded a
side trace, but finished it a the RETURN of the inlined function. As
result the opcodes betwee RETURN from SIDE trace and LOOP exit were not
covered by tracer and were executed in interpreter.

This patch introduces a "ret_depth" argument that prevents stopping
tracing on RETURN of such SIDE trace.
2024-10-02 19:27:31 +03:00
Gina Peter Banyard
d7bdf902e5
ext/phar: Remove phar_resolve_alias() (#15860)
As this is unused and a SourceGraph search returns 0 result
2024-10-02 15:44:05 +01:00
Arnaud Le Blanc
e504df830c
Merge branch 'PHP-8.4'
* PHP-8.4:
  [ci skip] NEWS for GH-16061
  Fix array_merge_recursive(): convert_to_array() may need separation (#16061)
2024-10-02 12:44:10 +02:00
Arnaud Le Blanc
3952a8f9f1
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [ci skip] NEWS for GH-16061
  Fix array_merge_recursive(): convert_to_array() may need separation (#16061)
2024-10-02 12:44:00 +02:00
Arnaud Le Blanc
141c0d7532
Merge branch 'PHP-8.4'
* PHP-8.4:
  [ci skip] NEWS for GH-16061
  [ci skip] NEWS for GH-16061
  [ci skip] NEWS for GH-16061
2024-10-02 12:41:52 +02:00
Arnaud Le Blanc
ca8888ab96
[ci skip] NEWS for GH-16061 2024-10-02 12:39:53 +02:00
Arnaud Le Blanc
3d7be28a24
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [ci skip] NEWS for GH-16061
  [ci skip] NEWS for GH-16061
2024-10-02 12:39:22 +02:00
Arnaud Le Blanc
6b207c65d6
Merge branch 'PHP-8.4'
* PHP-8.4:
  [ci skip] NEWS for GH-16025
  [ci skip] NEWS for GH-16025
  [ci skip] NEWS for GH-16025
  Fix assertion failure in generator dtor (#16025)
2024-10-02 12:34:45 +02:00
Arnaud Le Blanc
cd64780764
[ci skip] NEWS for GH-16025 2024-10-02 12:34:37 +02:00
Arnaud Le Blanc
bc317d3afc
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [ci skip] NEWS for GH-16025
  [ci skip] NEWS for GH-16025
  Fix assertion failure in generator dtor (#16025)
2024-10-02 12:33:06 +02:00
Arnaud Le Blanc
dbec59166f
Merge branch 'PHP-8.4'
* PHP-8.4:
  [ci skip] NEWS for GH-16004
  Fix use-after-free during lazy object initialization (#16004)
2024-10-02 12:16:44 +02:00
Arnaud Le Blanc
e4335baf8b
[ci skip] NEWS for GH-16004 2024-10-02 12:16:35 +02:00
Arnaud Le Blanc
ab72fbadd9
Fix use-after-free during lazy object initialization (#16004) 2024-10-02 12:15:36 +02:00
Arnaud Le Blanc
dd063b3a02
Merge branch 'PHP-8.4'
* PHP-8.4:
  [ci skip] NEWS for GH-16026
  Fix reuse of dtor fiber during shutdown (#16026)
2024-10-02 12:12:49 +02:00
Arnaud Le Blanc
4512a8fe4f
[ci skip] NEWS for GH-16026 2024-10-02 12:12:29 +02:00
Arnaud Le Blanc
d093c10caf
Fix reuse of dtor fiber during shutdown (#16026) 2024-10-02 12:11:10 +02:00
Niels Dossche
f1b41d790d
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16151: Assertion failure in ext/dom/parentnode/tree.c
2024-10-01 21:48:12 +02:00
Niels Dossche
341c26fc3f
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16151: Assertion failure in ext/dom/parentnode/tree.c
2024-10-01 21:47:52 +02:00
Niels Dossche
921a1e3dc1
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16149: Null pointer dereference in DOMElement->getAttributeNames()
2024-10-01 21:04:22 +02:00
Niels Dossche
853322faab
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16149: Null pointer dereference in DOMElement->getAttributeNames()
2024-10-01 21:03:31 +02:00
Gina Peter Banyard
e8e4d36bc9 ext/ldap: Rename variable and move closer to usage site 2024-10-01 19:57:47 +01:00
Gina Peter Banyard
0733e90c7f ext/ldap: Check that array key is not empty 2024-10-01 19:57:47 +01:00
Gina Peter Banyard
72ee812e2a ext/ldap: Check array key does not have any nul bytes 2024-10-01 19:57:47 +01:00
Gina Peter Banyard
d34d015078 ext/ldap: Promote warning to ValueError if array is not a dict 2024-10-01 19:57:47 +01:00
Gina Peter Banyard
127968b1e4 ext/ldap: Refactor loop to a HASH_FOREACH loop 2024-10-01 19:57:47 +01:00
Gina Peter Banyard
34e9d9ee41 ext/ldap: Zero out arrays and traverse them as NULL terminated list 2024-10-01 19:57:47 +01:00
Gina Peter Banyard
304a514863 ext/ldap: Use HASH_FOREACH macro 2024-10-01 19:57:47 +01:00
Gina Peter Banyard
8a9aa08de7 ext/ldap: Reduce scope of variables 2024-10-01 19:57:47 +01:00
Gina Peter Banyard
db57561479 ext/ldap: Check that attribute values is a list before traversal 2024-10-01 19:57:47 +01:00
Gina Peter Banyard
9e91810807 ext/ldap: Ensure list of attribute values is not empty 2024-10-01 19:57:47 +01:00
Gina Peter Banyard
09ffa28224 ext/ldap: Handle attribute => value case directly 2024-10-01 19:57:47 +01:00
Gina Peter Banyard
08bf506953 ext/ldap: php_ldap_do_modify() throw ValueError when entries array is empty 2024-10-01 19:57:47 +01:00
Gina Peter Banyard
3a2a86b525 ext/ldap: Add tests for php_ldap_do_modify()
And also amend some existing tests which would duplicate coverage
2024-10-01 19:57:47 +01:00
David Carlier
e609a21906
ext/pgsql: pgsql_copy_from to support iterable.
inspired from the Pdo\Pgsql new feature GH-15893.

close GH-16124
2024-10-01 19:53:20 +01:00
Christoph M. Becker
62a1eb9d68
[skip ci] Re-enable nightly redis build (GH-16118)
* Re-enable nightly redis build (that should pass again)
* Disable Xdebug for now (it currently fails already during configure for PHP >= 8.5.0)
2024-10-01 16:37:39 +02:00
Christoph M. Becker
b4dbd15386
Merge branch 'PHP-8.4'
* PHP-8.4:
  [ci skip] Skip test under ASAN
2024-10-01 14:02:46 +02:00
Christoph M. Becker
783d388f78
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [ci skip] Skip test under ASAN
2024-10-01 14:02:24 +02:00
Gina Peter Banyard
a6d111ff2a
Merge branch 'PHP-8.4'
* PHP-8.4:
  NEWS entries for LDAP bug fixes
  ext/ldap: Fix GH-16136 (Memory leak in php_ldap_do_modify())
  ext/ldap: Fix GH-16132 (Freeing pointer not allocated by ZMM)
2024-09-30 22:24:45 +01:00
Gina Peter Banyard
747860ccf0
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  NEWS entries for LDAP bug fixes
  ext/ldap: Fix GH-16136 (Memory leak in php_ldap_do_modify())
  ext/ldap: Fix GH-16132 (Freeing pointer not allocated by ZMM)
2024-09-30 22:24:39 +01:00
Gina Peter Banyard
98a4c53ad5
sapi/apache2handler/php_functions.c: No need to rely on argnum (#16143) 2024-09-30 22:09:17 +01:00
Niels Dossche
acf1a6cfa0
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix typo
2024-09-30 23:05:38 +02:00
Niels Dossche
bf1021c1a8
Fix typo 2024-09-30 23:05:30 +02:00
Niels Dossche
c65bb64cba
Merge branch 'PHP-8.4'
* PHP-8.4:
  [ci skip] Skip test under ASAN
2024-09-30 22:46:12 +02:00
Niels Dossche
1d0fb36681
[ci skip] Skip test under ASAN 2024-09-30 22:46:05 +02:00
Niels Dossche
bfa728538f
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix small typo in UPGRADING (#16141)
2024-09-30 21:43:01 +02:00
Chris Brown
d83a7a9fb1
Fix small typo in UPGRADING (#16141) 2024-09-30 21:42:21 +02:00
Niels Dossche
494aa65f24
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-15168: stack overflow in json_encode()
2024-09-30 20:43:39 +02:00
Niels Dossche
95d691ae00
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-15168: stack overflow in json_encode()
2024-09-30 20:43:32 +02:00
Niels Dossche
daa94cf279
Implement request #30622: make $namespace parameter functional
This parameter never actually did anything and was forgotten about.
We solve this by detecting when we have a $namespace argument
(that won't conflict with the name argument) and creating a Clark
notation name out of it.

Closes GH-16123.
2024-09-30 20:34:51 +02:00
Niels Dossche
f5e81fe182
Optimize in-memory XMLWriter
We're currently using a libxml buffer, which requires copying the buffer
to zend_strings every time we want to output the string. Furthermore,
its use of the system allocator instead of ZendMM makes it not count
towards the memory_limit and hinders performance.

This patch adds a custom writer such that the strings are written to a
smart_str instance, using ZendMM for improved performance, and giving
the ability to not copy the string in the common case where flush has
empty set to true.

Closes GH-16120.
2024-09-30 20:30:03 +02:00
Niels Dossche
63e0b9ccbf
Fix #49169: SoapServer calls wrong function, although "SOAP action" header is correct
Although the original reproducer no longer exists, I was able to cook up
something similar.
The problem is that there are two ways ext-soap currently looks up
functions:
1) By matching the exact function name; but this doesn't work if the
   function name is not in the body.
2) By matching the parameter names.

Neither of these work when we don't have the function name in the body,
and when the parameter names are not unique. That's where we can use the
"SOAPAction" header to distinguish between different actions. This header
should be checked first and be matched against the "soapAction"
attribute in the WSDL. We keep the existing fallbacks such that the
chance of a BC break is minimized.
Note that since #49169 a potential target namespace is ignored right
now.

Closes GH-15970.
2024-09-30 20:14:34 +02:00
Niels Dossche
6cf467cc9f
Soap: Document how the current lookup functions work 2024-09-30 20:14:10 +02:00
Niels Dossche
f538319263
Soap: Split up an if condition into a nested if
This is in preparation for adding functionality in later commits.
2024-09-30 20:14:10 +02:00
David Carlier
9e6774d043
Merge branch 'PHP-8.4' 2024-09-30 18:11:38 +01:00
David Carlier
4ad12bdd2d
Merge branch 'PHP-8.3' into PHP-8.4 2024-09-30 18:11:25 +01:00
Christoph M. Becker
d54b7c7078
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix nightly builds regarding libavif
2024-09-30 18:51:56 +02:00
Christoph M. Becker
258088310a
Fix nightly builds regarding libavif
Currently, we're running LINUX_X64 Asan builds on ubuntu-20.04, where
libavif-dev is not available, so apt-x64 fails.  This PR is a follow up
to PR #16049 to pass the respective parameter to apt-x64, and to fix
the conditional check in configure-x64.

It might be clearer to just have an `avif` parameter or to pass the
runner version to these actions, but this should do for now.

Closes GH-16130.
2024-09-30 18:51:30 +02:00
Tim Düsterhus
624d0a89ae
Merge branch 'PHP-8.4'
* PHP-8.4:
  reflection: Fix the return value of ReflectionFunction::{getNamespaceName,inNamespace}() for closures (#16129)
2024-09-30 16:34:55 +02:00
Tim Düsterhus
a1cc091808
reflection: Fix the return value of ReflectionFunction::{getNamespaceName,inNamespace}() for closures (#16129)
* reflection: Fix the return value of ReflectionFunction::{getNamespaceName,inNamespace}() for closures

Fixes GH-16122

* reflection: Clean up implementation of `ReflectionFunctionAbstract::inNamespace()`

* reflection: Clean up implementation of `ReflectionFunctionAbstract::getNamespaceName()`
2024-09-30 16:33:46 +02:00
DanielEScherzer
7a8b1f683b
Generated arginfo header files: use known strings for prop names when… (#15751)
Instead of allocating, using, and then releasing a zend_string for every
property name unconditionally, only do so when the minimum supported version of
PHP does not have that string in its known strings (ZEND_KNOWN_STRINGS). If the
string is already known, just use the known version directly. This is already
done for some non-generated class registrations, e.g. in
`zend_enum_register_props()`.
2024-09-30 13:22:34 +02:00
Gina Peter Banyard
52b514bf62
ext/ldap: Fix references for ldap_modify_batch() (#16121)
Because I don't know how references work in PHP
2024-09-30 11:27:56 +01:00
Gina Peter Banyard
d87711b9f4 ext/ldap: Print correct type 2024-09-30 11:27:40 +01:00
Gina Peter Banyard
415d93eda2 ext/ldap: Remove unnecessary copy
I am faily certain this was just leaking memory
2024-09-30 11:27:40 +01:00
Gina Peter Banyard
5e2c179d8d ext/ldap: Use HASH_FOREACH macro to traverse array 2024-09-30 11:27:40 +01:00
Gina Peter Banyard
491fab0a28 ext/ldap: Improve validation of inputs for parallel search 2024-09-30 11:27:40 +01:00
Gina Peter Banyard
29a77e56f6 ext/ldap: Refactor validation of attributes array for php_ldap_do_search() 2024-09-30 11:27:40 +01:00
Niels Dossche
bca73f1c69
[ci skip] Fix typo 2024-09-29 19:33:47 +02:00
David Carlier
1da352c367
ext/pgsql: adding pg_close_stmt.
up to postgresql 17, when done with a prepared statement, we could
release it with DEALLOCATE sql command which is fine ; until we want
to implement a cache solution based on statement ids.

Since PostgreSQL 17, PQclosePrepared uses internally the `close` protocol
allowing to reuse the statement name while still freeing it.
Since the close protocol implementation had been added on libpq within
this release, no way to reimplement it.

close GH-14584
2024-09-29 16:26:35 +01:00
Gina Peter Banyard
291eef285c
ext/exif: Minor refactoring of exif_thumbnail() (#16111) 2024-09-29 15:57:04 +01:00
KentarouTakeda
fec2055af2
test(pdo_firebird): Fix the dummy server running on localhost to IPv4 (#16115) 2024-09-29 12:43:34 +02:00
Niels Dossche
e82b3b2dd5
Remove non-sensical checks from firebird (#16114)
These conditions are always true because they are arrays that are
address-taken, i.e. their addresses will never be NULL.
2024-09-29 11:31:25 +02:00
Guillaume Outters
68537fd9f4
Fix / implement GH-15287: add a lazy fetch to Pdo\PgSql
Make Pdo\PgSql accept Pdo::setAttribute(PDO::ATTR_PREFETCH, 0) to enter libpq's single row mode.
This avoids storing the whole result set in memory before being able to call the first fetch().

close GH-15750
2024-09-29 08:33:14 +01:00
KentarouTakeda
6fb81d2360
test(pdo_pgsql): Exclude pdo implicitly required by pdo_pgsql from EXTENSIONS (#16116) 2024-09-29 08:20:29 +01:00
Christoph M. Becker
d8cee06073
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix potential parallel test conflicts
2024-09-29 02:13:38 +02:00
Christoph M. Becker
ebee8df27e
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix potential parallel test conflicts
2024-09-29 02:13:06 +02:00
Gina Peter Banyard
d4c88a299b
ext/bz2: Check int params of bzcompress() are correct (#16108)
Also add a TODO to check the length of the source strings
2024-09-28 22:38:53 +01:00
Gina Peter Banyard
4a8cd31d51
ext/odbc: There is no need to rely on ZEND_NUM_ARGS() (#16106) 2024-09-28 21:31:42 +01:00
Máté Kocsis
dcbba04d38
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix property_exists() and unset() for XMLReader (#16079)
2024-09-28 21:09:06 +02:00
Máté Kocsis
f4f2fe51cd
Fix property_exists() and unset() for XMLReader (#16079) 2024-09-28 21:08:47 +02:00
Gina Peter Banyard
8d1a791ed5
Merge branch 'PHP-8.4'
* PHP-8.4:
  ext/ldap: Fix GH-16101 (Segfaults in php_ldap_do_search() when LDAPs is not a list)
2024-09-28 19:55:01 +01:00
Gina Peter Banyard
16b272da14
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  ext/ldap: Fix GH-16101 (Segfaults in php_ldap_do_search() when LDAPs is not a list)
2024-09-28 19:54:40 +01:00
Niels Dossche
6674213a88
Remove dead code in fpm of redirect_status (#16090)
This is a feature copied from the CGI SAPI, but since cgi is always 0 in
fpm, this code is dead. Similarly, the INI settings related to this are
no longer used after removing this dead code.
2024-09-28 17:50:53 +02:00
Jakub Zelenka
40f23d124b
Merge branch 'PHP-8.4' 2024-09-28 16:29:37 +01:00
Jakub Zelenka
e05121563f
Merge branch 'PHP-8.3' into PHP-8.4 2024-09-28 16:29:18 +01:00
Gina Peter Banyard
30bc98ce0a ext/ldap: Merge loops together 2024-09-28 14:26:21 +01:00
Gina Peter Banyard
d3e65d548e ext/ldap: Throw a ValueError when passing an unknown option 2024-09-28 14:26:21 +01:00
Gina Peter Banyard
18fca34ef3 ext/ldap: Improve type check for option value 2024-09-28 14:26:21 +01:00
Gina Peter Banyard
b79866d01a ext/ldap: Refactor ldap_parse_result() to not rely on argnum 2024-09-28 14:26:21 +01:00
Gina Peter Banyard
980ffffbdc ext/ldap: Refactor ldap_parse_exop() to not rely on argnum 2024-09-28 14:26:21 +01:00
Gina Peter Banyard
2b92e26267 ext/ldap: Refactor ldap_exop_passwd() to not rely on argnum 2024-09-28 14:26:21 +01:00
Christoph M. Becker
d812c96456
Fix pdoodbc_002.phpt to not try to load PDO_odbc (GH-16096)
In the `--EXTENSIONS--` section, names of extension are handled case-
sensitively.
2024-09-28 15:12:08 +02:00
David Carlier
d00dd2b4b5
ext/random: haiku supports arc4random api too.
close GH-16095
2024-09-28 13:20:14 +01:00
Niels Dossche
f1c4736f67
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix bogus fallthrough path in firebird_handle_get_attribute(), again
2024-09-28 13:20:40 +02:00
Niels Dossche
b21d2ca93b
Fix bogus fallthrough path in firebird_handle_get_attribute(), again
This reapplies b8e9c5ba6a after it was accidentally removed via
225034dbbc.
2024-09-28 13:19:33 +02:00
Tim Düsterhus
380f854852
random: Do not use ZVAL_DUP in Randomizer::shuffleArray() (#16072)
PHP Internals Book says:

> The ZVAL_DUP macro is similar to ZVAL_COPY, but will duplicate arrays, rather
> than just incrementing their refcount. If you are using this macro, you are
> almost certainly doing something very wrong.

Replace this by an explicit call to `zend_array_dup()`, as done in
`php_array_diff()`. Besides being more explicit in what is happening, this
likely also results in better assembly.
2024-09-28 13:16:40 +02:00
武田 憲太郎
7f5e96d030
ext/pdo_pgsql: Expanding COPY input from an array to an iterable
close GH-15893
2024-09-28 11:09:34 +01:00
Gina Peter Banyard
332e9a47ae
ext/ldap: Use "p" ZPP specifier for all strings that must be null terminated (#16091) 2024-09-28 00:15:34 +01:00
Máté Kocsis
181ea64cda
Reduce memory overhead of DatePeriod via virtual properties (#15598)
Related to https://github.com/php/php-src/issues/11644 and https://github.com/php/php-src/issues/13988
2024-09-27 22:54:40 +02:00
Gina Peter Banyard
8b0933b610 ext/ldap: Move server controls check prior to allocating modifications 2024-09-27 19:38:14 +01:00
Gina Peter Banyard
5300f38b75 ext/ldap: Remove unnecessary scoping 2024-09-27 19:38:14 +01:00
Gina Peter Banyard
647c24fb86 ext/ldap: Refactor traversal of modification values 2024-09-27 19:38:14 +01:00
Gina Peter Banyard
21955a9a8d ext/ldap: Refactor looping of modifications array 2024-09-27 19:38:14 +01:00
Gina Peter Banyard
8188e64223 ext/ldap: Refactor execution of batch command 2024-09-27 19:38:14 +01:00
Gina Peter Banyard
0c7d85d173 ext/ldap: Use EMPTY_SWITCH_DEFAULT_CASE(); 2024-09-27 19:38:14 +01:00
Gina Peter Banyard
cf043af8fc ext/ldap: Refactor verification of modification entry 2024-09-27 19:38:14 +01:00
Gina Peter Banyard
3af914d858 ext/ldap: Fetch the values directly via hash API 2024-09-27 19:38:14 +01:00
Gina Peter Banyard
d3dbcefcc8 ext/ldap: Join declaration and assignments
Rename some of the variables
This also reduces the scope of some of these variables
2024-09-27 19:38:14 +01:00
Gina Peter Banyard
0a39b48acc ext/ldap: Use zend_array_is_list() API to check "values" array 2024-09-27 19:38:14 +01:00
Gina Peter Banyard
6f50850e76 ext/ldap: Use zend_*_has_nul_byte() APIs
And also make them throw ValueErrors instead of TypeErrors
2024-09-27 19:38:14 +01:00
Gina Peter Banyard
30b44f534a [skip ci] ext/ldap: Clean-up comment 2024-09-27 19:38:14 +01:00
Gina Peter Banyard
7c8fea9ce0 ext/ldap: Add test for reference in modification array 2024-09-27 19:38:14 +01:00
Gina Peter Banyard
25b631d72b ext/ldap: Add test cases for (Value|Type)Errors in ldap_modify_batch() 2024-09-27 19:38:14 +01:00
Christoph M. Becker
ee3e10af78
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix failing soap tests on Windows
2024-09-27 19:59:55 +02:00
Christoph M. Becker
e014b5f506
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix failing soap tests on Windows
2024-09-27 19:59:30 +02:00
Ilija Tovilo
87e79153c6
[skip ci] Improve test description 2024-09-27 17:39:51 +02:00
Ilija Tovilo
a58df54bc4
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix printing backtrace of fake generator frame
2024-09-27 17:37:14 +02:00
Ilija Tovilo
bc07a8a28a
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix printing backtrace of fake generator frame
2024-09-27 17:37:07 +02:00
Christoph M. Becker
825509ee9e
Drop superfluous LONG_MAX/LONG_MIN fallback definitions (GH-15667)
Both macros are supposed to be defined in limits.h (C99) and as such it
is superfluous to provide fallback definitions.  Even worse, because
these fallback definitions didn't cater to LP64, ILP64 and SILP64 data
models (and maybe some rather uncommon ones), but just assumed ILP32,
they are confusing.
2024-09-27 17:34:54 +02:00
Ilija Tovilo
2bc3df8196
Merge branch 'PHP-8.4'
* PHP-8.4:
  Reduce regex backtracking in phpinfo.phpt
2024-09-27 17:11:05 +02:00
Ilija Tovilo
28d88c72bc
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Reduce regex backtracking in phpinfo.phpt
2024-09-27 17:10:58 +02:00
Arnaud Le Blanc
4252545064
Remove phpdbg binary during make clean (#16085) 2024-09-27 16:24:17 +02:00
Ilija Tovilo
dd8af18d7a
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Bump required C standard to C11
2024-09-27 12:37:48 +02:00
Ilija Tovilo
631bab42dd
[skip ci] Bump required C standard to C11
Closes GH-16078
2024-09-27 12:37:20 +02:00
Máté Kocsis
b32a941b8e
Make a few xmlreader property handlers static 2024-09-26 23:47:20 +02:00
Máté Kocsis
5070fbf161
Some tidying-up related to property existence checks 2024-09-26 22:36:22 +02:00
Gina Peter Banyard
1f14d58c72 ext/phar: Remove unnecessary memory duplication for phar_make_dirstream()
And also pass in the known string length
2024-09-26 21:36:03 +01:00
Gina Peter Banyard
b581e8e6d0 ext/phar: Use HASH_FOREACH macro in phar_make_dirstream()
Also simplify and refactor the inside of the loop
2024-09-26 21:36:03 +01:00
Gina Peter Banyard
c74f1bebc6 ext/phar: Prevent duplicate strlen() computation in phar_wrapper_open_dir() 2024-09-26 21:36:03 +01:00
Gina Peter Banyard
a600713cd6 ext/phar: Use HASH_FOREACH macro in phar_wrapper_open_dir()
Also simplify the inner if condition
2024-09-26 21:36:03 +01:00
Gina Peter Banyard
615960be9c ext/phar: Refer to zend_string* length directly
This makes it more obvious that the host_len is that of resource->host
2024-09-26 21:36:03 +01:00
Gina Peter Banyard
839952c65a ext/phar: Use HASH_FOREACH macro in phar_wrapper_rmdir()
Also simplify the inner if condition
2024-09-26 21:36:03 +01:00
Ilija Tovilo
d21bc7f1e6
Disallow enums in ArrayObject
Closes GH-15775
2024-09-26 22:21:09 +02:00
Ilija Tovilo
20e3692a8c
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix failed assertion when promoting Serialize deprecation to exception
2024-09-26 22:03:38 +02:00
Ilija Tovilo
756435a50c
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix failed assertion when promoting Serialize deprecation to exception
2024-09-26 22:03:30 +02:00
Ben Ramsey
91a07e7b75
Merge branch 'PHP-8.4' 2024-09-26 14:25:41 -05:00
Ben Ramsey
d854a54b5f
Merge branch 'PHP-8.3' into PHP-8.4 2024-09-26 14:24:13 -05:00
Dmitry Stogov
c34b37fe0b
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix FFI prototypes (these functions can't return NULL) (#16075)
2024-09-26 20:20:11 +03:00
Dmitry Stogov
a37a3d3d81
Fix FFI prototypes (these functions can't return NULL) (#16075) 2024-09-26 20:19:46 +03:00
Ilija Tovilo
5e83586896
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Mark one more curl test as xleak
2024-09-26 16:50:12 +02:00
Ilija Tovilo
c7bc91cfcd
[skip ci] Mark one more curl test as xleak 2024-09-26 16:50:06 +02:00
Christoph M. Becker
d7030c2758
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-15905: Assertion failure for TRACK_VARS_SERVER
2024-09-26 15:36:11 +02:00
Christoph M. Becker
05fce50f94
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-15905: Assertion failure for TRACK_VARS_SERVER
2024-09-26 15:35:42 +02:00
Ilija Tovilo
aff26e4d6e
Merge branch 'PHP-8.4'
* PHP-8.4:
  Remove now unused llvm installation in asan build
2024-09-26 15:18:38 +02:00
Ilija Tovilo
6f7ec6a747
Remove now unused llvm installation in asan build 2024-09-26 15:18:01 +02:00
Ilija Tovilo
26ccfbe111
Merge branch 'PHP-8.4'
* PHP-8.4:
  Switch asan build to Ubuntu 24.04
2024-09-26 15:16:30 +02:00
Ilija Tovilo
b14d440a82
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Switch asan build to Ubuntu 24.04
2024-09-26 15:15:39 +02:00
Ilija Tovilo
553e18f679
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix missing libavif-dev in asan nightly
2024-09-26 15:09:53 +02:00
Ilija Tovilo
271b9e685e
Fix missing libavif-dev in asan nightly
Asan still runs on Ubuntu 20.04, which doesn't contain the libavif-dev package.

Closes GH-16049
2024-09-26 15:09:32 +02:00
Dmitry Stogov
81438e3fe8
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix possible NULL dereference
2024-09-26 15:44:25 +03:00
Dmitry Stogov
b8ac4ca19d
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix possible NULL dereference
2024-09-26 15:44:16 +03:00
Christoph M. Becker
9e3b959bf9
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix bug71610.phpt
2024-09-26 13:19:21 +02:00
Christoph M. Becker
d6b8ef81d7
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix bug71610.phpt
2024-09-26 13:18:52 +02:00
Peter Kokot
9ee9c0e674
Sync exif dependency on mbstring extension as optional (#16062)
When decoding multibyte data in EXIF tags, the mbstring extension needs
to be enabled. In Autotools this is now synced with ZEND_MOD_OPTIONAL
in the C code, and on Windows it is now also optional.

The required dependency on mbstring extension was removed via
755c2cd0d8 which made the mbstring
extension optional dependency.
2024-09-26 09:53:58 +02:00
Remi Collet
d62b9eb9c4
Merge branch 'PHP-8.4'
* PHP-8.4:
  zip extension is 1.22.4
2024-09-26 09:39:29 +02:00
Remi Collet
a1cacec067
zip extension is 1.22.4 2024-09-26 09:39:10 +02:00
Gina Peter Banyard
531b94359e
Zend/zend_hash.h: Mark zend_array* parameter of zend_array_is_list() as const 2024-09-25 23:30:20 +01:00
Gina Peter Banyard
255f59e53c
Merge branch 'PHP-8.4'
* PHP-8.4:
  ext/ldap: Fix GH-16032 (Various NULL pointer dereferencements in ldap_modify_batch())
2024-09-25 23:27:27 +01:00
Gina Peter Banyard
18f61ad47d
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  ext/ldap: Fix GH-16032 (Various NULL pointer dereferencements in ldap_modify_batch())
2024-09-25 23:27:12 +01:00
DanielEScherzer
b436ef479e
GH-15994: fix suggestion that anonymous classes be made abstract (GH-15995)
In the process, remove the (incorrect) assumption that any abstract method that
needs to be implemented by a class that cannot itself be made abstract must be
a private method - the existing test for an enum already showed that this was
not the case.
2024-09-26 00:05:12 +02:00
DanielEScherzer
3b349db1a7
GH-15992: fix error message for single abstract method not implemented (GH-15993) 2024-09-25 22:48:02 +02:00
Niels Dossche
e035a95723
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16054: Segmentation fault when resizing hash table iterator list while adding
2024-09-25 21:09:11 +02:00
Niels Dossche
4b8a12d1e6
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16054: Segmentation fault when resizing hash table iterator list while adding
2024-09-25 21:08:36 +02:00
Ilija Tovilo
7b141342b1
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix use-after-free of object released in hook
2024-09-25 21:06:33 +02:00
Ilija Tovilo
12844f96e2
Fix use-after-free of object released in hook
Fixes GH-16040
Closes GH-16058
2024-09-25 21:05:20 +02:00
Niels Dossche
0d1d905353
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16039: Segmentation fault (access null pointer) in ext/dom/parentnode/tree.c
2024-09-25 19:39:58 +02:00
Niels Dossche
97546746d0
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16039: Segmentation fault (access null pointer) in ext/dom/parentnode/tree.c
2024-09-25 19:39:49 +02:00
Gina Peter Banyard
2c3c2381e1
Zend/zend_hash.(c|h): Mark various parameters and variables const (#16003) 2024-09-25 16:05:28 +01:00
Saki Takamachi
ae505db0c9
CI: prepare for PHP-8.4 (#16036) 2024-09-25 22:57:59 +09:00
Máté Kocsis
2448a01a55
Add real-time benchmark to CI as a nightly job (#15696)
This PR integrates https://github.com/kocsismate/php-version-benchmarks/ into the CI as a nightly job running every day at 12:30 AM UTC. Roughly, the following happens: the benchmark suite spins up an AWS EC2 instance via Terraform, runs the tests according to the configuration, and then the results are committed to the https://github.com/kocsismate/php-version-benchmark-results repository.

In order to have as stable results as possible, the CPU, kernel and other settings of the AWS instance are fine-tuned:

- Hyper-threading is disabled
- Turbo boost is disabled
- C states of the CPU are limited: https://docs.aws.amazon.com/linux/al2/ug/processor_state_control.html#baseline-perf
- The workload is dedicated to a single core by using taskset according to Intel's recommendations (https://web.archive.org/web/20210614053522/https://01.org/node/3774)
- An io2 SSD volume is attached to the instance which has a provisioned IOPS (https://docs.aws.amazon.com/ebs/latest/userguide/provisioned-iops.html#io2-block-express) so that IO performance is nearly constant
- The instance is dedicated so that the noisy neighbor effect is eliminated: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/dedicated-instance.html
- ASLR is disabled (Disable ASLR for benchmark #13769)

Customizing the CPU is only supported by metal instances among recent instance types according to https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/processor_state_control.html, so at last, a c7i.metal-24xl instance is used in the eu-west-1 region.

The benchmark suite compares the performance of the latest commit of the master branch in the time when the benchmark runs with the last commit of master from the day before yesterday. I.e. if the benchmark runs tomorrow morning at 2 AM, then the performance of the latest commit will be benchmarked against the last commit pushed yesterday. This makes it possible to spot outstanding regressions (or progressions) in time. Actually, the end goal is to send notifications in case of any significant changes for further analyzation. The reason why the benchmark is run for previous commits as well (while they may have already been measured the day before) is to make the results less sensitive for changes in the environment or the benchmark suite itself. I.e.: if AWS upgrades the OS, or if the code under test is modified, then the numbers will likely be affected, and the previous results will be invalidated).
2024-09-25 15:55:24 +02:00
Tim Düsterhus
3c8c0df6c8
pdo: Use zend_string_toupper in pdo_stmt_describe_columns (#16047)
zend_string_toupper was only introduced in PHP 8.2 and thus it likely was not
used here, since this code was last touched for PHP 8.0.
2024-09-25 14:52:02 +02:00
Saki Takamachi
e0a7ec22ee
Merge branch 'PHP-8.4'
* PHP-8.4:
  Added PHP-8.4 to push workflow (#16045)
2024-09-25 20:26:21 +09:00
Saki Takamachi
6946bbca38
Added PHP-8.4 to push workflow (#16045) 2024-09-25 20:25:40 +09:00
Ilija Tovilo
5c5b1626f7
[skip ci] Add PHP 8.4 to nightly matrix 2024-09-25 13:07:16 +02:00
Ayesh Karunaratne
f6a05e045f
CI: Cirrus CI - skip build on ignore-paths (GH-13675)
Cirrus CI supports a `<job>.skip` key that skips the build if the expression
evaluates to true. This adds the same list of `on.pull_request.paths-ignore`
patterns from GitHub Actions workflows.

This should save several minutes of CI times on PRs when the changes are
only in the README/doc files.

[Cirrus CI Docs](https://cirrus-ci.org/guide/writing-tasks/#supported-functions)
2024-09-25 13:05:53 +02:00
Ayesh Karunaratne
3566421e14
CI: Add 50-minute timeouts to GitHub Actions and Cirrus CI (GH-15589)
Currently, there are no explicit timeouts set for CI jobs, which means
the CI jobs will keep running until they are terminated by the task
runner. The current defaults of each provider are:

 - GitHub Actions: 360 minutes[^1]
 - Cirrus CI: 60 minutes[^2]
 - Travis CI: 50 minutes[^3]

On Travis, the timeout is not configurable, and given that our test suite
usually completes within 20 minutes, this commit explicitly sets
timeouts for Cirrus CI and GitHub Actions to 50 minutes as well.

[^1]: [GitHub Actions Workflow Syntax](https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idtimeout-minutes)
[^2]: [Cirrus CI FAQ](https://cirrus-ci.org/faq/#instance-timed-out)
[^3]: [Travis docs - customizing the build](https://docs.travis-ci.com/user/customizing-the-build#build-timeouts)
2024-09-25 12:58:17 +02:00
David Carlier
2a3dae18ed
Merge branch 'PHP-8.4' 2024-09-25 00:39:58 +01:00
David Carlier
0d9f3a5600
Merge branch 'PHP-8.3' into PHP-8.4 2024-09-25 00:39:46 +01:00
Ilija Tovilo
14b0862512
Merge branch 'PHP-8.4' 2024-09-25 01:22:28 +02:00
Ilija Tovilo
71ca5566ec
Merge branch 'PHP-8.3' into PHP-8.4 2024-09-25 01:22:23 +02:00
Ilija Tovilo
a52c056638
Merge branch 'PHP-8.4' 2024-09-25 01:12:27 +02:00
Ilija Tovilo
0ea02b35f4
Merge branch 'PHP-8.3' into PHP-8.4 2024-09-25 01:12:20 +02:00
Gina Peter Banyard
d95e222402
Zend: Use a dedicated enum for the status of the result of a division (#16020) 2024-09-24 20:43:06 +01:00
Niels Dossche
623c327d12
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16009: Segmentation fault with frameless functions and undefined CVs
2024-09-24 21:24:00 +02:00
Niels Dossche
daba40c695
Fix GH-16009: Segmentation fault with frameless functions and undefined CVs
The frameless function handlers do not update the op variables when
handling the result is undefined. In this case this causes propagating
an UNDEF value into a temporary, which results in an extra undefined
variable warning for a temporary in this case.

The original issue also reports a crash in some cases, which is also
fixed by this patch.

Closes GH-16012.
2024-09-24 21:20:35 +02:00
Niels Dossche
d5f6e56610
[ci skip] Clarify intention in phpdbg, removing one TODO comment (#16014)
The point of WATCH_ON_BUCKET is to watch for all 3 fields of the bucket,
so the fallthrough is intended.
2024-09-24 19:32:11 +02:00
Saki Takamachi
7f88f4c275
Merge branch 'PHP-8.4'
* PHP-8.4:
  update API/ABI versions
2024-09-25 00:44:57 +09:00
Saki Takamachi
7225a11e59
update API/ABI versions 2024-09-25 00:44:02 +09:00
Saki Takamachi
598d643e5f
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Prepare NEWS for PHP 8.4.0RC2
2024-09-25 00:30:02 +09:00
Saki Takamachi
4745177686
[skip ci] Prepare NEWS for PHP 8.4.0RC2 2024-09-25 00:16:46 +09:00
Saki Takamachi
7bd0bcadaa
Prepare for PHP 8.4 2024-09-25 00:03:39 +09:00
Calvin Buckley
f5f05e886e
Fix regression on systems built without JIT (#16024)
regressing commit: 654b787ee1

This was called if JIT was enabled or not. If not enabled, it'll result
in an undeclared function warning and maybe a bad time in the linker.
Gate the meat of this PHP-side function on if JIT is enabled (but keep
it existing so PHP userland code works with or without JIT, OFC).
2024-09-24 11:38:59 -03:00
Florian Engelhardt
3293fafa27
Add OPcache restart hook (#15590)
This hook will allow observing extensions to observe the actual OPcache restart.
2024-09-24 16:24:01 +02:00
Saki Takamachi
c5b258fedc
Fix GH-15968: Avoid converting objects to strings in operator calculations. (#16021) 2024-09-24 22:33:36 +09:00
Bob Weinand
654b787ee1
Add API to exempt function from being traced in JIT (#15559)
Internally accessible via zend_jit_blacklist_function / externally via opcache_jit_blacklist.
The functionality currently only affects tracing JIT, but may be extended to other JIT modes in future.
2024-09-24 14:20:38 +02:00
Christoph M. Becker
f89eb15f72
Port libgd/libgd/pull/711 (GH-16016)
Note that this is not actually security related[1], but still a
reasonable sanity check.

"If a function be advertised to return an error code in the event of
difficulties, thou shalt check for that code, yea, even though the
checks triple the size of thy code and produce aches in thy typing
fingers, for if thou thinkest it cannot happen to me, the gods shall
surely punish thee for thy arrogance." – Henry Spencer

[1] <https://github.com/libgd/libgd/issues/697#issuecomment-2369613187>
2024-09-24 13:58:31 +02:00
Ayesh Karunaratne
99bceda0b3
ext/curl: Add CURLINFO_POSTTRANSFER_TIME_T support (GH-15849)
libcurl ref: [`CURLINFO_POSTTRANSFER_TIME_T`](https://curl.se/libcurl/c/CURLINFO_POSTTRANSFER_TIME_T.html)

`CURLINFO_POSTTRANSFER_TIME_T` is a libcurl info option that returns
the time it took to "post" the transfer. Available since libcurl 8.10.0

This value is also exposed as `posttransfer_time_us` in the
`curl_getinfo()` return value when the `$option` parameter is not
passed.
2024-09-24 13:39:07 +02:00
David Carlier
f35ad560b4
GH-12940 ext/pdo_pgsql: using PQclosePrepared to free statement resources.
PQclosePrepared allows the statement's name to be reused thus allowing
cache solutions to work properly ; whereas, for now, the `DEALLOCATE
<statement>` query is used which free entirely the statement's resources.

close GH-13316
2024-09-24 12:09:56 +01:00
Christoph M. Becker
051c886bc3
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix MySQL and MSSQL CI failures
2024-09-24 13:04:52 +02:00
Christoph M. Becker
f44250c418
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-15980: Signed integer overflow in main/streams/streams.c
2024-09-24 12:35:06 +02:00
Ayesh Karunaratne
ba748e7bb5
ext/curl: Add CURLOPT_DEBUGFUNCTION option (GH-15674)
This adds support for `CURLOPT_DEBUGFUNCTION`[^1] Curl option to set a
custom callback that gets called with debug information during the
lifetime of a Curl request.

The callback gets called with the `CurlHandle` object, an integer
containing the type of the debug message, and a string containing the
debug message. The callback may get called multiple times with the
same message type during a request.

PHP already uses `CURLOPT_DEBUGFUNCTION` functionality to internally
to expose a Curl option named `CURLINFO_HEADER_OUT`.

However,`CURLINFO_HEADER_OUT` is not a "real" Curl option supported
by libcurl. Back in 2006, `CURLINFO_HEADER_OUT` was added[^2] as
a Curl option by using the debug-callback feature. Git history does
not run that back to show why `CURLINFO_HEADER_OUT` was added as a
Curl option, and why the other debug types (such as
`CURLINFO_HEADER_IN` were not added as Curl options, but this seems
to be a historical artifact when we added features without trying
to be close to libcurl options.

This approach has a few issues:

1. `CURLINFO_HEADER_OUT` is not an actual Curl option supported by
  upstream libcurl.

2. All of the Curl options have `CURLOPT_` prefix, and `CURLINFO_HEADER_OUT`
  is the only Curl "option" that uses the `CURLINFO` prefix. This exception
  is, however, noted[^3] in docs.

3. When `CURLINFO_HEADER_OUT` is set, the `CURLOPT_VERBOSE` is also implicitly
  set. This was reported[^4] to bugs.php.net, but the bug is marked as wontfix.

This commit adds support for `CURLOPT_DEBUGFUNCTION`. It extends the existing
`curl_debug` callback to store the header-in information if it encounters
a debug message with `CURLINFO_HEADER_OUT`. In all cases, if a callable
is set, it gets called.

`CURLOPT_DEBUGFUNCTION` intends to replace `CURLINFO_HEADER_OUT` Curl
option as a versatile alternative that can also be used to extract
other debug information such as SSL data, text information messages,
incoming headers, as well as headers sent out (which `CURLINFO_HEADER_OUT`
makes available).

The callables are allowed to throw exceptions, but the return values are
ignored.

`CURLOPT_DEBUGFUNCTION` requires `CURLOPT_VERBOSE` enabled, and setting
`CURLOPT_DEBUGFUNCTION` does _not_ implicitly enable `CURLOPT_VERBOSE`.

If the `CURLOPT_DEBUGFUNCTION` option is set, setting `CURLINFO_HEADER_OUT`
throws a `ValueError` exception. Setting `CURLOPT_DEBUGFUNCTION` _after_
enabling `CURLINFO_HEADER_OUT` is allowed. Technically, it is possible
for both functionality (calling user-provided callback _and_ storing
header-out data) is possible, setting `CURLINFO_HEADER_OUT` is not
allowed to encourage the use of `CURLOPT_DEBUGFUNCTION` function.

This commit also adds the rest of the `CURLINFO_` constants used as
the `type` integer value in `CURLOPT_DEBUGFUNCTION` callback.

---

[^1]: [cur.se - CURLOPT_DEBUGFUNCTION](https://curl.se/libcurl/c/CURLOPT_DEBUGFUNCTION.html)
[^2]: [`5f25d80`](5f25d80d10)
[^3]: [curl_setopt doc mentioning `CURLINFO_` prefix is intentional](https://www.php.net/manual/en/function.curl-setopt.php#:~:text=prefix%20is%20intentional)
[^4]: [bugs.php.net - `CURLOPT_VERBOSE` does not work with `CURLINFO_HEADER_OUT`](https://bugs.php.net/bug.php?id=65348)
2024-09-24 10:56:56 +02:00
DanielEScherzer
ea297654f4
Zend/*: fix a bunch of typos (GH-16017)
* Zend/*: fix a bunch of typos

* Zend/tests/try/try_catch_finally_005.phpt: update string length
2024-09-24 10:55:21 +02:00
Tim Düsterhus
15dde9d329
Add some entries to the performance section of UPGRADING (#16019)
* [skip ci] Mention `sprintf()` optimization in UPGRADING

* [skip ci] Mention ext/random performance improvements in UPGRADING
2024-09-24 09:50:30 +02:00
Dmitry Stogov
8f00430a2b
Fix GH-15972: Assertion failure in ext/opcache/jit/zend_jit_vm_helpers.c with function JIT (#16001) 2024-09-24 10:24:08 +03:00
Calvin Buckley
07377de110 Merge branch 'PHP-8.3'
* PHP-8.3:
  Cast big endian byte shuffling to uint
2024-09-24 02:24:02 -03:00
Niels Dossche
cf0a44a38a
[ci skip] Fix typo 2024-09-23 22:19:15 +02:00
Niels Dossche
90f81ca7cb
[ci skip] Exchange TODO comment for an explanation
Such that nobody actually attempts to implement this.
2024-09-23 21:10:14 +02:00
Christoph M. Becker
5dd8bb0fa8
Merge branch 'PHP-8.3'
* PHP-8.3:
  ext/curl: mark certain tests as xfail on curl 8.10.0
2024-09-23 16:15:46 +02:00
Dmitry Stogov
b2eff1f2ce
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-15973: Segmentation fault in JIT mode 1135 (#16006)
2024-09-23 17:13:47 +03:00
Christoph M. Becker
102ff9f9cc
Merge branch 'PHP-8.3'
* PHP-8.3:
  Adapt labeler.yml to v4 syntax
2024-09-23 14:10:38 +02:00
Arnaud Le Blanc
cc065bae3f
Fix zend_lazy_object_get_properties for object with prop ht, when init fails (#15825)
zend_lazy_object_get_properties() is used by zend_std_get_properties_ex() to fetch the properties of lazy objects. It initializes the object and returns its properties.

When initialization fails we return an empty ht because most callers do not check for NULL. We rely on the exception thrown during initialization. We also assign that empty ht to zend_object.properties for the same reasons.

We asserted that zend_object.properties was either NULL or &zend_empty_array, but there are other cases in which a uninitialized lazy object may have a properties ht.

Here I remove the assertion, and return the existing properties ht if there is one. Otherwise I return zend_new_array(0) instead of &zend_emtpy_array as not all callers expect an immutable array (e.g. FE_FETCH does not).
2024-09-23 13:47:56 +02:00
Christoph M. Becker
5c1b945a16
Merge branch 'PHP-8.3'
* PHP-8.3:
  Mark failing curl test on macOS x64 as xfail
2024-09-23 13:36:36 +02:00
Gina Peter Banyard
585cf9c156
ext/bcmath: null should not be supported for operator overloading & fix some comparison issues (#15875) 2024-09-23 11:49:33 +01:00
Gina Peter Banyard
b039af0120
ext/gmp: Use zend_result for type instead of int
Especially as we are widening a zend_result to int just to immediately narrow it back to a zend_result.
2024-09-23 10:55:51 +01:00
DanielEScherzer
702fb31894
zend_resolve_const_class_name_reference(): use double quotes around names (#15998)
This is a follow-up to #15990, as it turns out there was a second place that emits this kind of error message.
2024-09-23 09:59:48 +01:00
DanielEScherzer
8e6d8cf1fa
GH-15976: don't say "type alias" (#15996)
Follow-up to GH-15977
2024-09-23 09:59:12 +01:00
DanielEScherzer
34325c5e3a
zend_assert_valid_class_name(): use double quotes around names (#15990) 2024-09-23 00:44:16 +01:00
DanielEScherzer
957feab461
[skip ci] Zend/tests/traits/trait_underscore_as_name.phpt: fix file name (#15991)
Accidentally called "enum_underscore_as_name.phpt"
2024-09-23 00:40:44 +01:00
Gina Peter Banyard
064ea9c505
Inlines the behaviour of php_mkdir_ex() into plain wrapper mkdir handler (#15520)
This effectively inlines the behaviour of php_mkdir_ex() which is a deprecated API from at least 17 years ago, and also fixes some of the return values.

This also removes a dependency on ext/standard
2024-09-23 00:40:02 +01:00
Christoph M. Becker
8a5ada4e10
Merge branch 'PHP-8.3'
* PHP-8.3:
  Revert "Fix GH-15980: Signed integer overflow in main/streams/streams.c"
2024-09-23 01:33:57 +02:00
Christoph M. Becker
10008fb6e8
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-15980: Signed integer overflow in main/streams/streams.c
2024-09-23 00:30:29 +02:00
Saki Takamachi
f6db576c31
[RFC] ext/bcmath: Added bcdivmod (#15740)
RFC: https://wiki.php.net/rfc/add_bcdivmod_to_bcmath

Added bcdivmod() function and added divmod() method to BcMath\Number class.
2024-09-23 06:43:11 +09:00
Christoph M. Becker
2b90acb469
Fix GH-15986: Double-free due to Pdo\Pgsql::setNoticeCallback()
We need to release the fcall info cache instead of destroying it.

Closes GH-15987.
2024-09-22 23:35:05 +02:00
Daniel Scherzer
79d708cfca GH-15976: clarify error messages for enum/trait/interface/alias names
Instead of always saying that a name is reserved or deprecated and
cannot/should not be used as a class name, take the usage into account and say
the name cannot be used as an enum name, trait name, etc. In the process, for
class names add a missing "a".
2024-09-22 19:14:57 +01:00
Daniel Scherzer
ca679c681f GH-15976: test current output
So that it is clearer what changes
2024-09-22 19:14:57 +01:00
Christoph M. Becker
8c407fc3d0
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix minimal Windows version
2024-09-22 19:30:03 +02:00
Christoph M. Becker
1d92796107
Merge branch 'PHP-8.3'
* PHP-8.3:
  Prevent closing of unrelated handles
2024-09-22 17:29:05 +02:00
Christoph M. Becker
0695b9773d
Make ext/shmop/tests/gh14537.phpt more resilient (GH-15985)
The actual problem is our `shmget()` implementation which does not care
to set `errno` appropriately; that should be fixed, although mapping
the error conditions to those specified by POSIX might be hard.

For now, we only make the test case more resilient by ignoring the
exact error; "No error" doesn't make sense anyway.
2024-09-22 17:03:16 +02:00
Niels Dossche
5bfd45cd44
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-15908 and GH-15026: leak / assertion failure in streams.c
2024-09-22 16:09:21 +02:00
Niels Dossche
27b3131422
Fix GH-15982: Assertion failure with array_find when references are involved
Closes GH-15983.
2024-09-22 14:34:55 +02:00
Saki Takamachi
05cb27a8f9
ext/bcmath: Check for scale overflow (#15741) 2024-09-22 06:59:06 +09:00
Ilija Tovilo
00f0b80189
Merge branch 'PHP-8.3' 2024-09-21 20:04:52 +02:00
Christoph M. Becker
580435354e
Support bug64159.phpt on Windows CI (GH-15895)
This test queries `extOutput` for the first line of output of the
command which was executed when snmpd started (`HexTest` in snmpd.conf).
Since there is no `/bin/sh` on Windows, no command would be run, and as
such we received an empty string.  We fix that by dynamically adjusting
snmpd.conf to run a JScript which has the same output as bigtest.

We also make the test diff more helpful in case of failures, where so
far we only would have known that the output had a different message
digest.
2024-09-21 16:03:25 +02:00
Christoph M. Becker
64d959e266
Merge branch 'PHP-8.3'
* PHP-8.3:
  [ci skip] Add labels to PRs with potential ABI breaks
2024-09-21 00:13:29 +02:00
Christoph M. Becker
6f5610ccc8
Fix ext/snmp for newer net-snmp versions on Windows (GH-15888)
As of net-snmp 5.8.0, the library defines their own `(v)asprintf()` if
not available on the system.  However, PHP also does this, so when
building ext/snmp there would be conflicting declarations on Windows.
To avoid this, we explictly define `HAVE_ASPRINTF`, so net-snmp does
not redeclare when its headers are included.
2024-09-20 23:59:17 +02:00
Niels Dossche
1b171bb6b4
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-15918: Assertion failure in ext/spl/spl_fixedarray.c
2024-09-20 17:34:54 +02:00
Niels Dossche
7e6e71255e
Small optimization in dom_local_name_compare_ex() (#15950)
We can use `memcmp()` directly and skip some of the logic handling
in `zend_binary_strcmp()`. `perf record` shows a reduction for
`dom_html5_serializes_as_void()` from 3.12% to 0.77%.
2024-09-20 08:11:13 +02:00
Remi Collet
090b53bc44
[ci skip] NEWS + UPGRADING 2024-09-19 15:36:26 +02:00
Remi Collet
4cdba0511c
add ZipArchive::ER_TRUNCATED_ZIP added in libzip 1.11 (#15959) 2024-09-19 15:32:55 +02:00
Ilija Tovilo
1b9568d354
Implement backed enum coercion in http_build_query()
Fixes GH-15650
Closes GH-15704
2024-09-19 00:27:09 +02:00
Christoph M. Becker
7a8767fe62
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-15901: phpdbg: Assertion failure on `i funcs`
2024-09-18 23:51:45 +02:00
Niels Dossche
7bf5b7fa78
Use cache slot for dom_property_exists() (#15941) 2024-09-18 17:23:24 +02:00
Michael Voříšek
d313ad6098
Deprecate E_STRICT constant and remove error level
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#remove_e_strict_error_level_and_deprecate_e_strict_constant

Closes GH-13053
2024-09-18 14:33:14 +02:00
Dmitry Stogov
a360b1757e
Add test for GH-15903 2024-09-18 09:35:01 +03:00
Dmitry Stogov
9cb48c8fa1
Update IR
IR commit: 84a4b4259a0ea246f82e0d8a3d79032af75b5267

This fixes GH-15903: Core dumped in ext/opcache/jit/ir/ir_ra.c
2024-09-18 09:33:54 +03:00
Niels Dossche
e2da65de2a
NEWS for 306dedcf5e
[ci skip]
2024-09-17 22:17:34 +02:00
Jorg Adam Sowa
306dedcf5e
ext/bcmath: bcpow() performance improvement (#15790)
* Added function for squaring to improve performance of power calculation

* Aligned backslashes

* Removed unnecessary comments

* Extracted common part of multiplication and square functions

* Added comment to bc_fast_square

* Improved wording of bc_mul_finish_from_vector

* Reused new function name

* Replaced macro with function
2024-09-17 22:16:26 +02:00
Dmitry Stogov
36dfe634b0
Add test for GH-15909 (fixed by previous IR update) 2024-09-17 21:24:42 +03:00
Dmitry Stogov
718cff9bbb
Update IR
IR commit: 4f02f1bdc5b4312b862e5e399fe9fb1cfe149d0f
2024-09-17 21:24:01 +03:00
Niels Dossche
c9a4abadcc
Fix unsetting DOM properties
This never did anything in lower versions, but on master this crashes
because the virtual properties don't have backing storage. Just forbid
it since it was useless to begin with.

Closes GH-15891.
2024-09-17 19:24:49 +02:00
Niels Dossche
31e2ec63d8
Fix GH-15923: GDB: Python Exception <class 'TypeError'>: exceptions must derive from BaseException
Triggers on release builds when printing data structures.
You can't raise a string, you must raise exceptions.

Closes GH-15928.
2024-09-17 19:24:18 +02:00
Peter Kokot
43dc2eb6d8
Remove redundant *spell* libraries on Alpine (#15890)
These were needed mostly for the PHP <= 8.3 pspell extension. The
nchant2-hunspell gets installed automatically as a dependency with
enchant2-dev if needed.
2024-09-17 18:14:44 +02:00
Peter Kokot
2324e32c7d
Remove redundant Kerberos library installation (#15889)
This was once needed for the --with-kerberos configure options by
openssl or imap extensions.
2024-09-17 18:13:54 +02:00
Gina Peter Banyard
ae4ef32d68
ext/standard/browscap.c: Minor refactorings (#15885)
- Use more appropriate types
- Add const modifiers
- Reduce scope of some variable
- Prevent shadowing of variable
2024-09-17 16:48:21 +01:00
Juliette
4830535b69
[skip ci] PHP 8.4 NEWS: fix typos in parameter names (#15931)
Ref: PR 15362 / c818d944cf (diff-7ee66c4f1536ac84dc5bbff1b8312e2eef24b974b3e48a5c5c2bcfdf2eb8f3ce)

Co-authored-by: jrfnl <jrfnl@users.noreply.github.com>
2024-09-17 16:47:08 +01:00
Arnaud Le Blanc
17d46bb3b2
Fix oss-fuzz #71382 (#15854)
The return value of zho_build_properties_ex() is passed to ZVAL_ARR(), which sets the IS_TYPE_REFCOUNTED flag. Returning &zend_emtpy_array will crash later when trying to dtor the zval.

I'm fixing this by returning zend_new_array(0) instead of &zend_empty_array.

An alternative was to make ZVAL_ARR() aware of immutable arrays, like ZVAL_STR() is with interned strings, but I found no other problematic cases.
2024-09-17 16:06:51 +02:00
Dmitry Stogov
1ce865244a
Update IR
IR commit: d441328849f5172e6ad213cf0e42d77322238048
2024-09-17 16:15:38 +03:00
DanielEScherzer
21196ca9f6
zend_enum.c: make a bunch of pointers const (#15932)
* zend_enum.c: make a bunch of pointers `const`

* interface_gets_implemented needs non-constant

* zend_enum.h: update zend_verify_enum() signature
2024-09-17 12:57:01 +02:00
DanielEScherzer
a3583d7eef
zend_inheritance.c: make a bunch of pointers const (GH-15934)
* zend_inheritance.c: make a bunch of pointers `const`

* Fix const double pointers
2024-09-17 12:44:17 +02:00
Ilija Tovilo
1be989bbf0
[skip ci] Move brew install libsodium to reinstall
Gets rid of the "already installed" warning on master.
2024-09-17 12:35:07 +02:00
Ayesh Karunaratne
5fa082316b
CI: Update actions/cache in nightly run to v4 (#15933) 2024-09-17 08:51:57 +02:00
Ayesh Karunaratne
3afb96184e ext/mbstring: Update to Unicode 16
Updates UCD to Unicode 16.0 (released 2024 Sept).

Previously: 0fdffc18, #7502, #14680

Unicode 16 adds several new character sets and case folding rules.
However, the existing ucgendat script can still parse them.

This also adds a couple test cases to make sure the new rules for
East Asian Wide characters and case folding work correctly. These
tests fail on Unicode 15.1 and older because those verisons do not
contain those rules.
2024-09-17 10:40:00 +09:00
DanielEScherzer
71edc05139
php_reflection.c: make a bunch of pointers const (#15927)
* php_reflection.c: make a bunch of pointers `const`

* _function_closure_string: use %u for unsigned

Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>

* _extension_class_string: make indent pointer `const`

Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com>

---------

Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com>
2024-09-17 03:17:46 +02:00
DanielEScherzer
65b4f22686
Fix some misleading comments about __clone() never being executed (#15926)
For the `Exception`, `ReflectionClass`, and `ReflectionAttribute` classes, the
`__clone()` method is declared to be private, and the implementation has a
comment that it should never be executed. However, the implementation can be
executed by using a `ReflectionMethod`. Fix the comments to instead explain why
the implementation is needed.

[skip ci]
2024-09-17 01:53:30 +02:00
Ilija Tovilo
2fce0bb877
Implement ReflectionProperty::isFinal()
Closes GH-15919
2024-09-16 23:22:52 +02:00
Niels Dossche
1ce07b0957
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-15711: SoapClient can't convert BackedEnum to scalar value
  Use get_serialization_string_from_zval() in all encoding functions
  Introduce get_serialization_string_from_zval() and use it in to_xml_string()
2024-09-16 20:51:34 +02:00
Niels Dossche
55aa5f3ffb
Fix GH-15910: Assertion failure in ext/dom/element.c 2024-09-16 20:06:07 +02:00
Arnaud Le Blanc
c65e042c0b
Fix zend_get_property_info_for_slot() for lazy objects (#15855)
zend_get_property_info_for_slot(obj, slot) assumes that 'slot' belongs to 'obj', but that may not be the case for lazy proxies.

Fortunately, the property info is often already available in path when it is needed.

For other cases, I make zend_get_property_info_for_slot() aware of lazy objects, and add zend_get_property_info_for_slot_self() for cases where the 'slot' is known to belong to the object itself.

Fixes oss-fuzz #71446
2024-09-16 16:58:12 +02:00
Ilija Tovilo
c7397f5131
[skip ci] Fix NEWS section 2024-09-16 14:34:19 +02:00
Ilija Tovilo
d75a289f6f
Implement ReflectionProperty::hasHook[s]
Closes GH-15844
2024-09-16 14:28:41 +02:00
Christoph M. Becker
b438e2b1ed
Merge branch 'PHP-8.3'
* PHP-8.3:
  Run snmp tests in Windows CI, again
2024-09-15 23:15:09 +02:00
Niels Dossche
ed54d6de49
Fix XML serializer errata: xmlns="" serialization should be allowed
The spec doesn't want to serialize xmlns:foo="", but the description of
the step that checks this does not take into account that xmlns="" must
be allowed. This patch corrects this errata.

Closes GH-15894.
2024-09-15 21:30:53 +02:00
Christoph M. Becker
5121acaa66
Support --with-openssl-argon2 on Windows (GH-15713)
We change the error for ZTS builds to a warning, to not break snapshot
builds which automatically will try to enable OpenSSL password hashing.

We also change some messages to better fit building on Windows.

And of course, we cannot easily check whether `OSSL_set_max_threads()`
is actually available; instead we're looking up the function declaration
in its header file.

Co-authored-by: Peter Kokot <peterkokot@gmail.com>
2024-09-15 17:06:50 +02:00
Peter Kokot
796eba65e7
Autotools: Fix CS in undefined sanitizer check (#15892)
To prevent possible unused warnings turning into false errors.
2024-09-15 15:52:37 +02:00
Ayesh Karunaratne
d5b3ffa762
ext/gd: enable avif tests on GH-Actions (#15850)
When the avif support was first added (GH-7026), php-src did not
use GitHub Actions. When we moved to GitHub Actions for CI, the
`--with-avif` option nor the `libavif-dev` dependencies were not
added.

Cirrus CI still runs the tests, and now that we no longer use
Travis CI, this brings parity to test avif on x64 tests on
GitHub Actions as well.

`libavif-dev` package's x86 builds seem to be missing[^1][^2] on older
Ubuntu versions, so this commit only adds it for x64 builds.

[^1]: https://packages.ubuntu.com/jammy/libavif-dev
[^2]: https://packages.ubuntu.com/noble/libavif-dev
2024-09-15 14:57:47 +02:00
Máté Kocsis
274ae05c4e
Merge branch 'PHP-8.3'
* PHP-8.3:
  Add missing returns in ext/date for PHP 8.3+ (#15735)
2024-09-14 22:15:49 +02:00
Gina Peter Bnayard
2513258a2b ext/phar: Voidify flush function as it always returns EOL 2024-09-14 14:00:46 +01:00
Gina Peter Bnayard
4f9fdf841e ext/phar: Move variable to inner scope 2024-09-14 14:00:46 +01:00
Gina Peter Bnayard
290fb920f2 ext/phar: Mark constant string as static const 2024-09-14 14:00:46 +01:00
Gina Peter Bnayard
3f1a4441bd ext/standard: Make char* of php_stristr() const 2024-09-14 14:00:46 +01:00
Gina Peter Bnayard
b75c79ee1d ext/phar: Use bool instead of int 2024-09-14 14:00:46 +01:00
Gina Peter Bnayard
03e2cfdad1 ext/phar: Refactor flushing of archive to only take string stub file 2024-09-14 14:00:46 +01:00
Peter Kokot
888eb370cf
Fix -Wundef/C4668 warnings (#15853)
- ZTS is either undefined or defined (to 1)
- PHP_WIN32 is either undefined or defined (to 1)
- HAVE_LIBEDIT is either undefined or defined (to 1)
2024-09-14 11:28:32 +02:00
Ilija Tovilo
f6a232cce2
Fix missing deps in macos arm build (GH-15881) 2024-09-14 00:53:24 +02:00
Ilija Tovilo
99bee73325
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GA macOS brew warnings
2024-09-13 23:14:55 +02:00
Niels Dossche
e7b022ea17
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-15868: Assertion failure in xml_parse_into_struct after exception
  Fix GH-15868: Assertion failure in xml_parse_into_struct after exception
2024-09-13 20:02:00 +02:00
Ilija Tovilo
5e7a1cc818
Merge branch 'PHP-8.3'
* PHP-8.3:
  Mark some phar tests as flaky on macOS
2024-09-13 18:14:23 +02:00
Gina Peter Banyard
f756b96e06
Make CSV deprecation less annoying to deal with (#15569) 2024-09-13 15:07:26 +01:00
tekimen
e73a855976
[skip ci] Add EXTENSIONS for @youkidearitai in mbstring (#15874) 2024-09-13 05:46:08 -07:00
Christoph M. Becker
aa34950344
[skip ci] Update UPGRADING wrt Deprecate GET/POST sessions RFC (#15865)
This RFC[1] has already been implemented via its respective PR[2], so
we add this information to UPGRADING.

[1] <https://wiki.php.net/rfc/deprecate-get-post-sessions>
[2] <https://github.com/php/php-src/pull/13578>
2024-09-13 12:15:09 +01:00
Derick Rethans
bab5c4a7ac
Merge branch 'PHP-8.3' 2024-09-13 11:05:47 +01:00
Niels Dossche
cd232ed328
Fix short-lived phar regression
Regressed in 1facbc385a
The macro caused the value to be read over and over, but the change to
a variable makes the condition not work like before. Just inline the
read.
2024-09-12 23:16:49 +02:00
Niels Dossche
9f0138babe
Merge branch 'PHP-8.3'
* PHP-8.3:
  Update test for changed error message format in libxml 2.13
2024-09-12 23:11:28 +02:00
Niels Dossche
d5d06be3e3
Merge branch 'PHP-8.3'
* PHP-8.3:
  Update error message for libxml 2.13
  Update libxml test for the directory field behaviour change
2024-09-12 23:07:22 +02:00
Niels Dossche
cc0464268d
Avoid copying the local name in SOAP's parse_namespace() (#15862)
The local name is either the entire input or is the last part, so we
never need to make a copy.
2024-09-12 22:41:45 +02:00
Ilija Tovilo
ffb440550c
Use APPLY_STOP in pcre_clean_cache() (GH-15839)
Once num_clean has reached 0, we never remove any more elements anyway.

Closes GH-15839
2024-09-12 22:32:23 +02:00
Gina Peter Bnayard
1facbc385a ext/phar: Use normal variable instead of macro 2024-09-12 20:41:51 +01:00
Gina Peter Bnayard
ae9d8099c2 ext/phar: Add comment about include 2024-09-12 20:41:51 +01:00
Gina Peter Bnayard
d486d65962 ext/phar: Reduce scope of some variables 2024-09-12 20:41:51 +01:00
Gina Peter Bnayard
6adffebeb8 ext/phar: Use zend_result as return value
Also simplify some calls to functions returning zend_result
2024-09-12 20:41:51 +01:00
Peter Kokot
ea4e8d513c
Autotools: Check copy_file_range with AC_COMPILE_IFELSE (#15858)
Running the test program is not required as compilation step already
errors out if needed.
2024-09-12 20:56:56 +02:00
David Carlier
adfd7de5c3
Merge branch 'PHP-8.3' 2024-09-12 18:19:53 +01:00
Dmitry Stogov
98f07fcfca
Fix more issues reported in GH-15852
* Fix incorrect register allocation

* Avoid IR binding/spilling conflict

* Add missing type guard
2024-09-12 20:19:11 +03:00
Gina Peter Bnayard
ab99161444 ext/standard/versioning.c: Slightly refactor compare_special_version_forms() 2024-09-12 18:13:01 +01:00
Gina Peter Bnayard
8109d21065 ext/standard/url.c: Stop exposing php_replace_controlchars_ex()
This is not used from a quick search on SourceGraph and this allows us to refactor it
2024-09-12 18:13:01 +01:00
Gina Peter Bnayard
d45eb46c97 ext/standard/type.c: Remove unused include 2024-09-12 18:13:01 +01:00
Gina Peter Bnayard
85e6688791 ext/standard/string.c: Remove to(upper|lower) PHP API in favour of Zend APIs 2024-09-12 18:13:01 +01:00
Gina Peter Bnayard
1b87772f40 ext/standard/string.c: Refactor php_spn_common_handler()
Main objective is to remove the PHP_STR_STR(C)SPN symbols which are only used with this static function
2024-09-12 18:13:01 +01:00
Gina Peter Bnayard
312f789e22 ext/standard/quot_print.c: Mark readonly string as const 2024-09-12 18:13:01 +01:00
Gina Peter Bnayard
5c191a45d9 ext/standard/quot_print.c: Minor refactoring to php_hex2int()
We already check, and assume, that the value is hexadecimal
2024-09-12 18:13:01 +01:00
DanielEScherzer
3c8fd93dcf
[skip ci] zend_compile.h: ZEND_ACC_DEPRECATED can be used for class constants (#15848)
Support for deprecating class constants was added to implement the PHP 8.3
deprecations in #11615, but the documentation update was missed.

[skip ci]
2024-09-12 17:52:43 +01:00
Arnaud Le Blanc
c21899a9f0
Merge branch 'PHP-8.3'
* PHP-8.3:
  Do not remove -O0 in the middle of a flag
  Fix removal of optimization cflags in debug builds (#9647)
2024-09-12 13:12:51 +02:00
Christoph M. Becker
66060b1a9e
Support building ext/gd without libxpm on Windows (GH-15846)
For GD, libxpm is an optional dependency, and we should treat it as
such, i.e. if the library is not found, we build ext/gd without XPM
support.

This should also be done for other optional dependencies (like libjpeg),
but since we're close to PHP 8.4.0RC1, we postpone that.  However, wrt
libxpm[1] we're taking action immediately, so that we can ship builds
without XPM support, or at least custom builds without XPM support are
possible without modifying the sources.

[1] <https://news-web.php.net/php.internals/125502>
2024-09-12 12:29:18 +02:00
Niels Dossche
306a51951f
Avoid allocating memory in soap get_function() (#15843) 2024-09-11 23:50:53 +02:00
David Carlier
81d580e334
Merge branch 'PHP-8.3' 2024-09-11 21:20:14 +01:00
David Carlier
ea0937b550
Merge branch 'PHP-8.3' 2024-09-11 21:16:26 +01:00
DanielEScherzer
4ffc971f62
readline: inline _readline_long_zval() function (#15840)
Unneeded wrapper around the `ZVAL_LONG()` macro
2024-09-11 20:43:21 +02:00
Niels Dossche
0d9b039568
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-15837: Segmentation fault in ext/simplexml/simplexml.c
2024-09-11 20:40:01 +02:00
Niels Dossche
ded8fb79bd
Fix UAF issues with PCRE after request shutdown
There are two related issues, each tested.

First problem:
What happens is that on the CLI SAPI we have a per-request pcre cache,
and on there the request shutdown for the pcre module happens prior to
the remaining live object destruction. So when the SPL object wants to
clean up the regular expression object it gets a use-after-free.

Second problem:
Very similarly, the non-persistent resources are destroyed after request
shutdown, so on the CLI SAPI the pcre request cache is already gone, but
if a userspace stream references a regex in the pcre cache, this breaks.

Two things that come immediately to mind:
  -  We could fix it by no longer treating the CLI SAPI special and just use
     the same lifecycle as the module. This simplifies the pcre module code
     a bit too. I wonder why we even have the separation in the first place.
     The downside here is that we're using more the system allocator
     than Zend's allocator for cache entries.
  -  We could modify the shutdown code to not remove regular expressions
     with a refcount>0 and modify php_pcre_pce_decref code such that it
     becomes php_pcre_pce_decref's job to clean up when the refcount
     becomes 0 during shutdown. However, this gets nasty quickly.

I chose the first solution here as it should be reliable and simple.

Closes GH-15064.
2024-09-11 18:49:19 +02:00
Derick Rethans
9698ad2fc0
Merge branch 'PHP-8.3' 2024-09-11 17:44:18 +01:00
Derick Rethans
e255889fea
Merge branch 'PHP-8.3' 2024-09-11 16:41:35 +01:00
Dmitry Stogov
32d67855e6
Update IR
IR commit: 4cb5282c895908cfd4547ab460de86d189d15177

Fixes GH-15662: Segmentation fault in ext/opcache/jit/ir/ir_cfg.c
2024-09-11 16:03:38 +03:00
tekimen
ee715d2049
[skip ci] Add NEWS for GH-15824 (GH-15835)
Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
2024-09-11 12:57:48 +02:00
DanielEScherzer
2ced1c926b
Add ReflectionProperty::isDynamic() as an alternative to isDefault() (#15758)
Dynamic properties are generally referred to as "dynamic" properties, while
non-dynamic properties are not commonly referred to as "default" properties.
Thus, the existing method `ReflectionProperty::isDefault()` has a non obvious
name; while an alias could be added for `isNotDynamic()`, a new `isDynamic()`
method seems cleaner. The new method returns the opposite of `isDefault()`;
dynamic properties are not present on the class by default, and properties
present by default are not added dynamically.

Closes GH-15754
2024-09-11 10:51:38 +02:00
Niels Dossche
c9862ba56e
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix bug #62900: Wrong namespace on xsd import error message
2024-09-11 09:21:59 +02:00
Niels Dossche
3665ab0118
Fix GH-15657: Segmentation fault in ext/opcache/jit/ir/dynasm/dasm_x86.h
The crash happens because the zend_persist.c code tries to JIT the hook's
op_array while the JIT buffer memory is still protected. This happens in
`zend_persist_property_info` called via `zend_persist_class_entry`
through the inheritance cache.

We shouldn't JIT the property hook code when persisting property info
for the inheritance cache.

This is a simple workaround by temporarily disabling the JIT so that the
property hook code is not JITted when persisting the property info.

An alternative solution would be to move the JITting of the property
hooks to a different place in zend_persist.c by doing an additional pass
over the classes.

Closes GH-15819.
2024-09-11 09:08:51 +02:00
tekimen
dc5f3b9562
Fix GH-15824 mb_detect_encoding() invalid "UTF8" (#15829)
I fixed from strcasecmp to strncasecmp.
However, strncasecmp is specify size to #3 parameter.
Hence, Add check length to mime and aliases.

Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
2024-09-11 09:40:35 +09:00
DanielEScherzer
db545767e5
Rename ZEND_STR_DEPRECATED to ZEND_STR_DEPRECATED_CAPITALIZED (#15831)
To match other capitalized strings like `ZEND_STR_UNKNOWN_CAPITALIZED` and
`ZEND_STR_ARRAY_CAPITALIZED`. Since this known string was only added in PHP
8.4, no backwards compatibility alias is needed.
2024-09-10 22:45:23 +01:00
Pierrick Charron
7c2204c915
Merge branch 'PHP-8.3'
* PHP-8.3:
  PHP-8.2 is now for PHP 8.2.25-dev
2024-09-10 15:27:29 -04:00
Niels Dossche
1cf98db425
Deduplicate Proxy-Authorization code from php_stream_url_wrap_http_ex() (#15818)
Extracts this code to a separate function to reduce code duplication.
2024-09-10 21:17:14 +02:00
Niels Dossche
520fce5607
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix bug #73182: PHP SOAPClient does not support stream context HTTP headers in array form
2024-09-10 20:24:57 +02:00
Calvin Buckley
15abb6e53f
[ci skip] Update NEWS for PHP 8.4.0 beta5 2024-09-10 13:12:47 -03:00
Eric Mann
09ce52af5c
Merge branch 'PHP-8.3' 2024-09-10 06:40:42 -07:00
Dmitry Stogov
7c8b3b2c96
Fix GH-15821: Core dumped in Zend/Optimizer/zend_inference.c:4062 2024-09-10 16:14:03 +03:00
Ilija Tovilo
025ed70ce3
Fix ReflectionProperty::isInitialized() for hooked props
In zend_std_has_property with ZEND_PROPERTY_EXISTS, we'd just return true when
no get hook was present. However, this function is supposed to return false for
uninitialized properties. PROPERTY_EXISTS is somewhat of a misnomer. Virtual
properties continue to always return true, given there's no backing value to
check.

Fixes GH-15694
Closes GH-15822
2024-09-10 14:46:16 +02:00
Dmitry Stogov
bdcb2185aa
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-15820: Core dumped with jit.opcache=1245
2024-09-10 15:45:00 +03:00
Niels Dossche
201c691fab
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix buffer size configuration for AArch64
2024-09-09 22:02:52 +02:00
Niels Dossche
23db89538b
Fix merge into master 2024-09-09 21:00:05 +02:00
Niels Dossche
90b91d3974
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-15658: Segmentation fault in Zend/zend_vm_execute.h
2024-09-09 20:26:50 +02:00
Niels Dossche
f56a659293
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-15661: Access null pointer in Zend/Optimizer/zend_inference.c
2024-09-09 20:12:07 +02:00
Niels Dossche
8bcfc8cc13
Implement request #47317: SoapServer::__getLastResponse()
Convenient for debugging.

Closes GH-15792.
2024-09-09 20:07:29 +02:00
Niels Dossche
5048a0650a
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix SOAP test failure on libxml2 2.13
2024-09-09 20:04:39 +02:00
Niels Dossche
b7b492b184
Deduplicate URI building code in soap schema code (#15799) 2024-09-09 19:44:09 +02:00
Ilija Tovilo
6ed730eb59
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix MSAN getservbyport() false positive
  Fix uninitialized CG(zend_lineno)
  Fix uninitialized EG(user_error_handler_error_reporting)
2024-09-09 19:35:09 +02:00
David CARLIER
b5c378c8d7
[skip ci] Fix GH-15810: Forgotten UPGRADING entry for Pdo_Pgsql::query. (#15811)
ref: GH-12476
2024-09-09 18:10:38 +01:00
Ilija Tovilo
06d02d160d
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix uouv in array_column
2024-09-09 16:58:35 +02:00
Ilija Tovilo
e97cde9f35
Merge branch 'PHP-8.3'
* PHP-8.3:
  Intercept strlcpy and strlcat for msan on Clang 17 (#12674)
2024-09-09 16:46:00 +02:00
Ilija Tovilo
0ff9e16247
[skip ci] Add missing NEWS entry for master 2024-09-09 16:44:11 +02:00
Dmitry Stogov
d670ee7d03
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix OPcache tests under specific conditions
2024-09-09 10:00:47 +03:00
Dmitry Stogov
d0acf3012e
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix OPcache tests under specific conditions
2024-09-09 09:57:49 +03:00
Dmitry Stogov
4c11168f60
Fix GH-15656: php8.4beta4 JIT erronous results (#15732)
* Improve trace SSA construction and type inference

* Fix incorrect abstract stack maintenance

* Add missing register store

* Avoid IR binding for the dangerous case

* Fix access to possibly uninitilezed variable

* Improve trace SSA construction and type inference

* Fix IR constuction

Force load values into regesters before any branches to guarantee SSA
dominance property
2024-09-09 09:28:57 +03:00
Ilija Tovilo
837a8b60bf
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix uninitialized lineno in constant AST of internal enums
2024-09-08 23:44:58 +02:00
Peter Kokot
16e218a596
Autotools: Obsolete PHP_TEST_BUILD, PHP_BUILD_THREAD_SAFE, and PHP_DEF_HAVE (#15802)
The PHP_BUILD_THREAD_SAFE macro is a simple wrapper around setting the
enable_zts variable and can't be used in PHP extensions realistically.

The PHP_TEST_BUILD macro might produce warnings on certain compiler
configurations and default AC_* macros like AC_LINK_IFELSE,
AC_CHECK_LIB, or AC_CHECK_FUNC are better suited for such checks. Also,
a quick browse through the open-source PHP extensions doesn't find
usages of this macro except in imap extension where patch is was already
sent:
https://github.com/php/pecl-mail-imap/pull/11

PHP_DEF_HAVE is a wrapper around AC_DEFINE and using AC_DEFINE_UNQUOTED
and AS_TR_CPP are better suited for this task where also help text can
be passed. Usages in the open source PHP extensions have been checked and
patches sent where found.
2024-09-08 21:09:48 +02:00
Peter Kokot
dfdec2d550
Autotools: Refactor PHP_TEST_BUILD checks (#15798)
- The libgd sanity check is there only to check whether all current
  linked libraries for the bundled libgd work together, otherwise it is
  probably even redundant a bit; this refactors it to a simpler
  AC_LINK_IFELSE check with default empty C program by Autoconf
- The IBM DB2 sanity check is simplified with AC_CHECK_FUNC instead
2024-09-08 21:05:30 +02:00
Peter Kokot
b97a60c9a3
Autotools: Check Apache version with apxs and HTTPD_VERSION variable (#15476)
The apxs -q HTTPD_VERSION variable is available since Apache 2.4.17.
This change obsoletes the PHP_AP_EXTRACT_VERSION macro and checks the
version in the config.m4 file directly. Version is checked against the
dotted format instead of the version number.
2024-09-08 20:13:48 +02:00
Christoph M. Becker
edcd6cc564
gai_strerror() is not thread-safe on Windows (GH-15568)
First we refactor to have only a single usage of `PHP_GAI_STRERROR()`
left; then we drop the macro in favor of calling the different
functions conditionally in an ad-hoc style.

This is necessary because the return value of `php_win32_error_to_msg`
needs to be freed by the caller.

The error messages are no more inline with other error messages, since
`gai_strerror()` apparently always appends a period and a space.

We also properly configure IPv4/v6 on Windows.  Since WSPiApi.h has been
created in 2000, so we can safely assume that it is available everywhere
nowadays.  Furthermore, `gai_strerror()` is available regardless of
whether there is IPv6 support.
2024-09-08 16:16:40 +02:00
Christoph M. Becker
50b3a0d011
Add comments about internal headers (GH-15689)
A common convention is to name internal C header files as `*_int.h`.
Since a couple of these are actually installed, we add comments that
this is not supposed to happen, (a) to avoid installing further
internal headers, and (b) to pave the way to fix this in the next major
PHP version.

Somewhat special is php_gmp_int.h, where "int" is meant as abbreviation
for "interface".

Another common convention is appending `_priv` or `_private`, but since
there have not been any issues regarding these headers so far, we
refrain from adding respective comments to these headers.

Anyhow, it might be a good idea to introduce some common naming
convention for such internal/private headers.
2024-09-08 16:11:25 +02:00
Niels Dossche
7771ec07e5
Fix bug #61525: SOAP functions require at least one space after HTTP header colon
HTTP/1.1 does not require a single whitespace after the colon, and
SoapServer does implement HTTP/1.1. The header value is already correctly
whitespace-trimmed, so no behaviour change happens w.r.t. header values.

Closes GH-15793.
2024-09-08 10:42:30 +02:00
Peter Kokot
0f3b2e506b
Autotools: Move extension setup to main check (#15797)
Also, redundant PHP_MBREGEX check is removed and wrapped in a single
"if" check.
2024-09-08 08:31:21 +02:00
Peter Kokot
6d6bf0530a
Autotools: Enable adding a list of paths in PHP_ADD_INCLUDE (#15777)
This enables adding multiple include paths. For example:

    PHP_ADD_INCLUDE([
      $abs_srcdir
      $abs_builddir
      $abs_srcdir/main
      $abs_builddir/main
    ], [1])

The 2nd argument "prepend" is now validated at Autoconf compile time
instead of the configure time.
2024-09-08 06:57:31 +02:00
Peter Kokot
e358634cdc
Sync Zend/*_i386_sysv_elf_gas.S with upstream (#15788)
This is a sync with upstream already fixed in early 2024 which fixes
64-bit builds on 32-bit hosts. PHP's bundled config.guess sets the
host_alias, for example, on Solaris systems to 64-bit if the compiler
supports it even though the architecture is actually 32-bit. These
assembly files resolve this situation in a build-system-agnostic way by
including the architecture file that is supported by the compiler.
2024-09-07 21:27:02 +02:00
Daniel Ruf
dfe6c13850
Fix typo (#15780)
* Fix typo

* Implement conditional message

* Use suggested code with ternary

* Wrap ternary

Co-authored-by: Peter Kokot <peterkokot@gmail.com>

---------

Co-authored-by: Peter Kokot <peterkokot@gmail.com>
2024-09-07 15:25:02 +02:00
Niels Dossche
ac0931d37a Reuse bcmath_check_scale() 2024-09-07 12:26:59 +02:00
Niels Dossche
2e88916b58 Move bcmath_check_scale() 2024-09-07 12:26:59 +02:00
Niels Dossche
f1b4e1276c Simplify bcmath_check_scale()
The scale is default-initialized to 0, so we can simplify the code a
bit.
2024-09-07 12:26:59 +02:00
Peter Kokot
94ecc1fe7d
Autotools: Sync CS for PHP_PWRITE_TEST and PHP_PREAD_TEST (#15774)
- AS_* macros used
- Arguments quoted
- Cache variable ac_cv_pread renamed to php_cv_func_pread
- Cache variables ac_cv_pwrite renamed to php_cv_func_pwrite
2024-09-07 11:53:35 +02:00
Peter Kokot
de48b90d61
Convert CRLF line endings to LF (#15767)
This patch simplifies line endings tracked in the Git repository and
syncs them to the LF style instead of the CRLF.

Newline characters:
- LF (\n) (*nix and Mac)
- CRLF (\r\n) (Windows)
- CR (\r) (old Mac, obsolete)

To see which line endings are in the index and in the working copy the
following command can be used:
`git ls-files --eol`

Git also provides `.gitattributes` file to specify files that need
specific line endings in the working directory on all platforms (either
CRLF or LF):

```
file-with-crlf text eol=crlf
```

Changed files shouldn't cause issues on modern Windows platforms because
also Git can do output conversion if core.autocrlf=true is set on
Windows and use CRLF newlines in all files in the working tree.

Unless CRLF files are tracked specifically, Git by default tracks all
files in the index using LF newlines.
2024-09-07 11:03:32 +02:00
Peter Kokot
5ea6b044cd
Autotools: Fix gd extension -I flag for bundled libgd (#15786)
The ext_srcdir variable is at time of writing set only after calling the
PHP_NEW_EXTENSION. Other extensions also use @ext_srcdir@ template
placeholder for these cases. This fixes wrongly set include flag even
though build also works without libgd include flag.
2024-09-07 09:46:06 +02:00
DanielEScherzer
4a4574290f
[skip ci] docs: fix constant syntax in stubs.rst (#15785)
Constants are declared with `=` not `:`
2024-09-07 08:22:10 +01:00
DanielEScherzer
047f0c9657
userland_declaration_error_class_const.phpt: fix test name (#15784)
Unlike the `userland_declaration_error_const.phpt` test, the point of this test
is to demonstrate using a class constant as the default parameter. See also the
corresponding internal_declaration_* tests.

[skip ci]
2024-09-07 07:37:05 +02:00
Peter Kokot
56400f709b
Autotools: s/M4 macros/Autoconf macros (#15778)
M4 macros would mean macros for M4 language like m4_normalize() and
similar. Macros defined with AC_DEFUN are better called simply Auotoconf
macros.

[skip ci]
2024-09-07 05:53:00 +02:00
Bob Weinand
25d761623c
Make internal run_time_cache a persistent allocation (#15040)
We also add zend_map_ptr_static, so that we do not incur the overhead of constantly recreating the internal run_time_cache pointers on each request.
This mechanism might be extended for mutable_data of internal classes too.
2024-09-07 01:45:26 +02:00
Derick Rethans
2f3224ea41
Updated to version 2024.2 (2024b) 2024-09-06 12:33:39 +01:00
Derick Rethans
8fcd0ccecf
Empty merge 2024-09-06 12:33:38 +01:00
Peter Kokot
e0e6d326e2
Autotools: Sync CS in PHP_PROG_AWK (#15772)
- AS_* macros used
2024-09-06 12:10:50 +02:00
Peter Kokot
418329226a
Autotools: Sync CS in php.m4 (#15771)
- AS_* macros used
2024-09-06 09:31:52 +02:00
Peter Kokot
bcbf7bea92
Autotools: Replace uname with host_alias for finding Solaris (#15770)
This wraps checks in AC_CACHE_CHECK and replaces the "uname -sr" command
with simpler $host_alias as it is already set by the config.guess script
properly.
2024-09-06 08:44:10 +02:00
Peter Kokot
824f55ae84
Sync Zend/asm/make_ppc64_sysv_macho_gas.S with upstream (#15769)
There was a typo in make_ppc64_sysv_macho_gas.S with missing closing
multi-line comment. Upstream fixed it in ~2023:
https://github.com/boostorg/context/
2024-09-06 08:42:44 +02:00
Peter Kokot
aebe63dd0f
Autotools: Sync CS for PHP_RUNPATH_SWITCH (#15768)
- AS_VAR_IF macros used
- AC_CACHE_VAL and AC_MSG_CHECKING replaced with AC_CACHE_CHECK
- arguments quoted
2024-09-06 08:41:09 +02:00
DanielEScherzer
f17c220388
[skip ci] Zend/tests/return_types/never_generator.phpt: fix test name (GH-15757)
The test is unrelated to parameter types, likely left over from a copy-paste
with never_parameter.phpt
2024-09-05 19:26:26 +02:00
DanielEScherzer
e1f7197f89
[skip ci] zend_compile.h: ZEND_ACC_FINAL can be used for constants (GH-15764)
There was a whole RFC about this, but the implementation in #6878 seems to have
missed updating the documentation
2024-09-05 19:22:07 +02:00
Christoph M. Becker
6732b8892d
Support --openssl-legacy-providers on Windows, too (GH-15747)
This is not necessarily useful for Windows (few use custom builds on
that platform), but for feature parity with other platforms it seems
reasonable to support it on Windows.

We make sure, though, that the feature is not enabled for snapshot
builds by adding the option to the build exclusions.
2024-09-05 10:49:16 +02:00
Peter Kokot
438b781a80
Update skeleton extension .gitignore (#15738)
This adds:

- config.cache produced by: ./configure -C
- config.nice.bat, configure.js and configure.bat on Windows when using
  phpize

[skip ci]
2024-09-05 07:14:29 +02:00
Daniel Scherzer
29f9f903b1
backporting GH-15755 fix. 2024-09-05 02:02:36 +01:00
David Carlier
1e62d203a6
Merge branch 'PHP-8.3' 2024-09-05 01:55:58 +01:00
DanielEScherzer
9b7dac4532
[skip ci] update NEWS for GH-15731 (#15756) 2024-09-05 00:26:31 +01:00
DanielEScherzer
5a18279b5d
Fix GH-15731: Prevent #[AllowDynamicProperties] on enums (#15733) 2024-09-04 23:56:18 +01:00
Levi Morrison
6435bb5ae1
Interrupt while internal frame is on the stack (#14627)
* Check VM interrupt while internal frame is on top

* Use tab instead of spaces

* fix frame used in interrupt and refactor

* remove unused failures for zend_jit_check_timeout

* Fix JIT support

Co-authored-by: Bob Weinand <bobwei9@hotmail.com>

* Fix the missing store to vm_interrupt

* Rename new functions

* Special case zend_interrupt_function in JIT code

* refactor to use ZEND_VM_SET_OPCODE_NO_INTERRUPT

* Split atomic exchange into load + store

It is difficult to determine performance of atomics sometimes. In this
case, the separate load+store is still correct, and a load does not
cause a modification, and might be faster for some platforms than an
exchange. A load+store is slower than an exchange, but we're fine
trading the penalty to the slow path and keeping the happy path faster.

---------

Co-authored-by: Bob Weinand <bobwei9@hotmail.com>
2024-09-05 00:35:55 +02:00
Peter Kokot
816aea797b
Autotools: Mark always-shared extensions with ext_shared variable (#15739)
This makes future config.m4 files changes simpler in case of adding
additional checks, macro calls etc. Or if these extensions configuration
would change at some point.
2024-09-04 23:28:29 +02:00
Peter Kokot
035b0c50bc
Autotools: Sync CS in PHP_EVAL_LIBLINE (#15737)
- AS_* macros used
- arguments quoted
- redundant quotation of variable-variable simplified from [$]$2 to $$2
  (see Autoconf documentation)
2024-09-04 23:27:20 +02:00
Peter Kokot
6cd0e50845
Autotools: Document the EXTENSION_DIR environment variable (#15743) 2024-09-04 23:25:50 +02:00
DanielEScherzer
f9d01e46fe
#[AllowDynamicProperties] validation: improve error messages (#15734)
For traits and interfaces, include the name of the relevant trait (or
interface) in the error message, the same way it is included for readonly
classes.
2024-09-04 22:54:42 +02:00
Christoph M. Becker
1d36927127
Support SHA256_Transform_shani() with MSVC, too
Closes GH-15312.
2024-09-04 18:07:59 +02:00
Christoph M. Becker
5d1181fb3f
Fix GH-15742: php_hash_sha.h incompatible with C++
Not only MSVC doesn't support this construct, but apparently it is
generally not supported by C++ compilers.

Closes GH-15745.
2024-09-04 17:25:43 +02:00
DanielEScherzer
d552fbd9f7
zend_get_constant_ex() - remove commented out handling of class constants (#15728)
Was factored out into a dedicated method, `zend_get_class_constant_ex()`, back
in 2021 (4dcde9cf18) but instead of removing the
old logic it was just commented out. If it hasn't been needed since 2021, it
should be safe to remove.
2024-09-04 16:15:27 +02:00
Christoph M. Becker
217ea732fc
Use php_error_docref() instead of zend_error() in session.c (GH-15505)
Using `php_error_docref()` is preferable since it outputs additional
details (which function has been called and whether it is a startup or
shutdown error), uses HTML markup, and also provides a link to the
documentation, if configured.

Since these deprecation warnings have been introduced recently[1][2],
i.e. for PHP 8.4, there are no BC concerns.

[1] <e8ff7c70f9>
[2] <b36eac94d2>

Co-authored-by: Máté Kocsis <kocsismate90@gmail.com>
2024-09-04 16:00:28 +02:00
DanielEScherzer
5dd0575698
Generated arginfo header files: combine preprocessor conditional blocks (#15736)
When functions' or class methods' availability is based on some preprocessor
condition, the generated arginfo header files wrap the declarations in the
preprocessor `#if` conditional blocks, one per declaration, even if they are in
the same conditional block based on comments in the stub file. Instead of
having multiple conditional blocks one after the other with the same condition,
combine them into a single conditional block.
2024-09-04 13:04:22 +02:00
Ayesh Karunaratne
24d4ae9d2f
ext/curl: No-op CURLOPT_DNS_USE_GLOBAL_CACHE constant (GH-15127)
Libcurl `CURLOPT_DNS_USE_GLOBAL_CACHE` constant is no longer supported
since libcurl[^1] 7.62. This no-ops the constant, but without causing
any deprecation notices.

[^1]: [CURLOPT_DNS_USE_GLOBAL_CACHE](https://curl.se/libcurl/c/CURLOPT_DNS_USE_GLOBAL_CACHE.html)
2024-09-04 12:40:45 +02:00
Saki Takamachi
fad899e566
[RFC] Support object types in BCMath (#13741)
Added BcMath\Number class. It is an immutable object, has methods that are
equivalent to existing BCMath calculation functions, and can also be calculated
using operators.

The existing BCMath function returned a string for each calculation, but this
class returns an object.

RFC: https://wiki.php.net/rfc/support_object_type_in_bcmath,
https://wiki.php.net/rfc/fix_up_bcmath_number_class

---------

Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
2024-09-04 11:12:51 +09:00
Peter Kokot
13f041163c
Remove Travis artefacts (#15714)
Travis was suspended https://github.com/php/php-src/pull/15314

This removes 404 errored Travis image in README, travis configuration
directory and YAML file and usages in tests.

[skip ci]

Co-authored-by: Gina Peter Banyard <girgias@php.net>
2024-09-04 01:15:10 +02:00
Peter Kokot
9a9e178328
Autotools: Enhance appending -lrt (#15719)
If the opcache extension would be built statically one day this also
takes care of this to make the check more ubiquitous.
2024-09-04 00:43:21 +02:00
DanielEScherzer
53cb89670c
Generated arginfo header files: remove empty zend_function_entry arrays (#15705)
When a class (or enum) has no methods, rather than using an array that only
contains `ZEND_FE_END`, use `NULL` for the functions. The implementation of
class registration for internal classes, `do_register_internal_class()` in
zend_API.c, already skips classes where the functions are `NULL`. By removing
these unneeded arrays, we can reduce the size of the header files, while also
removing an unneeded call to zend_register_functions() for each internal class
with no extra methods.
2024-09-03 23:19:53 +02:00
Máté Kocsis
7dfbf4d1b7
Merge branch 'PHP-8.3'
* PHP-8.3:
  Add missing return for DatePeriod::__unserialize
2024-09-03 21:32:03 +02:00
Christoph M. Becker
8a2015451a
Fix dba tests wrt resource to object conversion (GH-15716)
We should not pretend that there are still user-visible resources,
since we're dealing with objects now.
2024-09-03 14:23:57 +02:00
Christoph M. Becker
3892529fed
Close-GH 15685: improve proc_open error reporting on Windows
While similar errors are already reported via `strerror()` on other
platforms, this has apparently overlooked for Windows, where only the
error code has been reported so far.

We adapt the affected test cases, but since there is no PHP userland
function which allows us to get the current system locale, we work
around.

Closes GH-15687.
2024-09-03 13:12:27 +02:00
Ilija Tovilo
7f0d2574f0
Simplify a-vis error message 2024-09-03 12:18:07 +02:00
Ilija Tovilo
407bc092db
[skip ci] Fix NEWS reflection category 2024-09-03 11:33:04 +02:00
Daniel Scherzer
18df69ee34
ReflectionProperty::get{Hook,Hooks}(): handle dynamic properties
For dynamic properties, instead of crashing with a segmentation fault, just say
that there are no hooks. Also includes a test to prevent regression.

Fixes GH-15718
Closes GH-15721
2024-09-03 11:31:15 +02:00
Dmitry Stogov
a7f789ec56
Update IR
IR commit: 17fa2605a526d9512224123c0e7e565307a17fe9
2024-09-03 10:26:14 +03:00
Niels Dossche
0d616d1b82
Fix GH-15693: Unnecessary include in main.c bloats binary
Closes GH-15700.
2024-09-02 21:54:13 +02:00
Niels Dossche
98dc77f660
Fix GH-15690: ext-dba failures on 32-bit (#15691)
The wrong type was used in the size calculation. On 64-bit this
coincidentally doesn't cause issues, but on 32-bit it does because of
different padding vs 64-bit resulting in a different size.

Regressed in 2097237.
2024-09-02 21:46:05 +02:00
Dmitry Stogov
faa1904fb6
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-15652: Segmentation fault in the Zend engine when JIT enabled (#15717)
2024-09-02 21:59:14 +03:00
Peter Kokot
db9a7aaf05
Autotools: Sync CS in configure.ac (#15706)
This further replaces more raw shell usages with AS_* macros.
2024-09-02 19:00:58 +02:00
Peter Kokot
45ebe47569
Autotools: Sync CS in ext/openssl 2024-09-02 18:39:11 +02:00
Christoph M. Becker
6d5962074f
Dynamically xfail test cases which fail on CI (GH-15710)
This is a stop-gap measure for GH-15709 to keep CI green.
2024-09-02 18:23:52 +02:00
Ilija Tovilo
2b8a1b4258
Forbid a-vis on unilateral virtual prop
The get-only case is obvious, there is no set operation so specifying its
visibility is senseless. The set-only case is also questionable, since there is
no operation other than set, so changing the visibility of the entire property
is preferable.

Closes GH-15698
2024-09-02 17:40:30 +02:00
Remi Collet
b81f9722db
[ci skip] NEWS and UPGRADING for PASSWORD_ARGON2 on openssl 2024-09-02 13:13:54 +02:00
Remi Collet
32c5ce3451
Implement GH-13514 PASSWORD_ARGON2 from OpenSSL 3.2 (#13635)
* Implement GH-13514 PASSWORD_ARGON2 from OpenSSL 3.2

* simplify init/shutdown

* use php_base64_encode_ex

* - rename macros - use openssl RAND_bytes - CS

* add --with-openssl-argon2 build option

* check OSSL_KDF_PARAM_ARGON2_LANES instead of OSSL_set_max_threads

* Cleanup and CS

* save/restore old threads config + CS

* remove unneeded check
2024-09-02 13:01:09 +02:00
Ilija Tovilo
64bd828394
[skip ci] Update mysql versions for libmysql build 2024-09-02 12:31:56 +02:00
Ilija Tovilo
e7c2017fc6
Merge branch 'PHP-8.3'
* PHP-8.3:
  [skip ci] Backport libmysql build fix (d9a9696)
2024-09-02 12:09:42 +02:00
Christoph M. Becker
4dc77953eb
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix run-tests.php to propagate status code on Windows
2024-09-02 00:53:02 +02:00
Peter Kokot
8699da6f33
Autotools: Document PHP environment build configuration vars (#15684)
This marks the following environment variables as precious:

- PHP_BUILD_ARCH
- PHP_BUILD_COMPILER
- PHP_BUILD_PROVIDER
- PHP_BUILD_SYSTEM
- PHP_UNAME

Meaning, they are now also shown in the `./configure --help` output, and
they can be used like this when configuring the PHP build:

    ./configure PHP_BUILD_ARCH="..." PHP_BUILD_COMPILER="..."  ...
2024-09-01 23:57:33 +02:00
Niels Dossche
5ca4d8828d
Remove redundant 'zobj->ce->__isset' check (#15699)
This became unnecessary due to the addition of lazy objects that added
the goto when '!zobj->ce->__isset' above.
2024-09-01 23:10:54 +02:00
Jorg Adam Sowa
2a30f2ffc4
Add type indicator to array/arg unpack error messages (GH-15448) 2024-09-01 22:57:12 +02:00
Peter Kokot
de6658531f
Autotools: Fix iconv shared build with external library (#15686)
When building iconv as shared and with external library (for example, libiconv):

    ./configure --with-iconv=shared,/path/to/libiconv

the iconv couldn't be found due to a linker error.

Autoconf places LDFLAGS before the conftest.c file in the test compile
command and LIBS after it. GCC also requires this:

    gcc -L... conftest.c -liconv

Similar issue discovered at
https://github.com/remicollet/php-xpass/pull/1
2024-09-01 22:06:37 +02:00
Ayesh Karunaratne
fde34bc1e8
ext/curl: Update UPGRADING and NEWS for GH-13255 (#15668)
[ci skip]
2024-09-01 18:55:34 +02:00
jrfnl
95c5a5a959 [skip ci] PHP 8.4 changelog: fix typo in new constant
Ref: PR 15479 / d713e3619e
2024-09-01 18:51:31 +02:00
jrfnl
ced1e4509a [skip ci] PHP 8.4 changelog: add MYSQLI_TYPE_VECTOR to new constants
Ref: PR 15431 / a1ab846231
2024-09-01 18:51:31 +02:00
jrfnl
7bfd9d4a63 [skip ci] PHP 8.4 changelog: more alphabetic order fixes 2024-09-01 18:51:31 +02:00
Christoph M. Becker
c013679b70
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-15552: Signed integer overflow in ext/standard/scanf.c
2024-09-01 17:26:46 +02:00
Christoph M. Becker
0b1e401f2c
Skip tests calling wmic if it is not available
The WMIC utitlity is deprecated as of Windows 10 21H1, and a feature on
demand which is enabled by default in Windows 11 22H2 and 23H2, but
will be disabled by default in the next release of Windows.[1]

Therefore, we ensure that tests which rely on wmic.exe are properly
skipped if it is not available.

[1] <https://learn.microsoft.com/en-us/windows/whats-new/deprecated-features#deprecated-features>

Closes GH-15583.
2024-09-01 17:19:37 +02:00
Christoph M. Becker
2bb5dea7b1
Merge branch 'PHP-8.3' [skip ci]
* PHP-8.3:
  Mark gd14930.phpt as dynamic xfail
2024-09-01 15:06:31 +02:00
Christoph M. Becker
55f519b178
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-15628: php_stream_memory_get_buffer() not zero-terminated
2024-09-01 14:58:14 +02:00
Christoph M. Becker
a57ce052cd
Don't export php_pdo_int.h
This is, as the name and a comment in the header imply, an internal
header which is not supposed to be used by extensions other than PDO
(not even by drivers).

Since there is apparently no need to include this header in the parsers
of the drivers, we remove these includes, and no longer declare the
header to be installed.  Given that the header is only exported for a
couple of weeks[1], this is not considered to be a BC break, because
it's unlikely that external drivers have already been adjusted to use
this header, and otherwise they can still be fixed; PHP 8.4 is still in
the pre-release stage.

[1] <https://github.com/php/php-src/pull/14797>

Closes GH-15688.
2024-09-01 13:33:53 +02:00
Peter Kokot
1a126c540a
Autotools: Normalize flags arguments (#15671)
This is a follow up of 7edb9a07d7 that
provides passing compilation options to PHP_NEW_EXTENSION,
PHP_ADD_SOURCES, PHP_ADD_SOURCES_X, and PHP_SELECT_SAPI as a
blank-or-newline-separated argument.
2024-09-01 01:02:40 +02:00
Christoph M. Becker
0f8259e896
ICU 75.1 requires C++17 (GH-15678)
This needs to be explicitly enabled for MSVC (and probably clang on
Windows); otherwise the default is C++14, which is no longer sufficient
for ICU[1].

While the official PHP 8.4 builds for Windows do not yet use ICU 75.1,
that may change[2].  And even if not, it would be nice for custom
builds to be able to build against ICU 75.1 (or later).

Anyhow, using `std:c++17` is fine for ICU 72.1 which we are currently
using (and likely for some older ICU versions).

[1] <https://github.com/unicode-org/icu/releases/tag/release-75-1>
[2] <https://github.com/winlibs/icu4c/pulls>
2024-08-31 17:01:49 +02:00
Christoph M. Becker
b3d6414b87
Drop support for building with MSC_VER < 1920
`MSC_VER` 1920 refers to Visual Studio 2019 RTW 16.0[1], and this
should be the bare minimum which we support nowadays.  If users use an
older Visual Studio version, we fail gracefully during `configure`.

[1] <https://learn.microsoft.com/en-us/cpp/overview/compiler-versions?view=msvc-170>

Closes GH-15403.
2024-08-31 17:00:21 +02:00
Ayesh Karunaratne
a8df3d1eed
ext/curl: libcurl CURLOPT_{FTP_RESPONSE_TIMEOUT,ENCODING} replacements (#15126) 2024-08-31 14:26:11 +01:00
Niels Dossche
82c504fa9c
Fix GH-15670: Polymorphic cache slot issue in DOM (#15676)
A cache slot can be hit with different DOM object types, so we should
check if we're still handling the same type.
2024-08-31 12:13:21 +02:00
Niels Dossche
73b7993b0d
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-15654: Signed integer overflow in ext/dom/nodelist.c
2024-08-31 11:56:34 +02:00
Saki Takamachi
166f343d59
[skip ci] NEWS for Fixed LONG_MAX in BCMath ext (#15663) 2024-08-31 18:23:36 +09:00
Saki Takamachi
44ec179b7e
NEWS for ext/bcmath: Fixed bcdiv() div by one (#15629) 2024-08-31 17:52:44 +09:00
Simonov Denis
eb3e7a2c0c
ext/pdo_firebird: Fixed GH-15604 Always make input parameters nullable (#15605)
Fixes #15604
Closes #15605
2024-08-31 17:06:41 +09:00
Go Kudo
b221f21b49 Merge branch 'PHP-8.3' 2024-08-31 15:58:13 +09:00
Peter Kokot
5ed1659039
Autotools: Fix pdo_mysql build with mysql client library (#15450)
When using --with-pdo-mysql=DIR and for some reason DIR wouldn't have
the executable DIR/bin/mysql_config available the 3rd option was so far
to guess the mysql client library locations and pass the include
directory further. The library directory and library name to link was
missing. This fixes this case for consistency reasons. And in the future
also the pkg-config could be a reliable alternative to mysql_config in
that case. The PDO_MYSQL_INC_DIR is already processed PHP_EVAL_INCLINE
so redundant PHP_ADD_INCLUDE is removed.
2024-08-31 02:35:34 +02:00
Peter Kokot
558ccf7362
Autotools: Add 3rd argument to dba PHP_TEMP_LDFLAGS
[skip ci]
2024-08-31 00:41:41 +02:00
Peter Kokot
b7db7708c3
Autotools: Refactor ODBC type checks (#15651)
- AS_VAR_IF macros used
- All check messages moved to the PHP_ARG_WITH 2nd argument and results
  simplified where possible (the ext_output variable and result message
  is done automatically when using PHP_ARG_* macros)
- Unusued ODBC_SHARED and ODBC_STATIC shell variables for DBMaker
  removed
- Help text for --with-unixodbc (and/or --with-unixODBC) configure
  option synced with current Autotools code. It is still possible to
  bypass the pkg-config search with optional DIR argument
2024-08-30 23:54:11 +02:00
Peter Kokot
75c797492b
Autotools: Replace backticks with $(...) in php.m4 (#15642)
This is a follow-up of GH-15639
2024-08-30 23:32:42 +02:00
David Carlier
fc01e2ee2b
Merge branch 'PHP-8.3' 2024-08-30 17:17:44 +01:00
Saki Takamachi
a27878cff3
Fixed LONG_MAX in BCMath ext (#15663) 2024-08-31 01:07:33 +09:00
Arnaud Le Blanc
58aa6fc830
Lazy objects
RFC: https://wiki.php.net/rfc/lazy-objects

Closes GH-15019
2024-08-30 17:30:03 +02:00
Ilija Tovilo
e12188fe89
Fix asymmetric visibility with set hook
Fixes GH-15644
Closes GH-15645
2024-08-30 09:42:27 +02:00
Saki Takamachi
e8fe7e4f52
ext/bcmath: Fixed bcdiv() div by one (#15629)
Fixed the incorrect scale that should be used when dividing by 1, that is,
comparing the divisor and 1 to confirm equality.

Additionally, have increased the number of test cases for bcdiv_by_pow_10.phpt.
2024-08-30 09:33:17 +09:00
Peter Kokot
09d5b7102a
Fix -Wunused-function warning in ext/pdo_firebird (#15646)
When FB_API_VER equals to 30, for example, on Ubuntu, there is this
warning thrown with certain compiler configurations:

    /php-src/ext/pdo_firebird/pdo_firebird_utils.cpp:21:13: warning:
    ‘void fb_copy_status(const ISC_STATUS*, ISC_STATUS*, size_t)’
    defined but not used [-Wunused-function]
       21 | static void fb_copy_status(const ISC_STATUS* from, ISC_STATUS* to, size_t maxLength)
          |             ^~~~~~~~~~~~~~
2024-08-30 01:22:52 +02:00
Peter Kokot
7ebdd7d05a
Trim trailing whitespace (#15649)
[skip ci]
2024-08-30 01:20:56 +02:00
Peter Kokot
b3661701e1
Autotools: Sync CS in ext/dba (part 2) (#15621)
This is a follow-up of 4f6f4fb7d5

- PHP_DBA_DB_CHECK arguments quoted and normalized
- long lines reduced a bit
- Few additional AS_VAR_IF used
- Typo in variable name ${dbdp} fixed to ${dbdp4} as there is no dbdp
  variable anymore as of 4.x and 5.x paths checks
2024-08-30 00:59:44 +02:00
Peter Kokot
1b757c8d3c
Autotools: Replace backticks command substitutions with $(...) (#15639)
This is a follow-up of previous backticks replacement commits. This
replaces backticks command substitutions in remaining ext config M4
files, phpize, and configure.ac with the recommended $(...).

Note that $(...) still does not work on some obsolete shells that ship
with Solaris 10, for example. Elsewhere they should work. However, for
these obsolete shells Autoconf also re-executes the shell script under
the supported shell so it can make them work regardless.

Additionally, few comments CS are also adjusted to not cause confusion
when searching for backticks usages and one indentation sync done.

As of Autoconf 2.72 the backticks in macro help texts are also replaced
with single quotes.
2024-08-30 00:40:49 +02:00
David Carlier
307565d577
ext/gd: porting gdImageClone to the bundled libgd version.
close GH-15640
2024-08-29 23:13:20 +01:00
Dmitry Stogov
eb89233800
Merge branch 'PHP-8.3'
* PHP-8.3:
  Don't set IS_STR_PERMANENT flag for strings stored in the file cache (#15643)
2024-08-30 01:01:33 +03:00
Peter Kokot
0a6019a7d6
Autotools: Use SED variable for sed command (#15641)
This syncs sed usages across the build system as SED variable is set to
a suitable sed program on the system.
2024-08-29 23:46:04 +02:00
Dmitry Stogov
80efb3aba4
Merge branch 'PHP-8.3'
* PHP-8.3:
  Prevent possible incorrect optimization caused by ZEND_ASSUME()
2024-08-29 23:12:56 +03:00
Niels Dossche
367f303efa
Optimize DOM property access (#15626)
For the read and write implementation, store the handler pointer in the
first cache slot.
For the write implementation, use the second cache slot to store the
property info.

For a micro-benchmark that performs a write:
```php
$dom = new DOMDocument;
for ($i=0;$i<9999999;$i++)
        $dom->strictErrorChecking = false;
```

I obtain the following results on an i7-4790:

```
  ./sapi/cli/php ./write.php ran
    1.42 ± 0.08 times faster than ./sapi/cli/php_old ./write.php
```

For a micro-benchmark that performs a read:
```php
$dom = new DOMDocument;
for ($i=0;$i<9999999;$i++)
        $dom->strictErrorChecking;
```

I obtain the following results on the same machine:

```
  ./sapi/cli/php ./read.php ran
    1.29 ± 0.13 times faster than ./sapi/cli/php_old ./read.php
```
2024-08-29 20:13:29 +02:00
Dmitry Stogov
0268cb0343
Merge branch 'PHP-8.3'
* PHP-8.3:
  Restore error message incorrectly removed by commit 10d43c4 (related to GH-15497)
2024-08-29 17:00:43 +03:00
Dmitry Stogov
45dac39c71
Prevent JIT of propery hooks in case of file caching (related to GH-15497) 2024-08-29 16:54:25 +03:00
Dmitry Stogov
fa7eb58c11
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-15497: Opcache with file_cache and JIT enabled crashes (#15635)
2024-08-29 16:47:14 +03:00
Dmitry Stogov
d28b75f70d
Fix GH-15497: Opcache with file_cache and JIT enabled crashes (#15635) 2024-08-29 16:45:15 +03:00
Peter Kokot
7e1e450bb9
Autotools: Remove redundant double quotes (#15634) 2024-08-29 15:17:03 +02:00
Ilija Tovilo
daeb3295b2
Improve readonly avis error (GH-15618)
We don't track whether protected(set) is implicit, so for now always point out
when the property is readonly in the error message.
2024-08-29 13:19:31 +02:00
Peter Kokot
e016e3521a
Remove redundant HAVE_LIBREADLINE check (#15623)
The HAVE_LIBREADLINE is at this point only defined by Autotools and this
check is for Windows only where only HAVE_LIBEDIT is defined.
2024-08-29 12:49:34 +02:00
Peter Kokot
7edb9a07d7
Autotools: Normalize 2nd arg in PHP_ADD_SOURCES_X (#15088)
By using `m4_normalize(m4_expand([...]))`, the arguments can be split
into newlines without using backslashes and it makes working with lists
of files a bit easier.

Tested:
- variables inside the argument
- M4 macro expansions
- dnl comments
- any sequence of newlines, backslash-then-newline, multiple spaces,
  tabs...
- quoted/unquoted arguments

This now works for PHP_NEW_EXTENSION, PHP_ADD_SOURCES, PHP_ADD_SOURCES_X,
and PHP_SELECT_SAPI. The m4_normalize() usage is left in the php-src
config.m4 files following the 0a0d2d0631
for PECL extensions until phpize will be available on all supported
versions (minimum PHP 8.4).
2024-08-29 02:40:18 +02:00
Peter Kokot
8aaedbf96f
Autotools: Sync CS in ext/odbc (#15625)
- Obsolete backticks replaced with $(...); also backticks used inside
  AC_MSG_RESULT result in literal output. The $(...) works as intended
  and is executed in the shell with proper result message given
- A couple of AS_VAR_IF used
- Macro arguments quoted
- Added simplistic macro definitions headers as done with other php-src
  M4 headers for consistency of reading the code
2024-08-29 01:38:24 +02:00
Peter Kokot
fbacc0f936
Autotools: Normalize PHP_ADD_BUILD_DIR 1st argument (#15612)
The m4_normalize(m4_expand([$1])) expands the given argument if it
contains M4 macros, and then trims the items together into a space
separated string in an intuitive way.
2024-08-29 00:44:29 +02:00
Peter Kokot
0a0d2d0631
Autotools: Normalize PHP_INSTALL_HEADERS arguments (#15620)
The m4_normalize(m4_expand([...])) simplifies working with a list of
header files. The m4_normalize() is at this point still used in the
php-src config.m4 files because of copy/paste probability to community
extensions where the arguments still need to be done in the old style to
support phpize in PHP-8.3 and earlier. For example:

    PHP_INSTALL_HEADERS([ext/dom], m4_normalize([
      dom_ce.h
      namespace_compat.h
      xml_common.h
      xpath_callbacks.h
    ]))

When PHP 8.4 will be the minimum supported PHP version, the headers can
be installed without using m4_normalize() in PECL extensions. For
example:

    PHP_INSTALL_HEADERS([ext/dom], [
      dom_ce.h
      namespace_compat.h
      xml_common.h
      xpath_callbacks.h
    ])
2024-08-28 23:08:53 +02:00
Máté Kocsis
09c498233e
Use ZEND_UNCOMPARABLE for consistency 2024-08-28 22:39:23 +02:00
Niels Dossche
51d93c1947 Remove failure paths for infallible code in simplexml
For IS_STRING, sxe_object_cast_ex() will call cast_object() which cannot
fail for IS_STRING.
2024-08-28 18:02:31 +02:00
Niels Dossche
9979f4748c Remove unused parameter from match_ns() 2024-08-28 18:02:31 +02:00
Niels Dossche
2fe8dd1054 Remove unused parameter of php_sxe_reset_iterator() 2024-08-28 18:02:31 +02:00
Niels Dossche
7f37c22d22 Cleanup php_sxe_count_elements_helper() 2024-08-28 18:02:31 +02:00
Arnaud Le Blanc
180a5c3ccc
[ci skip] NEWS for GH-15330 2024-08-28 17:46:22 +02:00
Arnaud Le Blanc
bf96980104
Merge branch 'PHP-8.3'
* PHP-8.3:
  [ci skip] NEWS for GH-15330
  [ci skip] NEWS for GH-15330
  Do not scan generator frames more than once (#15330)
2024-08-28 17:45:49 +02:00
Arnaud Le Blanc
5b482b706e
Alpine/Musl nightly job (#13925)
Co-authored-by: Michael Voříšek <mvorisek@mvorisek.cz>
2024-08-28 17:28:07 +02:00
Peter Kokot
4f6f4fb7d5
Autotools: Sync CS in ext/dba (#15608)
- Macro headers synced with current PHP style (a minor description added
  and parameters)
- macro arguments quoted
- redundant double quotes reduces
- AS_VAR_IF macros used
- Redundant check message removed because there is already error thrown
  right after it
2024-08-28 14:52:24 +02:00
Peter Kokot
d9d49b2235
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix iconv_open basic test (#15611)
2024-08-28 14:31:43 +02:00
DanielEScherzer
a7695d146a
[skip ci] Zend/tests/assert/expect_015.phpt: fix typo in test name (GH-15609)
`peinter` -> `printer`
2024-08-28 11:30:02 +02:00
Saki Takamachi
674ec02e54
Fixed the sign to be PLUS if the result is 0 (#15599) 2024-08-28 08:48:33 +09:00
Niels Dossche
9b73d591c6
Avoid string duplication if possible in SimpleXMLElement::addAttribute() (#15606) 2024-08-27 23:07:20 +02:00
Niels Dossche
067eb8c0d7
[ci skip] Remove confusing comments
They are readonly / not readonly depending on the class where they're used.
However, the comment makes this confusing [1].

[1] https://github.com/php/php-src/issues/15578#issuecomment-2310389300
2024-08-27 22:24:39 +02:00
Niels Dossche
88393cfaf7
Fix GH-13988: Storing DOMElement consume 4 times more memory in PHP 8.1 than in PHP 8.0
We avoid creating backing storage by using the feature introduced in
f78d5cfcd2.

Closes GH-15593.
2024-08-27 20:14:25 +02:00
Dmitry Stogov
16d4fb19a9
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-15502: Crash with JIT and Excimer (#15601)
2024-08-27 21:12:53 +03:00
Dmitry Stogov
f0f1724fb9
Remove unintended ZEND_EXT_API usage (#15602) 2024-08-27 21:11:54 +03:00
David Carlier
c4ae645849
Follow-up on GH-15548: curl_multi_select.
throws a ValueError on timeout overflow.

close GH-15594
2024-08-27 17:05:55 +01:00
Saki Takamachi
8f3dc78da1
[ci skip] Update NEWS for PHP 8.4.0 beta4 2024-08-27 23:19:37 +09:00
Simonov Denis
8487ddb8a3
pdo_firebird: Cleanup code (GH-15510)
Since we're requiring fbclient >= 3.0 anyway, we:

* Remove unneeded `#if FB_API_VER >= 25`, `#if FB_API_VER >= 30`,
  `#ifdef SQL_BOOLEAN`

* Simplify support for new types for query input parameters.
  Support force_null for them.

* fbclient 3.0+ does not have a limit on the length of a SQL query of 64 KB.
  The new limit is 10 MB, no one in their right mind would transmit a query of such length.
2024-08-27 11:35:04 +02:00
David Carlier
3ed884fab7
[ci skip] NEWS 2024-08-27 04:59:06 +01:00
David Carlier
f7186a06e5
Merge branch 'PHP-8.3' 2024-08-27 04:57:45 +01:00
Ilija Tovilo
93799629dc
[skip ci] Add missing UPGRADING note for a-vis 2024-08-27 02:06:38 +02:00
Ilija Tovilo
8df557ac42
[RFC] Asymmetric visibility v2 (GH-15063)
Co-authored-by: Larry Garfield <larry@garfieldtech.com>
2024-08-27 02:04:48 +02:00
Peter Kokot
fef55bc8e4
Autotools: Fix tidy library checks (#15576)
When configuring with tidy library installed in non-standard paths, the
library adding macro must be done before the PHP_CHECK_LIBRARY to be
able to detect it. This fixes these edge cases. For example:

    ./configure --with-tidy=/path/to/custom-tidy-installation
2024-08-27 00:00:20 +02:00
Niels Dossche
baac01f594 Improve virtual property error message
Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com>
2024-08-26 21:17:49 +02:00
Niels Dossche
6c63c48a7e Use virtual annotation in XMLReader
All properties of XMLReader are virtual and therefore don't need backing
storage.
2024-08-26 21:17:49 +02:00
Niels Dossche
f78d5cfcd2 Allow ZEND_ACC_VIRTUAL to be used to not have property backing storage without resorting to hooks
This is useful to reduce the memory usage of objects that don't actually
use the backing storage. Examples are XMLReader and DOM. When the
properties were added to the stubs, these objects became much much
bigger, which is a waste of memory.

Closes GH-11644.

Work towards GH-13988.
2024-08-26 21:17:49 +02:00
Ilija Tovilo
606eb849bb
Stop recording of trace when encountering hook
Fixes GH-15178
2024-08-26 17:27:50 +02:00
Ilija Tovilo
b839c5f1af
Fix building of callgraph including preloaded symbols (GH-15545)
This issue was introduced in GH-15021. When building the call graph, we can now
see preloaded functions. However, building the call graph involves adding the
function to the caller list of the callee, which we don't want to do for
functions not coming from the script.

Fixes GH-15490
2024-08-26 17:22:04 +02:00
Florian Engelhardt
b9b317afd4
Export opcache shared globals (#15543) 2024-08-26 14:54:36 +02:00
Ayesh Karunaratne
a3b7cc2217
ext/curl: Add CURLOPT_PREREQFUNCTION (#13255)
Curl >= 7.80.0 supports declaring a function for `CURLOPT_PREREQFUNCTION` option
that gets called after Curl establishes a connection (including the TLS handshake
for HTTPS connections), but before the actual request is made.

The callable must return either `CURL_PREREQFUNC_OK` or `CURL_PREREQFUNC_ABORT` to
allow or abort the request.

This adds support for it to PHP with required ifdef.

 - libc: https://curl.se/libcurl/c/CURLOPT_PREREQFUNCTION.html

Co-authored-by: Gina Peter Bnayard <girgias@php.net>
2024-08-26 13:33:16 +01:00
^_^
555b603d23
mysqlnd: support ER_CLIENT_INTERACTION_TIMEOUT (#13618) 2024-08-26 12:52:26 +09:00
Ayesh Karunaratne
f61aad8f32
[skip ci] UPGRADING: Note Phar::setAlias()/setDefaultStub() return type changes (#15566)
Follow-up to GH-15426 (6836cae)

Co-authored-by: Gina Peter Banyard <girgias@php.net>
2024-08-25 21:35:38 +01:00
Peter Kokot
3f4028d3d9
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-15587: Autotools: fix configure check for aarch64 CRC32 API
2024-08-25 18:02:25 +02:00
Peter Kokot
fefa7d8c07
Autotools: Sync CS in ext/phar (#15586) 2024-08-25 17:26:21 +02:00
Peter Kokot
f88e32d4b5
Autotools: Simplify adding tidy cflags (#15577) 2024-08-25 17:25:54 +02:00
Niels Dossche
690ce6d5d4
Fix GH-15570: Segmentation fault (access null pointer) in ext/dom/html5_serializer.c
Closes GH-15572.
2024-08-25 15:09:30 +02:00
Niels Dossche
2ca4f31bc7
Update Lexbor (#15573)
Updates Lexbor to lexbor/lexbor@31d86445d0
2024-08-25 14:19:11 +02:00
Niels Dossche
904e8dc197
Merge branch 'PHP-8.3'
* PHP-8.3:
  [ci skip] Fix mistake in UPGRADING
2024-08-25 13:19:16 +02:00
Kamil Tekiela
195d59a83c Remove dead code 2024-08-25 10:32:50 +02:00
Kamil Tekiela
2446500d97 Remove unsupported mysqlnd options 2024-08-25 10:32:50 +02:00
Kamil Tekiela
082b964dfa Remove ifdefs from stub file 2024-08-25 10:32:50 +02:00
Peter Kokot
207ae12f59
Autotools: Sync CS in ext/tidy (#15561)
- AS_* macros used
- When TIDY_DIR is not set error out in its own "if" sentence
- break 2 used instead of break to exit also the first for loop
2024-08-24 23:17:22 +02:00
Kamil Tekiela
c5bce0d8a2
Deprecate disabling use_only_cookies (#13578) 2024-08-24 16:33:45 +02:00
Orlando Thöny
9c267778d2
FPM: Remove usage of non-existing MAX_LINE_LENGTH constant (#5634) 2024-08-24 15:26:58 +01:00
Flavio Heleno
67aac59cfc
Add PHP-FPM memory peak to the scoreboard
Closes #14153
2024-08-24 15:25:18 +01:00
Niels Dossche
a092bcb4d7
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-15565: --disable-ipv6 during compilation produces error EAI_SYSTEM not found
2024-08-24 14:16:40 +02:00
Máté Kocsis
8d12f666ae
Fix registration of internal readonly child classes (#15459)
Currently, internal classes are registered with the following code:

INIT_CLASS_ENTRY(ce, "InternalClass", class_InternalClass_methods);
class_entry = zend_register_internal_class_ex(&ce, NULL);
class_entry->ce_flags |= ...;

This has worked well so far, except if InternalClass is readonly. It is because some inheritance checks are run by zend_register_internal_class_ex before ZEND_ACC_READONLY_CLASS is added to ce_flags.

The issue is fixed by adding a zend_register_internal_class_with_flags() zend API function that stubs can use from now on. This function makes sure to add the flags before running any checks. Since the new API is not available in lower PHP versions, gen_stub.php has to keep support for the existing API for PHP 8.3 and below.
2024-08-24 12:36:54 +02:00
Peter Kokot
6351468a5e
Autotools: Replace break 2 with break (#15563)
As there is not nested loop here, a single break can do as well.
2024-08-24 00:49:13 +02:00
Peter Kokot
dc8f18af0b
Fix GH-15534: Bump minimum libxml2 version to 2.9.4 (#15536)
The xmlDictPtr was moved before the includes in libxml2 2.9.4 so the
<libxml/dict.h> can be included directly but for earlier versions the
<libxml/tree.h> needs to be included before. Since PHP requires libxml2
2.9.0 or later and this also fixes builds on Solaris 10.

As earlier 2.9.0-2.9.3 libxml2 versions also include several security
issues, this change bumps the required minimum libxml2 version to 2.9.4

On Windows, a check for minimum libxml2 version is also added.

Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>
2024-08-23 23:14:38 +02:00
Peter Kokot
2cbde5ae77
Autotools: Use a no-op command in PKG_CHECK_MODULES (#15562)
Instead of using a space for the "do nothing" command in the
PKG_CHECK_MODULES 2nd argument when libexslt is not found, the no-op
command ":" is perhaps a bit clearer and is in most cases used in such
scenarios and macro arguments.
2024-08-23 22:35:59 +02:00
Peter Kokot
2e3132b3fd
Autotools: Sync CS in ext/standard (#15560)
- Overquoted arguments reduced
- Added missing quotes in algorithms checks
- Synced indentations for algorithms checks
2024-08-23 22:30:09 +02:00
Gina Peter Banyard
01c6b48e31
Phar offset exist issue with entry classes not based on PharFileInfo (#14503)
* ext/phar: expand test to cover issue with offsetGet

* ext/phar: offsetExists should return false when file entry is not based on PharFileInfo
2024-08-23 21:06:28 +01:00
Niels Dossche
6a07400699
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-15551: Segmentation fault (access null pointer) in ext/dom/xml_common.h
2024-08-23 19:43:32 +02:00
Niels Dossche
d32b97a1c7
Fix NULL pointer dereference with NULL content in legacy nodes in title getting (#15558) 2024-08-23 19:38:13 +02:00
Niels Dossche
7ae7b4e388
Correctly specify secret instead of seed in ext/hash deprecation message (#15557)
Reference: 74eff98c84 (r145528001)
2024-08-23 19:37:57 +02:00
Gina Peter Bnayard
f9c69bc392 ext/phar: Reorganise some headers 2024-08-23 17:42:37 +01:00
Gina Peter Bnayard
d55074ede4 ext/phar: Use zend_string instead of char* len pair 2024-08-23 17:42:37 +01:00
Gina Peter Bnayard
51bb8cfcb5 ext/phar: Add some const qualifiers 2024-08-23 17:42:37 +01:00
Gina Peter Bnayard
6f986837ec ext/phar: Simplify a return condition in Phar::offsetExists() 2024-08-23 17:42:37 +01:00
Gina Peter Bnayard
20f7e08687 ext/phar: Use more specialized types instead of int 2024-08-23 17:42:37 +01:00
Gina Peter Bnayard
81d232fed5 ext/phar: Move some header functions into util.c
They were only used there, therefore mark them static
2024-08-23 17:42:37 +01:00
Gina Peter Bnayard
d015af60df ext/phar: Adjust return types for methods that always return true 2024-08-23 17:42:37 +01:00
Gina Peter Bnayard
03be1ac0ad ext/phar: Refactor part of tar.c 2024-08-23 17:42:37 +01:00
Gina Peter Bnayard
009039d447 ext/phar: Use size_t for string lenghts
And remove useless casts
2024-08-23 17:42:37 +01:00
Gina Peter Bnayard
947f72c181 ext/phar: Use standard naming for PHP functions 2024-08-23 17:42:37 +01:00
Gina Peter Bnayard
937c4e4ac6 ext/hash: Make return type zend_result for serialize function typedef 2024-08-23 17:41:33 +01:00
Gina Peter Bnayard
c26e77c4c5 ext/hash: Specialize copy function typedef 2024-08-23 17:41:33 +01:00
Peter Kokot
babf18c52e
Autotools: Remove obsolete compiler reset (#15549)
This was once added via 827ad656cb to
store the compiler variable when being modified due to using libtool
passing pthread_cflags to linker.
2024-08-23 16:54:21 +02:00
Peter Kokot
062e9f9134
Remove unused buffer variables (#15550)
These emit warning: unused variable 'buffer'.
2024-08-23 16:40:19 +02:00
Gina Peter Banyard
d9695401e4
Zend: Voidify virtual_cwd_(de)activate() (#15554)
It always returned 0
2024-08-23 15:28:37 +01:00
Ilija Tovilo
8fcf34d598
Remove ZEND_ACC_ABSTRACT from prop variance check
Abstract properties are now virtual, unless they actually contain concrete hook
implementations using the backing field.
2024-08-23 16:13:23 +02:00
Máté Kocsis
7e45e57d8f
Suppress deprecation notices when ext/dom properties are accessed by the get_debug_info handler (#15530) 2024-08-23 10:39:11 +02:00
Niels Dossche
793f6321e7
Fix NULL pointer dereference with NULL content in legacy nodes (#15546) 2024-08-23 08:56:06 +02:00
Jakub Zelenka
d6c06edaec
[skip ci] Update NEWS with info about GH-14930 fix which is only in master now 2024-08-22 23:50:11 +01:00
Jakub Zelenka
40e48920b9
Merge branch 'PHP-8.3' 2024-08-22 23:45:35 +01:00
Peter Kokot
f952263bcd
Fix Solaris 10 build: missing libproc.h (#15525)
The libproc.h header file was added on Solaris as of 11.4.

* Also add guard check to the entire function
* When libproc.h isn't available also sys/procfs.h is redundant
* Move the <sys/lwp.h> out of the guard
* Exclude more stuff from Solaris 10
2024-08-22 20:26:44 +02:00
Go Kudo
0c73553959
Update extension skeleton .gitignore (#15542)
[ci skip]
2024-08-22 19:31:06 +02:00
Peter Kokot
c79e723725
Autotools: Check re2c version with AS_VERSION_COMPARE (#15465)
This simplifies the version check a bit.
2024-08-22 17:39:03 +02:00
Peter Kokot
1b3c204033
Autotools: Add min-version argument to PHP_PROG_PHP macro (#15477)
This makes a bit simpler to use this macro by optionally passing the
required minimum PHP version. If version is not passed it falls back
to 7.4 as before. Minimum version also added to configure.ac.
2024-08-22 17:30:08 +02:00
Peter Kokot
4e193b4113
Autotools: Move abs_srcdir and abs_builddir to init macro (#15537)
This syncs the abs_srcdir and abs_builddir variables assignments between
the php-src build and phpize. The `&&` was picked over `;` as it is more
rigorous - the pwd command would fail if cd fails for some reason.
2024-08-22 16:26:48 +02:00
Peter Kokot
e7874f2089
Autotools: Move Zend/zend_config.h to AC_CONFIG_COMMANDS (#15538)
Instead of creating Zend/zend_config.h header file in an initialization
argument of "default" commands, this creates it in its own wrapper
when config.status is called.
2024-08-22 16:26:28 +02:00
Christoph M. Becker
6a51062c85
Drop unused, but confusing macro definition (GH-15541)
`PHP7DLLTS_EXPORTS` is not used throughout php-src, and it's unlikely
that it is used by any extension, especially since it still refers to
PHP 7.  The symbol had been introduced in 2014[1], but is not even used
in latest PHP-7.4; probably it was just supposed to be used, or part of
phpng.

[1] <fc734cf95d>

Since CI already ran for the PR, we can now [skip ci].
2024-08-22 14:58:55 +02:00
Gina Peter Banyard
35fbb0061d
main/network: Use more appropriate types (#15511)
* main/network: Use more appropriate types

And check directly against 0 for success for functions not returning a zend_result

* Remove redundant declaration in file.h

Not sure why it even is here
2024-08-22 12:48:28 +01:00
Gina Peter Banyard
15ea82da2b
ext/mysqli: Minor clean-up (#15526)
It is likely that more functions should have their return type changed to `enum_func_status` and have the return value checked against `PASS`/`FAIL` rather than assuming the inverse of boolean logic.
2024-08-22 12:34:57 +01:00
Christoph M. Becker
e5a30274d8
Support AVX-512 builds on Windows (GH-15159)
"Since limited support for `/arch:AVX512` was added in Visual Studio
2017, and expanded in Visual Studio 2019"[1], we can safely offer this
option, since PHP 8.4 is supposed to build with Visual Studio 2022, and
it is unlikely that someone tries to build PHP 8.4 with Visual Studio,
requesting AVX-512 support.

[1] <https://learn.microsoft.com/en-us/cpp/build/reference/arch-x64?view=msvc-170>
2024-08-22 13:06:28 +02:00
Christoph M. Becker
450740cbb6
[skip ci] Fix typos in XFAIL reasons 2024-08-22 11:48:46 +02:00
Jorg Adam Sowa
ff69f334f1
ext/session: Warn when providing invalid values for session.gc_probability and session.gc_divisor 2024-08-22 01:29:40 +01:00
Peter Kokot
6b809c8890
Autotools: Fix stack direction check (#15528)
On Solaris 10 and GCC 4.9 check failed with error in config.log:
error: missing binary operator before token "("

The __has_builtin must be checked in its own `#ifdef/defined` line
above the `#if __has_builtin(....` usage.
2024-08-21 22:50:11 +02:00
Gina Peter Bnayard
5853cdb73d Use "must not" instead of "cannot" wording 2024-08-21 21:12:17 +01:00
Gina Peter Bnayard
c811d58953 ext/pcntl: Use standard wording for ValueError 2024-08-21 21:12:17 +01:00
Gina Peter Bnayard
9a2fdbec48 ext/mbstring: Use standard wording for ValueError 2024-08-21 21:12:17 +01:00
Gina Peter Bnayard
997199e938 ext/standard/string.c: use standard wording for ValueError in str_pad() 2024-08-21 21:12:17 +01:00
Gina Peter Bnayard
6d9a74cde0 ext/dom: Use standard wording for ValueError 2024-08-21 21:12:17 +01:00
Gina Peter Bnayard
ad8480304d ext/dba: Remove duplicate check for empty mode 2024-08-21 21:12:17 +01:00
Gina Peter Bnayard
f6c464fee5 ext/gettext: Remove duplicate domain length checks
It not being empty is already checked by PHP_GETTEXT_DOMAIN_LENGTH_CHECK()
2024-08-21 21:12:17 +01:00
Gina Peter Bnayard
10738141d7 ext/standard/exec.c: Use ZPP path modifier to check for nul bytes 2024-08-21 21:12:17 +01:00
Gina Peter Bnayard
e7c4d54d65 Use new helper function for "cannot be empty" ValueErrors 2024-08-21 21:12:17 +01:00
Gina Peter Bnayard
96d572a18e Zend: Add helper for "cannot be empty" ValueError 2024-08-21 21:12:17 +01:00
Peter Kokot
602a4ac735
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix bug GH-15514 (Configure error: genif.sh: syntax error)

Autotools: Refactor main/internal_functions commands

This wraps generation of main/internal_functions* files into a separate
AC_CONFIG_COMMANDS and uses a SHELL variable instead of sh command.
Autoconf sets the SHELL variable to a suitable current shell the
configure is running in.

Instead of putting the commands into the 2nd argument the 3rd
initialization argument is used like before because it is easier to read
and work with variables (AWK, EXT_STATIC and EXT_CLI_STATIC), which
would need to be assigned again for the 2nd argument.

This simplifies the configure usage on Solaris 10 C shell and KornShell
without issuing errors when executing genif.sh script.
2024-08-21 18:20:42 +02:00
Peter Kokot
c69d29ebc3
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-15515: Configure error grep illegal option q (#15516)
2024-08-21 15:57:33 +02:00
Gina Peter Bnayard
9147687b6d ext/standard/file.c: Use more appropriate types 2024-08-21 13:06:18 +01:00
Gina Peter Bnayard
369eeb73ca ext/standard/file.c: Use RETURN_BOOL() instead of if-else 2024-08-21 13:06:18 +01:00
Christoph M. Becker
d4263ddc40
Fix rename_variation12*.phpt parallel test conflicts (GH-15518)
For rename_variation12.phpt this is actually not necessary, since there
is no rename_variation11.phpt, but we still fix it to be in sync with
rename_variation12-win32.phpt which actually is prone to parallel
conflicts.

Since we already ran CI in the PR, we can now [skip ci].
2024-08-21 13:25:16 +02:00
Kamil Tekiela
0775b99d5e Fix mysqli_fetch_field_types.phpt 2024-08-21 12:14:47 +02:00
Kamil Tekiela
c290996db6 Remove MYSQLI_TYPE_INTERVAL constant 2024-08-21 12:14:47 +02:00
Derick Rethans
cce27c6725
Merged pull request #14581 2024-08-21 10:59:30 +01:00
Derick Rethans
0f7aebb61a
Add NEWS entry 2024-08-21 10:59:25 +01:00
Marc Bennewitz
d6113ba8fe
fixes #13773: DatePeriod does not take microseconds into account 2024-08-21 10:57:46 +01:00
Kamil Tekiela
69d9c12df6
Fix mysqli_stmt_get_result.phpt (#15495) 2024-08-21 01:11:31 +02:00
Peter Kokot
660a860f26
Fix GH-15501: Windows HAVE_<header>_H macros defined to 1 or undefined (#15508)
Previously the CHECK_HEADER_ADD_INCLUDE function defined the
`HAVE_<header>_H` preprocessor macros to value 0 or 1 whether the
`<header.h>` file was found. This syncs it with Autotools build system
where most of these macros are either undefined or defined to 1.

In possible edge cases where such macros might be intentionally used
like this without being aware that HAVE_HEADER_H can be 0 or 1 on
Windows:

| #ifdef HAVE_HEADER_H
| ...
| #endif

there is backwards incompatibility for PECL extensions in case the
header wouldn't exist on Windows such code wouldn't execute. However,
this is considered a bug if such case is present. From the Autotools
point of view, the check is correct though and should be used with
ifdef/defined() checks.

Help text is also synced to Autotools style:
`Define to 1 if you have the <header.h> header file.`
2024-08-20 21:10:50 +02:00
Ilija Tovilo
327588abf9
Replace OBJ_PROP_PTR_TO_NUM() with zend_get_property_info_for_slot()
I wasn't aware such a function already existed.
2024-08-20 18:44:42 +02:00
Kamil Tekiela
c5ae122b2f
Update UPGRADING 2024-08-20 17:37:56 +02:00
Kamil Tekiela
a1ab846231
MySQL 9: Add support for VECTOR type (#15431) 2024-08-20 17:34:52 +02:00
Christoph M. Becker
c9ea4d76af
Revert "Merge branch 'PHP-8.3'"
This reverts commit a2313cea5a, reversing
changes made to 588029a989.
2024-08-20 16:34:52 +02:00
Christoph M. Becker
a2313cea5a
Merge branch 'PHP-8.3'
* PHP-8.3:
  zend_max_execution_timer: fix gcc compatibility (#15447)
2024-08-20 16:31:55 +02:00
Gina Peter Bnayard
588029a989 [skip ci] Update NEWS/UPGRADING for allowed_classes option checks 2024-08-20 16:28:01 +02:00
Gina Peter Banyard
3059adae06
ext/standard: Improve checking of allowed_classes option (#15267)
* ext/standard: Add some unserializing tests

* ext/standard: Add proper type checking for values of the allowed_classes option array

* ext/standard: Check that class names are somewhat sensible for the allowed_classes option array

* Indicate type of value

* Add test for Stringable objects
2024-08-20 15:24:25 +01:00
Christoph M. Becker
efe0e73c91
Merge branch 'PHP-8.3'
* PHP-8.3:
  [skip ci] Fix NEWS
2024-08-20 16:21:53 +02:00
Christoph M. Becker
b75775ea39
Revert "Merge branch 'PHP-8.3'"
This reverts commit b363a606a4, reversing
changes made to 3ed5eee5d3.
2024-08-20 16:09:46 +02:00
Christoph M. Becker
96840072fc
Cater to raised requirement of fbclient 3.0+ for pdo_firebird (GH-15498)
We

* Document the fbclient 3.0+ version requirement

* Windows: check existence of Interface.h
  Since we now require fbclient (3.0), we can drop support for the
  Interbase gds32_ms.lib right away.

* POSIX: check for minimum required libfbclient version with fb_config

* POSIX: check for `fb_get_master_interface()`
  The existence of `isc_detach_database` is implied by this.

* POSIX: remove detection of unsupported or even wrong libraries
  libgds is for old Interbase which is incompatible with pdo_firebird for
  may years, and libib_util is a utitity library, not a replacement for
  libfbclient.

Co-authored-by: Peter Kokot <peterkokot@gmail.com>
2024-08-20 16:00:00 +02:00
Christoph M. Becker
57f02e2aba
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-15432: Heap corruption when querying a vector
2024-08-20 15:45:42 +02:00
Christoph M. Becker
b363a606a4
Merge branch 'PHP-8.3'
* PHP-8.3:
2024-08-20 15:38:34 +02:00
Christoph M. Becker
3ed5eee5d3
[skip ci] Fix bug71162.phpt xfail message (GH-15506)
The test failure is unlikely to be caused by `SessionHandlerInterface`
not being available.
2024-08-20 14:48:52 +02:00
Gina Peter Bnayard
775ca03eb8 ext/standard/crc32: Use zend_result return type and remove unused header 2024-08-20 14:18:50 +02:00
Peter Kokot
40217b2ea4
Autotools: Move auto_cflags marker to PHP_INIT_BUILD_SYSTEM (#15487)
The "hacky" auto_cflags variable is otherwise set only for the Oracle
Developer Studio compiler (which is at this point also non-usable) and
perhaps might be removed in the future but this is for now moved to the
PHP_INIT_BUILD_SYSTEM for consistent settings between the php-src build
and phpize.

The PHP_INIT_BUILD_SYSTEM is now also called sooner in phpize to match
the php-src build.
2024-08-19 22:29:20 +02:00
Ilija Tovilo
b6d7c011b8
Fix virtual properties in get_class_vars() (GH-15494)
Fixes GH-15456
2024-08-19 17:39:31 +02:00
Ilija Tovilo
60f87f29bb
Fix various hooked object iterator issues (GH-15394)
Fixes GH-15187
2024-08-19 15:46:20 +02:00
Ilija Tovilo
36b1977415
Fix missing compile error when declaring hooked props on readonly classes (GH-15439)
Fixes GH-15419
2024-08-19 14:58:55 +02:00
Ilija Tovilo
770616b823
Fix param with hooks but no visibility not treated as cpp (GH-15442)
Fixes GH-15438
2024-08-19 14:53:54 +02:00
Kamil Tekiela
144c086c46
Fix a mistake in mysqli test 2024-08-19 14:26:27 +02:00
Kamil Tekiela
6c7ff08920
Drop MYSQLI_CURSOR_TYPE_FOR_UPDATE & MYSQLI_CURSOR_TYPE_SCROLLABLE (#15486) 2024-08-19 13:54:40 +02:00
Kamil Tekiela
4baf6a643b
Fix error message and add UPGRADING entry 2024-08-19 13:19:49 +02:00
Kamil Tekiela
8f1c430954
Drop mysqli_stmt_result_metadata_sqltests.phpt (#15488)
The test is unfinished and not needed.
The functionality is already tested in other tests.
2024-08-19 13:08:14 +02:00
Kamil Tekiela
c316382acb
Remove MYSQLI_STMT_ATTR_PREFETCH_ROWS constant (#15485)
This feature was never implemented, and since the
beginning, using this constant with mysqlnd would
result in an error.
This feature was only available with libmysqlclient
which can no longer be used with mysqli.
There are no plans to implement it in the future.
2024-08-19 13:04:56 +02:00
Gina Peter Bnayard
ac3cdf54df [skip ci] Add UPGRADING.INTERNALS entry for EXIT opcode 2024-08-18 19:47:34 +02:00
Gina Peter Bnayard
ebfef2505d ext/standard/mail.c: Move php_mail_header_value_error_type enum out of header 2024-08-18 19:39:32 +02:00
Gina Peter Bnayard
a171b20c7c ext/standard/mail.c: Move macros out of the header 2024-08-18 19:33:02 +02:00
Gina Peter Bnayard
312c919a2d ext/standard/mail.c: change return type of php_mail() to bool 2024-08-18 19:32:33 +02:00
Gina Peter Bnayard
962aba3b12 ext/standard/mail.c: Reduce scope of some variable declarations 2024-08-18 19:32:20 +02:00
Gina Peter Banyard
c6e1e307a3
ext/standard: Throw a RequestParseBodyException instead of InvalidArgumentException (#15468)
Especially as this exception is thrown when there isn't an issue with an argument
2024-08-18 18:21:25 +01:00
Gina Peter Bnayard
3813ad10dc Remove unused ext/standard/basic_functions.h header inclusions
Those were probably included back in the day for the php_uint32 typedef
2024-08-18 18:20:22 +01:00
Gina Peter Bnayard
3e05c86c35 ext/standard: Remove deprecated php_uint32 and php_int32 typedefs
Use the standard uint32_t and int32_t types instead.
2024-08-18 18:20:22 +01:00
Kamil Tekiela
35ae1523d0
Remove mysqli_change_user_get_lock.phpt (#15482) 2024-08-18 19:20:04 +02:00
David Carlier
d713e3619e
ext/sockets: adding SO_BINDTOIFINDEX.
similar to SO_BINDTODEVICE but works with interface ids instead.

close GH-15479
2024-08-18 16:44:32 +01:00
Peter Kokot
80d784610a
Add date extension to dependencies (#15475)
This is at this point only meta-data information for extensions to
depend also on date extension. This is a configure phase dependency for
consistency.
2024-08-18 16:47:57 +02:00
Christoph M. Becker
ed2b45603c
Don't skip tests which are supposed to fail; mark them as xfail (#15472)
Especially regarding buggy server behavior, we should not skip those
tests, because it is unlikely that fixes to the server's behavior will
even be noticed.  Instead we mark these tests as xfail, so we get a
warning if the test succeeds, and can act appropriately.
2024-08-18 13:53:35 +02:00
Christoph M. Becker
7a9120e5f3
Avoid multiple connects in SKIPIF sections (GH-15470)
Besides checking for the ability to connect to the MySQL server, some
tests require additional checks (e.g. to be able to check for the
server's version) as skip condition.  There is no need, though, to
connect twice; instead we introduce `mysqli_connect_or_skip()` in
test_helpers.inc, which `die()`s with an appropriate error message, if
the connection can't be established, or returns the connection link
otherwise.

Co-authored-by: Kamil Tekiela <tekiela246@gmail.com>
2024-08-18 13:41:09 +02:00
Peter Kokot
dffe25bd19
Autotools: Move AWK finder to PHP_INIT_BUILD_SYSTEM (#15478)
This calls the PHP_PROG_AWK from a single place for php-src build and
phpize.
2024-08-18 13:30:03 +02:00
Christoph M. Becker
4a77ce2022
Remove unnecessary Windows specific time formatting (GH-15474)
`gettimeofday()` is supported by PHP on Windows for ages; and generally
`localtime()` is supported on Windows for a long time.  As such, there
is no need for the Windows specific formatting code.

However, the general Windows caveat regarding `time_t` applies, namely
that it is usually `__time64_t`, unless `_USE_32BIT_TIME_T` is declared,
what we do for 32bit architectures, in which case it is `__time32_t`.
Now, `struct timeval` is imported from WinSock2.h, where the members are
declared as long (i.e. 32bit on both x86 and x64).  That means passing
a pointer to `tv_sec` to `localtime()` likely fails on x64, or at least
doesn't yield the desired result.  Therefore, we assign `tv_sec` to an
appropriate `time_t` variable, and also make sure that the `time_buffer`
is zero-terminated even if the `localtime()` call still fails.
2024-08-18 12:43:41 +02:00
Christoph M. Becker
f16cb1866a
Fix ZEND_FASTCALL definition wrt. x64 Windows clang builds (GH-15425)
As is, MSVC uses `__vectorcall`, but clang uses `__cdecl`.  This
obviously is bad for interoperability (and causes link issues), and is
likely worse for FFI which offers some limited (but likely sufficient
for our purposes) support for `__vectorcall` on Windows.

Since clang claims to support `__vectorcall` as of 3.6.0, and we bumped
the requirements to clang 4.0.0 already, there shouldn't be any issues.
2024-08-18 12:20:09 +02:00
Christoph M. Becker
7fa2dbf924
Drop support for MYSQL_TEST_EXPERIMENTAL (GH-15467)
This environment variable serves to hide (parts of) tests from general
execution, and as the test failures show when that environment variable
is set, apparently it serves to hide (parts of) test from being
executed at all, thus causing test rot.

To avoid this in the future, we drop `MYSQL_TEST_EXPERIMENTAL`, and fix
the failing tests, except for mysqli_get_warnings.phpt, which appears
to be broken beyond repair, and whose most important tests are already
covered by other test cases.

Co-authored-by: Kamil Tekiela <tekiela246@gmail.com>
2024-08-18 11:07:03 +02:00
Saki Takamachi
8c704ab401
ext/bcmath: Optimize bcdiv processing (#14660)
Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
Co-authored-by: Gina Peter Banyard <girgias@php.net>
2024-08-18 17:57:27 +09:00
Kamil Tekiela
7e5171d1f6
Clean up mysqli tests (#15473) 2024-08-18 00:12:23 +02:00
Christoph M. Becker
d472866f33
Drop erroneous CLEAN section
It doesn't belong to this test case, and may actually interfere with
HTMLDocument_Windows1251.phpt[1].

[1] <2889822779>
2024-08-17 23:29:33 +02:00
Peter Kokot
41709ac89f
Update ext/mbstring and ext/snmp dependencies (#15469)
The mbstring extension requires the pcre extension and snmp extension
requires the spl extension.
2024-08-17 21:11:28 +02:00
Peter Kokot
82c4db6154
Autotools: Remove PHP_LIBDIR adjustment in pdo_dblib (#15463)
This is redundant in current state of the build system as --with-libdir
option sets the location and by default it is set to "lib". It is also
done by phpize.
2024-08-17 18:39:49 +02:00
Peter Kokot
6050a99cb8
Autotools: Sync CS in pdo_odbc (#15466)
- Obsolete backticks replaced with $(...)
- Few redundant double quotes around variables removed
- AS_VAR_IF used
- indentation synced
2024-08-17 18:39:31 +02:00
Gina Peter Bnayard
a1b1a6c925 [skip ci] Remove dead code 2024-08-17 18:14:47 +02:00
Kamil Tekiela
0dfafdbc85
Remove PHP 6 leftovers and fix mysqli tests (#15464) 2024-08-17 18:05:01 +02:00
Christoph M. Becker
a3196b3f72
Drop support for MYSQL_TEST_SKIP_CONNECT_FAILURE (#15461)
Closes GH-15457.
2024-08-17 17:45:07 +02:00
Peter Kokot
0064c42215
Autotools: Simplify PHP_PDO_DBLIB conditions
The PHP_PDO_DBLIB value no is already checked in the main if sentence.
2024-08-17 15:10:10 +02:00
Peter Kokot
b2640ee7f7
Autotools: Replace obsolete backticks with $(...) in apache2handler (#15454)
Obsolete backticks can be replaced with the recommended $(...) (on
shells where the "newer" style still doesn't work, for example, on
Solaris 10 default shell, Autoconf takes care of that by re-executing
the script itself).
2024-08-17 14:37:32 +02:00
Peter Kokot
b86dfd76a2
Remove php_win32_init_gettimeofday declaration (#15451)
* Remove php_win32_init_gettimeofday declaration

Follow-up of GH-15400 (25afbdb09e).

* Remove unused header include

* Include php.h before win32/ioutil.h
2024-08-17 13:58:40 +02:00
Peter Kokot
8db3d36f2f
Autotools: Remove redundant SAPI_SHARED assignment (#15453)
When the target system is Darwin, the SAPI_SHARED is already set to
libs/libphp.so (instead of libs/libphp.dylib) in configure.ac and in
php.m4 via PHP_SHLIB_SUFFIX_NAMES.
2024-08-17 10:02:33 +02:00
Peter Kokot
a400298d96
Add hash extension to soap dependencies (#15449)
This adds the hash extension to the configure phase as a required
dependency.
2024-08-17 00:20:20 +02:00
Peter Kokot
565a31c7c5
Autotools: Simplify PHP_SELECT_SAPI in apache2handler SAPI (#15444) 2024-08-17 00:19:44 +02:00
Juliette
4c5767f62f
PHP 8.4 | Exit as function: fix incorrect parameter name (#15433)
Follow up on 13483

As previously reported in https://github.com/php/php-src/pull/13483#discussion_r1718546927:

> The parameter names seem to be incorrect.
>
> It should be `$status`, not `$code`.
>
> The RFC explicitly uses that parameter name in the proposal: https://wiki.php.net/rfc/exit-as-function#proposal
>
> It is also the name already used in the [manual](https://www.php.net/exit).
>
> Lastly, the parameter name `$status` better covers what can be passed: either a status _message_ or a status _code_.
> While `$code` would read pretty weird when passing a message:
> ```php
> exit(code: 'message');
> ```

This commit attempts to fix this.

Includes adding a test for exit/die using a named argument.

Co-authored-by: jrfnl <jrfnl@users.noreply.github.com>
2024-08-16 22:35:16 +01:00
Go Kudo
f0d0293748 Merge branch 'PHP-8.3' 2024-08-16 20:27:35 +00:00
Go Kudo
5df1b55038 [ci skip] fix NEWS 2024-08-16 20:26:31 +00:00
Go Kudo
05d92db5e5 Merge branch 'PHP-8.3' 2024-08-16 20:23:14 +00:00
Go Kudo
d87fd356dc Merge branch 'PHP-8.2' into PHP-8.3
# Conflicts:
#	NEWS
2024-08-16 20:21:51 +00:00
David CARLIER
b5568a008f
GH-15440: adding CURLOPT_TCP_KEEPCNT constant (8.9.0) (#15446)
close GH-15446
2024-08-16 20:47:41 +01:00
Go Kudo
bb0c32583a [ci skip] Update ext/random year for zeriyoshi in EXTENSIONS 2024-08-17 03:26:08 +09:00
Go Kudo
14390a04bb [ci skip] Update NEWS 2024-08-17 02:59:24 +09:00
Go Kudo
9168b18c84 Merge branch 'PHP-8.3' 2024-08-17 02:57:12 +09:00
Peter Kokot
80825672d1
Autotools: Fix external PCRE JIT check (#15430)
If using a custom PCRE library installation, also CFLAGS and LIBS
variables need to be adapted for the JIT check to be able to find it.
2024-08-16 19:21:13 +02:00
Peter Kokot
173965331c
Autotools: Use AS_* macros in apache2handler SAPI (#15423) 2024-08-16 18:32:13 +02:00
Peter Kokot
24387176d0
Autotools: Sync CS in sapi/cgi (#15407)
- AS_* macros used
- Indentation level synced
- Obsolete backticks replaced with recommended $(...) (on shells where
  the "newer" style still doesn't work, for example on Solaris 10
  default shell, Autoconf takes care of that by re-executing the script
  itself)
2024-08-16 18:30:51 +02:00
Go Kudo
d6afe05380
libtool: Don't remove gcov *.gcno files (#15441)
The libtool bundled with PHP is outdated and deletes *.gcno files used by
gcov during the build process.

While this issue has already been resolved upstream [1], incorporating the
fix at this point may not be practical. Therefore, we attempt to apply a
fix to the current version.

This change will enable proper coverage output for third-party PHP
extensions.

[1]: https://github.com/autotools-mirror/libtool/blob/master/NEWS#L605
2024-08-16 18:18:25 +02:00
Peter Kokot
8853cf3ae9
Autotools: Add note about PHP_ADD_EXTENSION_DEP usage
Until the AWK regex is implemented better, this macro must be called on
its own line with unquoted arguments.

[skip ci]
2024-08-15 16:40:23 +02:00
Christoph M. Becker
b0ac9bf669
Explicitly drop support for old clang versions on Windows (GH-15415)
* Explicitly drop support for old clang versions on Windows

This ensures compatibility with the typedef redefinitions we use, and
makes it clear during the `configure` stage that old compiler versions
are not supported.

See <https://releases.llvm.org/> regarding the release history of clang.

We also remove support for two number versions of clang, since as of
LLVM 4.0.0 the project uses a three number versioning scheme; see
<https://blog.llvm.org/2016/12/llvms-new-versioning-scheme.html>.
2024-08-15 14:30:23 +02:00
Remi Collet
a6b7f134a9
exit_as_funtion RFC follow-up: ensure default INI settings used in status test (#15420) 2024-08-15 11:13:32 +01:00
Gina Peter Banyard
3e226af533
ext/opcache/ZendAccelerator.c: Restrict MD5 header include to Windows (#15418)
As it is only ever used in accel_gen_uname_id() which is Windows only
2024-08-15 11:12:04 +01:00
Jorg Adam Sowa
21fa5e15f9
ext/session: session_create_id() now throws a ValueError for large prefix (#15338) 2024-08-15 11:10:18 +01:00
Peter Kokot
794ba29a57
Autotools: Fix PHP_EMBED_TYPE variable substitution (#15414)
This is a follow-up of f6dcca00bc as
Autoconf always seems to do a variable substitution, even when called
conditionally. When passing argument other than shared or static to
--enable-embed=ARGUMENT this now puts an empty string inside generated
php-config script.
2024-08-15 11:42:47 +02:00
Peter Kokot
4f4794b12d
Autotools: Sync CS in fpm SAPI (#15412)
- AS_* macros used
- obsolete backticks replaced with $(...)
- redundant double quotes removed
2024-08-15 11:39:09 +02:00
Peter Kokot
1e4ed4adaa
Autotools: Sync CS in sapi/fuzzer (#15417)
- AS_VAR_IF macro used
- redundant quotes removed
- PHP_FUZZER_TARGET macro body synced with the rest of the macros in
  php-src
- PHP_FUZZER_TARGET arguments quoted
2024-08-15 11:38:34 +02:00
Christoph M. Becker
4b2dc58651
Fix format specifiers and arguments in com_dotnet (GH-15398)
This is mostly about minor glitches (signedness or length confusion),
but also fixes two occasions where `zend_string`s still have been
regarded as `char *`.

We also add a regression test case for failing property name lookup,
since that is the most relevant issue we're fixing here.
2024-08-15 10:59:10 +02:00
Gina Peter Bnayard
04320d2fba ext/phar: Use standard C types 2024-08-15 01:02:33 +02:00
Gina Peter Bnayard
4a4aae540b Zend/zend_object_handlers.c: Remove unused include 2024-08-15 00:08:19 +02:00
Calvin Buckley
d5d537bf7c
[ci skip] Update NEWS for PHP 8.4.0 beta3
Skipping beta2 due to a release issue.
2024-08-14 18:05:48 -03:00
Calvin Buckley
9a70b7c221
[ci skip] Update NEWS for PHP 8.4.0 beta2 2024-08-14 17:30:20 -03:00
Peter Kokot
f09354e5d0
Autotools: Sync CS in sapi/cli (#15410)
- AS_* macros used
2024-08-14 21:39:19 +02:00
Peter Kokot
bca18bc585
Autotools: Sync CS in sapi/litespeed (#15409)
- AS_CASE macro used
2024-08-14 21:38:36 +02:00
Gina Peter Banyard
8093893496
ext/dba: Remove arg num check prior to ZPP checks (#15401) 2024-08-14 20:20:11 +01:00
Christoph M. Becker
ec2655f88b
Voidify getfilesystemtime() (GH-15413)
The function always returned 0, and the return values was never used,
so we declare it to return void.

While we're at it, we also fix the space indentation of the comment.
2024-08-14 21:09:26 +02:00
Gina Peter Banyard
059fe6c28b
ext/standard/php_string.h: Remove declarations that do not have an implementation (#15402)
This was overlooked, by my younger self, in GH-8195.
2024-08-14 20:04:51 +01:00
Peter Kokot
53d6ed8a6b
Autotools: Fix typo in FPM TCP_CONNECTION_INFO check (#15411)
Otherwise, the check even works with such typo, but this fixes the
TCP_CONNECTION_INFO check on macOS machines for FPM.
2024-08-14 20:05:18 +02:00
Christoph M. Becker
25afbdb09e
GetSystemTimePreciseAsFileTime() is now always available (GH-15400)
* GetSystemTimePreciseAsFileTime() is now always available

As of PHP 8.3.0, we require Windows Server 2012 or Windows 8 as bare
minimum.  Since GetSystemTimePreciseAsFileTime() is always available on
these Windows versions[1], there is no more need for the workaround
described in dllmain.c; we just can call the function directly.

[1] <https://learn.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getsystemtimepreciseasfiletime>
2024-08-14 20:00:27 +02:00
Christoph M. Becker
390088bf55
Remove detection of unsupported Windows versions (GH-15399)
Windows 2008 and Vista are no longer supported as of PHP 7.2.0, and
Windows 2008 R2 and Windows 7 are no longer supported as of PHP 8.3.0.
Therefore we remove the respective detection code, and assert that
these versions can no longer be used.
2024-08-14 19:52:47 +02:00
jrfnl
d2810f5757 [skip ci] 8.4 | UPGRADING: add missing constant
Ref: 564914ac1a (diff-c5961ea04ab805b0059964fac68d6e159095a4b56aaaded0b1b941b8768c0f52)
2024-08-14 16:57:23 +02:00
jrfnl
ddaeb203b2 [skip ci] 8.4 | UPGRADING: fix incorrect function names
Ref: 1cf8291c85 (diff-d22d5ad00ee9f000cb8c8f9a5cfb905a8de91e7dc4a633896e2c5ab4ad1513d1)
2024-08-14 16:57:23 +02:00
jrfnl
d245bf12e7 [skip ci] 8.4 | UPGRADING: move new function to correct section
The `pg_result_memory_size()` function is a new feature, not a deprecated feature.
2024-08-14 16:57:23 +02:00
jrfnl
ba321af07c [skip ci] 8.4 | UPGRADING: fix typo 2024-08-14 16:57:23 +02:00
jrfnl
d61cb70e65 [skip ci] 8.4 | UPGRADING: fix extension order
A number of times, extensions were not listed in alphabetic order.

Fixed now.

Includes a few minor fixes where extension names were using inconsistent casing across the file.
2024-08-14 16:57:23 +02:00
jrfnl
0abd54d538 [skip ci] 8.4 | UPGRADING: join PDO entries
There were multiple headers for the same PDO extensions in the "New features" section.

This joins these together.
2024-08-14 16:57:23 +02:00
jrfnl
68d5c8145d [skip ci] 8.4 | UPGRADING: add missing RFC links
Includes fixing up existing (deprecations) RFC links which didn't directly link to the section within the RFC.
2024-08-14 16:57:23 +02:00
Peter Kokot
f6dcca00bc
Autotools: Substitute PHP_EMBED_TYPE conditionally (#15396)
If passing wrong argument at --enable-embed=ARGUMENT the AC_SUBST don't
need to be used for it in php-config.
2024-08-14 16:40:10 +02:00
Tim Düsterhus
a2a3c5ba8a
hash: Consistently check for PHP_HASH_INTRIN_SHA_* to guard compilation of SHA256_Transform_shani (#15404)
This fixes the build for amd64 platforms that do not have
`HAVE_FUNC_ATTRIBUTE_TARGET`, specifically Alpine/Musl as of now.

Closes GH-15384.
Related to GH-15312.
2024-08-14 15:18:07 +02:00
Gina Peter Banyard
74bf894950
ext/standard/info.c: Throw ValueErrors on invalid inputs to php_uname() (#15385) 2024-08-14 13:20:26 +01:00
Gina Peter Bnayard
d100caa476 [skip ci] Add NEWS/UPGRADING + wording amendment for GH-13483 2024-08-14 13:52:19 +02:00
Gina Peter Banyard
a79c70f574
[RFC] Convert exit (and die) from language constructs to functions (#13483)
RFC: https://wiki.php.net/rfc/exit-as-function
2024-08-14 12:44:12 +01:00
Gina Peter Banyard
02177848e4
Replace uses of php_dirname() with zend_dirname() (#15393)
This removes some needs to include the php_string.h header
2024-08-14 12:35:47 +01:00
Ilija Tovilo
2054c3d238
Merge branch 'PHP-8.3'
* PHP-8.3:
  Disable LSAN for crashing SOAP tests (GH-14562)
2024-08-14 11:45:02 +02:00
Peter Kokot
b56f81cddc
Add configure phase dependencies to mysqlnd extension (#15380)
The hash extension is required in mysqlnd extension for using sha
functions when extended SSL is enabled (MYSQLND_HAVE_SSL).
2024-08-14 01:18:28 +02:00
Peter Kokot
6f44a0d7fe
Autotools: Use AS_* macros in embed SAPI (#15387) 2024-08-14 01:17:57 +02:00
Remi Collet
40d88cacc1
Fix test expectation for "Built by..." (#15383) 2024-08-13 21:58:44 +01:00
Gina Peter Bnayard
0b8fbacd58 ext/standard/info.c: Remove unreachable conditional branch 2024-08-13 22:26:14 +02:00
David Carlier
6e2bbc49c7
Merge branch 'PHP-8.3' 2024-08-13 21:03:12 +01:00
David Carlier
445ea01edf
Merge branch 'PHP-8.3' 2024-08-13 20:57:21 +01:00
Jakub Zelenka
bf1b0eb8ea
Merge branch 'PHP-8.3' 2024-08-13 20:17:30 +01:00
Christoph M. Becker
65c6d72319
Drop FASTCALL on variadic functions (GH-15389)
This is unlikely to be properly supported by compilers anyway, see
<https://github.com/php/php-src/pull/2975>.
2024-08-13 19:46:48 +02:00
Christoph M. Becker
6949b7bf42
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix test expectation
2024-08-13 19:26:19 +02:00
Remi Collet
589cfbb24f
Completely remove session.sid_length and session.sid_bits_per_character from INI files (#15382)
see e8ff7c70f9

[timwolla: Adjusted commit message]
2024-08-13 17:04:22 +02:00
Gina Peter Bnayard
d63caf006b ext/standard/info.c: Minor refactoring to php_get_uname() 2024-08-13 15:57:26 +01:00
Gina Peter Bnayard
ac7ed28573 ext/standard/info.c: Minor refactoring to php_get_windows_name() 2024-08-13 15:57:26 +01:00
Kamil Tekiela
8448db84a8
Mention in UPGRADING the MYSQLI_REFRESH_* constants 2024-08-13 16:23:44 +02:00
Sergey Panteleev
a68b8b557e
Merge branch 'PHP-8.3'
* PHP-8.3:
  PHP-8.2 is now for PHP 8.2.24-dev
2024-08-13 17:19:10 +03:00
Calvin Buckley
8c4d5a1814
[ci skip] Update NEWS for PHP 8.4.0 beta1
Also move this news item up to beta2 since it happened while I was
tagging beta1.
2024-08-13 11:06:32 -03:00
Ilija Tovilo
be6dee3c5d
Reset seen symbols when ending namespace (GH-15244)
Previously, seen symbols were never cleaned during the compilation of a single
file. This makes it impossible to use a class or function from a different
namespace if such a symbol is also declared within the same file. This is
inconsistent with how it would work when split into different files.
2024-08-13 15:47:14 +02:00
Gina Peter Bnayard
5622def429 Add more tests covering deprecation of _ as CE name 2024-08-13 14:37:40 +02:00
Gina Peter Bnayard
e0f6e3de34 ext/standard/info.c: Make some functions static 2024-08-13 14:10:06 +02:00
Gina Peter Bnayard
5078eb080e ext/standard/info.c: Use size_t type where appropriate 2024-08-13 14:10:06 +02:00
Gina Peter Bnayard
739805d099 ext/standard/info.c: Removed php_info_html_esc() 2024-08-13 14:10:06 +02:00
Gina Peter Bnayard
67a15cf457 ext/standard/head.c: Change return type of php_header() to bool 2024-08-13 14:10:06 +02:00
Gina Peter Bnayard
2297e50772 ext/standard/head.c: Remove some useless casts
The field type is size_t
2024-08-13 14:10:06 +02:00
Gina Peter Bnayard
91aca96a8e ext/standard/filters.c: Use bool type where possible for persistent field/param 2024-08-13 14:10:06 +02:00
Gina Peter Bnayard
9cfe9e10ba ext/standard/filters.c: Use zend_result return type instead of int 2024-08-13 14:10:06 +02:00
Gina Peter Bnayard
2baadf3807 ext/standard/filters.c: Voidify php_conv_base64_decode_ctor()
It always returned SUCCESS
2024-08-13 14:10:06 +02:00
Gina Peter Bnayard
54cc76fdb4 ext/standard/filters.c: Remove some register keywords 2024-08-13 14:10:06 +02:00
Máté Kocsis
587110c5bf
Deprecate Soft-deprecated DOMDocument and DOMEntity properties (#15369)
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#formally_deprecate_soft-deprecated_domdocument_and_domentity_properties
2024-08-13 12:39:20 +01:00
Peter Kokot
a6d7d5234b
Autotools: Fix pdo_firebird shared build (#15371)
Follow-up of GH-15230:

- Redundant variables removed
- Redundant duplicate middle newlines removed
- PHP_CXX_COMPILE_STDCXX macro arguments quoted
- When extension is built as shared the PHP_ADD_SOURCES works
  differently, and PHP_ADD_SOURCES_X needs to be used so this can be
  used:

    ./configure --with-pdo-firebird=shared
2024-08-13 10:36:26 +02:00
Peter Kokot
65e96c1e5a
Autotools: Fix phpdbg build (#15373)
With 04a67cd86c the list of source files
are now added alphabetically. Previously the phpdbg_parser.c was added
before the phpdbg_lexer.c. Which caused the
"sapi/phpdbg/phpdbg_lexer.l:8:10: fatal error: 'phpdbg_parser.h' file
not found" error.

To make the order of source files irrelevant, the Makefile substitutions
needs to be fixed - the 3rd argument of PHP_ADD_MAKEFILE_FRAGMENT macro,
which is the substitution of the $(builddir) Make variable. The
$(builddir)/phpdbg_lexer.lo was previously substituted to an absolute
path. And the relative should be used, for Make to be able to find the
dependent target.
2024-08-13 10:35:16 +02:00
Peter Kokot
10ed74e3c0
Autotools: Check cli SAPI configure checks conditionally (#15370)
This checks cli SAPI system configuration based on whether the cli is
enabled like with other SAPIs and extensions.
2024-08-13 10:34:28 +02:00
Peter Kokot
3b24b853ec
Autotools: Sync CS in ext/pdo_firebird (#15372)
- Obsolete backticks replaced with the recommended $(...)
- AS_VAR_IF used
2024-08-13 10:33:57 +02:00
Peter Kokot
540b9f5bc7
Autotools: Wrap long texts with m4_text_wrap (#15368)
The m4_text_wrap macro wraps the text into a single space separated
string which is wrapped to not exceed the line lenght of 79 characters
by default.
2024-08-13 10:33:17 +02:00
David Carlier
d052d612d9
ext/sockets: adding SOCK_CLOEXEC/SOCK_NONBLOCK options.
targetted for socket_create_pair/socket_create, they re not considered
as socket type but to be ORed with these (to avoid socketpair2/socket2
likely), set O_CLOEXEC/O_NONBLOCK respectively on the file descriptors.

close GH-15322
2024-08-13 08:35:44 +01:00
Calvin Buckley
afc5738154
Show build provider and unify version information printing (#14657)
* Show build provider information in "php -v"

Vendors such as distributions can set the `PHP_BUILD_PROVIDER`
variable, that gets printed in phpinfo. However, I find that users check
`php -v` more often than phpinfo to see what PHP they're running. The
problem with this is that it does not show that build provider
information.

This change makes the build provider information printed on an
additional line of the version information.

* Put on same line so it works with or without env var

Unbreaks build without PHP_BUILD_PROVIDER set.

* change wording in provider version text

better grammatically; many different possibilities here though

* Unify SAPI version printing

This makes it so that all of the SAPIs share the same code for printing
version information. This is useful in case of any future changes to the
version information, such as i.e. adding build provider to the output.

* Make include for php_print_version explicit

* Preserve phpdbg version and output channel

php_printf doesn't have same semantics, as phpdbg_out could be on a
different output than stdout/err. Also add the phpdbg version (in case
it differs from PHP's, to keep similar output before this PR)

* remove size variables

we don't use them and CI doesn't like unused variables

* Fix format string insecurity
2024-08-12 23:24:41 -03:00
Simonov Denis
225034dbbc
pdo_firebird: Formatting time zone types
As a follow-up to the commit which introduced support for Firebird 4.0+
data types[1], we add support for formats for types with time zones.

Since this uses the newer Firebird C++ API, pdo_firebird now requires a
C++ compiler to be built.

[1] <https://github.com/php/php-src/pull/14897>

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

Closes GH-15230.
2024-08-13 01:25:48 +02:00
Christoph M. Becker
5478d4b2c1
Merge branch 'PHP-8.3'
* PHP-8.3:
  [ci skip] `yield /*comment*/ from` is no longer a parse error
2024-08-13 00:35:02 +02:00
Christoph M. Becker
266192372c
Skip fb4_datatypes*.phpt for Firebird server < 4.0.0 (GH-15354)
Using a newer fbclient version with an older server is generally
supported, and as such we must not only skip these tests for older
fbclients, but also for older servers.

In lack of some readily available function, we're querying the server
to find its version.
2024-08-13 00:14:23 +02:00
Arnaud Le Blanc
81150187fb
Ensure proper alignment of zend_accel_shared_globals.interned_strings (#15359) 2024-08-12 21:43:43 +02:00
Peter Kokot
8c4f019cc6
Autotools: Sync CS in gd extension (#15364)
- Obsolete PHP_* variables checks removed (there was once the 'pdf'
  extension bundled in PHP that also had the same --with-*-dir configure
  options (3be17e3f26). When combined with
  the gd extension, options need to be executed conditionally; first one
  won), this is no longer relevant neither recommended practice to
  duplicate configure options inside the php-src context. Ideally,
  all configure options should be prefixed with an extension namespace
  --with-<extension-name>-<option> to be unique.
- AS_* macros used
2024-08-12 21:38:30 +02:00
Gina Peter Banyard
f5ae5ac804
ext/standard: Throw ValueErrors in str_getcsv() for invalid inputs (#15365)
This was forgotten when adjusting the behaviour of other CSV functions
2024-08-12 17:56:02 +01:00
Ilija Tovilo
a4772a0c47
[skip ci] Remove unclosed vim code folding 2024-08-12 18:50:38 +02:00
Gina Peter Bnayard
6114379ad2 ext/gmp: Refactor gmp_import_export_validate() 2024-08-12 17:30:10 +02:00
Gina Peter Bnayard
f8626638c4 ext/gmp: Use zend_string to GMP object function directly 2024-08-12 17:30:10 +02:00
Gina Peter Bnayard
d74b513f68 ext/gmp: Add test about manually (un)serializing 2024-08-12 17:30:10 +02:00
Gina Peter Banyard
0a23b0678d
Deprecate using "_" as a class name (#15360)
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_using_a_single_underscore_as_a_class_name
2024-08-12 16:10:30 +01:00
Gina Peter Banyard
c818d944cf
ext/(standard|spl): Deprecate passing a non-empty string as the $enclosure parameter (#15362) 2024-08-12 16:09:56 +01:00
Ilija Tovilo
37c22c4c7e
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix git check in verify generated files (GH-15363)
2024-08-12 16:21:35 +02:00
Ayesh Karunaratne
81b49cd062
ext/curl: Add HTTP/3 constants (#15350)
This intends to supersede the two following PRs:
 - #12000 because it does not modify the stub file, but only update the
   arginfo file. It also proposes to merge to GA branches, and is
   currently marked as Requires RM Approval.
 - #12543 Essentially the same as this PR and from the same author, as
   this, but its about a year old and requires rebasing anyway.

This adds the `CURL_HTTP_VERSION_3` and `CURL_HTTP_VERSION_3ONLY`
constants on relevant versions (7.66 and 7.88 respectively).

It is possible to use HTTP/3 without having these constants declared,
but having them declared in PHP makes things more approachable and
"official".
2024-08-12 14:26:24 +01:00
Peter Kokot
6cb6cc6f74
Autotools: Refactor iconv implementation checks (#15357)
This uses AS_* macros and checks for an iconv implementation in a single
cache check block for easier configure log output and possible future
adjustments when iconv is built-in the C library (like on Alpine and
some other systems where it isn't recognized as such yet exactly).
2024-08-12 14:43:24 +02:00
Peter Kokot
d334382eb8
[skip ci] Fix typo s/dissasembly/disassembly 2024-08-12 14:37:22 +02:00
Kamil Tekiela
8ca8d7750d
Deprecate MYSQLI_REFRESH_* constants (#15358) 2024-08-12 13:24:32 +01:00
Peter Kokot
cdf0a9b9a0
Autotools: Use AS_CASE in ext/pdo_odbc (#15355) 2024-08-12 14:21:20 +02:00
Kamil Tekiela
e6ecd83ea5
Update arginfo for mysqli and spl_fixedarray (#15356) 2024-08-12 13:37:30 +02:00
Peter Kokot
9fcc1bca8a
Remove redundant middle newlines in "Autotools" related files
This syncs few minor left-overs in "Autotools" related files:
- redundant middle newlines removed (in man pages the duplicate newlines
  are also ignored and are not visible in the man page anyway)
- Minor mixed indentation synced

[skip ci]
2024-08-12 13:18:32 +02:00
Peter Kokot
634708a14f
Add pcre as a configure step dependency to fileinfo (#15349)
The pcre is a required dependency in fileinfo extenstion. This marks it
as a configure step dependency for consistency with other extensions
and to have extensions properly sorted in the generated
internal_functions* files.
2024-08-12 00:17:29 +02:00
Peter Kokot
693ec809b9
Autotools: Remove PDO dependency related errors (#15347)
Follow-up of GH-15344 (687eb9125a)

This removes the customized error messages in PDO extensions when PDO is
not enabled (--disable-all or --disable-pdo) in favor of the default
error done by PHP_ADD_EXTENSION_DEP.
2024-08-11 21:35:36 +02:00
Gina Peter Banyard
4f58d5b0df
ext/mysqli: Deprecate passing the parameter to mysqli_store_result() (#15311)
And deprecate the MYSQLI_STORE_RESULT_COPY_DATA constant.

RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_the_second_parameter_to_mysqli_store_result
2024-08-11 19:25:35 +01:00
Gina Peter Banyard
857ce2c9e0
ext/mysqli: Mark return type as zend_return (#15345) 2024-08-11 19:24:53 +01:00
Peter Kokot
bb35da336d
Autotools: Sync CS in extensions (#15343)
- Redundant double quotes removed
- AS_* macros used
- Few nits adjusted here and there
2024-08-11 17:42:26 +02:00
Peter Kokot
687eb9125a
Autotools: Remove dependency related errors (#15344)
- ext/dom
- ext/xsl

These use the PHP_ADD_EXTENSION_DEP macro which throws error when one of
the dependencies is disabled or not configured properly.

For example:
    ./configure --disable-all --enable-dom

or
    ./configure --disable-all --with-xsl

Will throw default PHP dependency error info, when using
PHP_ADD_EXTENSION_DEP.

These errors were once done when PHP_ADD_EXTENSION_DEP macro wasn't yet
available.
2024-08-11 17:39:31 +02:00
Gina Peter Bnayard
5d1db3dd56 ext/mysqli: Improve variable name and type 2024-08-11 17:27:09 +02:00
Gina Peter Bnayard
c2bdb31b6a ext/mysqli: Remove PHP 6 remnants 2024-08-11 17:27:09 +02:00
Gina Peter Bnayard
0c827f6b25 ext/mysqli: Use an assertion for condition that is checked by ZPP 2024-08-11 17:27:09 +02:00
Gina Peter Bnayard
efd33f57c7 ext/mysqli: mysqli_report() only ever returns true 2024-08-11 17:27:09 +02:00
Gina Peter Banyard
1950d661ea
ext/mysqli: Mark function pointer as returning zend_result (#15342) 2024-08-11 15:47:57 +01:00
Jorg Adam Sowa
c4eccf33e9
ext/session: session.save_handler - add tests fortwo uncovered cases (#15337) 2024-08-11 15:39:56 +01:00
Peter Kokot
f2e50eb61f
Autotools: Sync CS in ext/pcntl (#15341)
- AC_CHECK_TYPE long list of arguments split into a newline
- Long lists in AC_CHECK_DECLS can be split across multiple lines, even
  without m4_normalize, but the end quote needs to be done properly
  after the last item without space or newline. Here the m4_normalize
  ensures all trailing blanks are trimmed and having the possibility to
  put the ending quotes on newlines also
2024-08-11 15:12:37 +02:00
Gina Peter Bnayard
caae950ff7 ext/xml: Add an explicit test case about unsetting a handler with empty string 2024-08-11 15:00:27 +02:00
Peter Kokot
b0091c4172
Autotools: Sync CS in opcache extension (#15340)
- AS_* macros used
- Overquoted AC_RUN_IFELSE macros arguments reduced
- Redundant double quoted single variables assignments removed
- i*86 and x86* patterns joined into a single case
2024-08-11 14:51:27 +02:00
Gina Peter Bnayard
8c2ebc0a56 [skip ci] Add NEWS/UPGRADING entries for mysqli deprecations 2024-08-11 14:48:17 +02:00
Jorg Adam Sowa
6bf7b7220d
ValueError on null byte in session_name() (#15286) 2024-08-11 13:26:54 +01:00
jrfnl
cb8df212aa [skip ci] 8.4 | UPGRADING: add missing entry for DBA resource to object migration
Ref: 14329

P.S.: looks like 14282 also doesn't have a mention, but that PR doesn't appear to have an impact on userland - maybe a NEWS entry ?
2024-08-11 13:14:33 +02:00
jrfnl
51a557ee62 [skip ci] 8.4 | UPGRADING: various tweaks 2024-08-11 13:14:33 +02:00
Peter Kokot
a5f8cbd93d
Autotools: Refactor mysql_config checks in pdo_mysql (#15336)
- Scattered if blocks moved together as PDO_MYSQL_UNIX_ADDR is defined
  only when mysql_config is available
- Obsolete backticks command substitutions `...` replaced with the
  recommended $(...)
2024-08-11 12:18:27 +02:00
Niels Dossche
e1c8329b8c Update TODOs in com_dotnet 2024-08-10 23:24:26 +02:00
Niels Dossche
3f54be8053 Get rid of le_dispatch 2024-08-10 23:24:26 +02:00
Niels Dossche
b7be849fad Get rid of le_istream 2024-08-10 23:24:26 +02:00
David Carlier
1d198c660c
ext/sockets: controlling ephemeral port ranges on *BSD.
whether ephemeral ports are onto the privileged low port ranges
     or a range more fit for restricted scenarios.

close GH-15335
2024-08-10 22:16:51 +01:00
Peter Kokot
1108710892
Autotools: Sync CS across the configure.ac (#15332)
- AS_* macros used where it makes it easier to read
- Redundant double quotes removed (Autoconf and shell script don't need
  these on these places directly)
- Overquoted arguments reduced in AC_RUN_IFELSE
2024-08-10 22:13:50 +02:00
Peter Kokot
e5f6387569
Autotools: Refactor pdo_mysql checks (#15334)
- Main checks wrapped in AS_CASE
- s/UNIX/Unix
- Redundant MYSQL_SOCK variable removed
2024-08-10 21:52:38 +02:00
Gina Peter Banyard
edc88ee629
ext/standard: Minor refactoring to URL scanner code (#15321) 2024-08-10 20:12:54 +01:00
Christoph M. Becker
8740fdf1f6
Support somewhat recent clang versions on Windows (GH-15324)
Prior to clang 10.0.0, `clang-cl -v` apparently always appended some
fine grained version information in parentheses[1]; this is no longer
the case, so the build fails early because the compiler version could
not be detected.  Since we never used this fine grained version info,
we no longer check for it.

As of clang 13.0.0, the `/fallback` command option has been removed[2],
so we only set the flag for older clang versions.

[1] <https://github.com/php/php-src/pull/11313#discussion_r1712097627>
[2] <https://releases.llvm.org/13.0.0/tools/clang/docs/ReleaseNotes.html#removed-compiler-flags>
2024-08-10 20:57:53 +02:00
Niels Dossche
8d7365b6f0
Fix GH-15331: dom: Element::$substitutedNodeValue test failed
Bug in libxml, amend test to accept both outputs.
2024-08-10 19:43:21 +02:00
Christoph M. Becker
9b41c8b1b5
Declare gdImageGetInterpolationMethod() for bundled GD (GH-15329)
When this function has been added to our bundled GD[1], it had been
overlooked to also declare it in gd.h, like it's done in libgd.  While
MSVC doesn't have any issues with this, clang reports an error.

[1] <03bd4333f6>
2024-08-10 16:57:48 +02:00
Niels Dossche
db5ea45f0f
Fix incorrect type check in removeAttributeNode 2024-08-10 16:31:23 +02:00
Christoph M. Becker
9c537de8a5
Fix some -Wimplicit-function-declaration errors on Windows (GH-15325)
While clang is picky about these, MSVC doesn't seem to care and would
only report the calls to undeclared functions as errors during link
time.  Still, obviously, MSVC is fine with having the declarations
during compile time.
2024-08-10 16:25:28 +02:00
Arnaud Le Blanc
c02c1d4474
Change YIELD/YIELD_FROM to do not increment opline (#15328)
YIELD and YIELD_FROM increment opline before returning, but in most places
we need the opline to point to the YIELD and YIELD_FROM.

Here I change YIELD / YIELD_FROM to not increment opline. This simplifies the
code and fixes GH-15275 in a better way.

Closes GH-15328
2024-08-10 16:09:47 +02:00
Arnaud Le Blanc
60a055f0fc
[ci skip] NEWS for GH-15275 2024-08-10 16:08:34 +02:00
Arnaud Le Blanc
b43dd10bbb
Merge branch 'PHP-8.3'
* PHP-8.3:
  [ci skip] NEWS for GH-15275
  [ci skip] NEWS for GH-15275
  Fix crash during GC of suspended generator delegate (#15275)
2024-08-10 16:08:19 +02:00
Peter Kokot
2b30b22d7d
Autotools: Quote PHP_CHECK_SIZEOF macro arguments
[skip ci]
2024-08-10 16:01:22 +02:00
Niels Dossche
0122be574a
Simplify document standalone setter (#15320)
The logic was very weird as it just should check whether the boolean is
true or not. And in fact the code is equivalent because zval_get_long()
will only return 0/1 because the type is a bool, and ZEND_NORMALIZE_BOOL
won't change that value.
2024-08-10 15:35:04 +02:00
Christoph M. Becker
ee02e4be6a
Fix violation of the one definition rule in ext/com_dotnet (GH-15327)
The definition of the class entries in the internal header file is not
correct, since that file is included several times, and even the
comment above the definition hints at com_extension.c where the actual
definition is.  We fix this by declaring these variables as `extern`.
2024-08-10 15:27:32 +02:00
Christoph M. Becker
d98c4b6ebe
Fix comments in win32/sendmail.c (GH-15326)
These use a mixed style of block and line comments, and clang warns
about this (`-Wcomment`), so we fix that.
2024-08-10 13:59:06 +02:00
David Carlier
d5c7f3b0e6
ext/standard: enabling feature detection auxiliary vector on OpenBSD.
close gh-15175
2024-08-10 12:36:10 +01:00
Peter Kokot
fcd4d391fa
Autotools: Refactor mysqli extension checks (#15323)
- AS_* macros used
- s/UNIX/Unix
- The --with-mysql result value moved into the check when extension is
  enabled
- List of source files normalized with m4_normalize
- Redundant variables omitted
- CS synced
2024-08-10 10:08:17 +02:00
Peter Kokot
dbdc79df95
Autotools: Fix SNMP checks (#15263)
This is a follow-up of GH-15242
(0b25e26b4e)

because the usmHMAC192SHA256AuthProtocol and usmHMAC384SHA512AuthProtocol
are not functions but arrays. The AC_CHECK_DECL might be more
appropriate and portable way to find these.
2024-08-10 09:15:28 +02:00
Gina Peter Banyard
fd570fbfe8
main/streams: Voidify statbuf_from_array() (#15319)
It always returned SUCCESS
2024-08-10 00:59:37 +01:00
Niels Dossche
c426157823
Merge branch 'PHP-8.3'
* PHP-8.3:
  Add necessary SKIPIFs to new phpdbg tests
2024-08-10 01:11:14 +02:00
Niels Dossche
48bb8fe4c2
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix uninitialized value watchpoint_hit
2024-08-09 23:46:35 +02:00
David Carlier
667a5651ca
Merge branch 'PHP-8.3' 2024-08-09 21:15:07 +01:00
Ilija Tovilo
5c739acb2a
[skip ci] Mark stack limit tests with high memory limit as slow 2024-08-09 20:29:58 +02:00
Kamil Tekiela
7801f40449
Deprecate mysqli_kill (#11926) 2024-08-09 19:50:35 +02:00
Gina Peter Banyard
42497c1ea5
ext/soap: Deprecate passing an int to SoapServer::addFunction() (#15310)
Also deprecate SOAP_FUNCTIONS_ALL constant.

RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_soap_functions_all_constant_and_passing_it_to_soapserveraddfunction
2024-08-09 17:41:02 +01:00
Kamil Tekiela
cbcad9fdaf
Deprecate mysqli_ping (#11945) 2024-08-09 18:32:21 +02:00
Niels Dossche
00001c4a0c
Fix GH-15292: Dynamic AVX detection is broken for MSVC
See https://learn.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=msvc-170
For x64, either _M_X64 or _M_AMD64 would work but I'm going with what's
already used in php-src.

Closes GH-15301.
2024-08-09 18:11:46 +02:00
Peter Kokot
3a30c29d73
Autotools: Add pkg-config support for NET-SNMP library (#15261)
NET-SNMP has pkg-config support since 5.8.1

This optionally finds the NET-SNMP library using pkg-config or falls
back to find library on the system with net-snmp-config. The configure
option argument (--with-snmp=DIR) works like before (path to the
net-snmp-config).

When explicitly using the DIR argument, the pkg-config check is silently
skipped.

When not using DIR argument, the SNMP_CFLAGS and SNMP_LIBS can be also
used to find the NET-SNMP library:

    ./configure --with-snmp \
        SNMP_CFLAGS=-I/path/to/net-snmp/include \
        SNMP_LIBS="-L/path/to/net-snmp -lnetsnmp"

Co-authored-by: Calvin Buckley <calvin@cmpct.info>
2024-08-09 18:08:32 +02:00
Peter Kokot
8044db121f
Update mysql preprocessor macros help texts (#15288)
This adds missing help texts for preprocessor macros defined in
mysqli and pdo_mysql extensions.

[skip ci]
2024-08-09 18:07:05 +02:00
Peter Kokot
72fb00b644
Update gd extension preprocessor macros help texts (#15296)
PHP_GD_CHECK_FORMAT macro 2nd argument is changed from automatic
AC_DEFINE_UNQUOTED to manual action for easier usage.
2024-08-09 18:06:02 +02:00
Gina Peter Banyard
1e3d918936
ext/core: Deprecate passing E_USER_ERROR to trigger_error() (#15308)
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_passing_e_user_error_to_trigger_error
2024-08-09 15:51:07 +01:00
Kamil Tekiela
42336e1359
Deprecate mysqli_refresh (#11929) 2024-08-09 15:47:49 +01:00
Peter Kokot
bd77462c7c
Update sqlite3 and pdo_sqlite preprocessor macros help texts (#15291) 2024-08-09 14:51:05 +02:00
Peter Kokot
d7a8a04eb9
Autotools: Remove too basic optimization flag cleanup
The optimization flags are removed in configure.ac when using the
'--enable-debug' configure option (which also adds the '-O0'). When
using '--enable-debug-assertions' option, the optimization flags ideally
shouldn't be removed and this case never actually happen because the
CFLAGS at this point in ZEND_INIT contain all sorts of other flags also,
so it's redundant as it never gets executed.

Closes GH-15305
2024-08-09 13:56:08 +02:00
Ilija Tovilo
46ee0fb304
Disallow indirect modification on readonly properties within __clone() (#15012)
Indirect modification isn't allowed in __construct() because it allows
references to leak, so it doesn't make much sense to allow it in __clone().
2024-08-09 11:56:16 +02:00
Ilija Tovilo
7a2d5efa0f
[JIT] Avoid generating fast property assign path for readonly properties (#15260)
readonly properties will usually be IS_UNDEF on assignment, dodging the fast
path anyway. The fast path does not handle the readonly scope check. The
alternative would be handling scope there, but since there are some many
variants that might be more trouble than it's worth.
2024-08-09 11:49:40 +02:00
Peter Kokot
42c9963133
Autotools: Quote PHP_CXX_COMPILE_STDCXX macro arguments
[skip ci]
2024-08-09 10:39:16 +02:00
Peter Kokot
36f6a20a6b
Autotools: Quote AC_CHECK_PROG* macro arguments
[skip ci]
2024-08-09 10:27:04 +02:00
Peter Kokot
04a67cd86c
Autotools: Normalize phpdbg list of source files (#15306) 2024-08-09 10:22:37 +02:00
Peter Kokot
e8f2e530b0
Autotools: Sync CS in hash extension (#15302)
- AS_* macros used
- list of source files added to argument directly and normalized with
  m4_normalize()
- hash_sha3.c source file simplified
2024-08-09 01:45:50 +02:00
Peter Kokot
5c870751f2
Autotools: Sync CS in Zend.m4 (#15304)
- Autoconf sets the GCC variable to either "yes" if GNU C compatible
  compiler is detected (like gcc or clang) or to an empty value
  otherwise.
- AX_CHECK_COMPILE_FLAG arguments quoted and empty arguments trimmed
2024-08-09 01:38:42 +02:00
Peter Kokot
02e22a5d09
Autotools: Remove DEBUG_CFLAGS (#15300)
DEBUG_CFLAGS is at this point redundant variable.
2024-08-09 01:21:44 +02:00
Gina Peter Banyard
25b4696530
ext/xml: Deprecate xml_set_object() and passing non-callable strings as handlers (#15293) 2024-08-08 23:37:49 +01:00
Tim Düsterhus
6eca7839af
hash: Add SHA-NI implementation of SHA-256 (#15152)
* hash: Add SSE2 implementation of SHA-256

Implementation taken from
tarsnap/libcperciva@661752aee8.

Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>
Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>

* zend_cpuinfo: Add ZEND_CPU_FEATURE_SHA

* hash: Add SHA-NI implementation of SHA-256

Implementation taken from
tarsnap/libcperciva@661752aee8.

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

* NEWS / UPGRADING

---------

Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>
Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
2024-08-08 22:19:33 +02:00
Peter Kokot
a355c3572e
Update and sync PHP build preprocessor macros help texts (#15298)
[skip ci]
2024-08-08 21:31:57 +02:00
Niels Dossche
a5c834219b
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-15268: heap buffer overflow in phpdbg (zend_hash_num_elements() Zend/zend_hash.h)
2024-08-08 20:35:57 +02:00
Gina Peter Banyard
c8b45aa59a
ext/spl: Follow-up on GH-9704 (#15295)
Co-authored-by: Tim Düsterhus <timwolla@googlemail.com>
2024-08-08 19:31:51 +01:00
Gina Peter Banyard
bb2836eced
ext/dba: Deprecate passing null|false to dba_key_split() (#15297)
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_passing_null_and_false_to_dba_key_split
2024-08-08 18:59:30 +01:00
Niels Dossche
746b1cf43e
Access long value directly for call to count() in simplexml (#15278)
Because the signature is checked at compile time, we know that the only
possible return value (if there is no exception) is IS_LONG. So we can
avoid some work.
2024-08-08 19:28:03 +02:00
Tyson Andre
43def0af46
Deprecate SplFixedArray::__wakeup() (#9704)
GH-9354 added the `__serialize` and `__unserialize` method,
so unserialize() and other unserializers will call `__unserialize`
instead of `__wakeup` for SplFixedArray and userland subclasses.

RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_splfixedarraywakeup
2024-08-08 16:16:42 +01:00
Peter Kokot
80ae7f7979
Update pgsql extensions preprocessor macros help texts (#15290)
[skip ci]
2024-08-08 16:14:43 +02:00
Ilija Tovilo
c68b43c71b
[skip ci] Add UPGRADING.INTERNALS note for ZEND_DIM_ALTERNATIVE_SYNTAX 2024-08-08 10:33:40 +02:00
Tim Düsterhus
41bdcc87ec
Merge branch 'PHP-8.3'
* PHP-8.3:
  Update ci actions/checkout to v4 (#15283)
2024-08-08 09:58:16 +02:00
Peter Kokot
bf5de048e0
Update ext/tidy preprocessor macros help texts (#15269)
[skip ci]
2024-08-08 08:29:43 +02:00
Peter Kokot
f661223685
Update ext/sodium preprocessor macro help texts (#15270)
The sodium extension was initially named "libsodium" in PECL and was
renamed to sodium when it was bundled to php-src. The HAVE_LIBSODIUMLIB
symbol here could indicate that PHP extension sodium is available.

Otherwise the macro is not used in the current code base. Header
php_libsodium.h became "installed"/public as of PHP-8.4.

[skip ci]
2024-08-08 08:27:22 +02:00
David Carlier
f503cc0234
Merge branch 'PHP-8.3' 2024-08-07 22:38:48 +01:00
Peter Kokot
ca57d763ce
Update ext/zip preprocessor macros help texts (#15271)
[skip ci]
2024-08-07 17:03:59 +02:00
Christoph M. Becker
2832b4254c
Fix nightly Windows builds regarding CRT and runners (GH-15273)
Only the master branch should use vs17; older branches still should
stick with vs16.  And while not strictly necessary, older branches
should better stick with windows-2019 runners.
2024-08-07 15:44:53 +02:00
Christoph M. Becker
2190353b08
Merge branch 'PHP-8.3'
* PHP-8.3:
  zend_enum: Rename try parameter to avoid conflict with C++
2024-08-07 14:56:19 +02:00
Niels Dossche
027b210d42
Merge branch 'PHP-8.3'
* PHP-8.3:
  Revert "Fix bug #69280: SoapClient classmap doesn't support fully qualified class name (#14398)"
2024-08-07 10:04:58 +02:00
Peter Kokot
a49e0a42a1
Autotools: Quote AC_PATH_PROG arguments in ext/pdo_firebird
[skip ci]
2024-08-07 09:19:40 +02:00
Peter Kokot
5fc68d8bab
Update preprocessor macros help texts for enchant and snmp extensions (#15255)
[skip ci]
2024-08-06 23:22:28 +02:00
Peter Kokot
84e1920c12
Autotools: Add phpized configure log and help separators (#15251)
- This quotes all PHP_CONFIGURE_PART arguments
- When configuring and building extensions with phpize, this makes the
  './configure --help' and './configure' log output a bit more readable
  as it separates the extension configuration, Libtool configuration and
  the rest of the Autoconf and phpize configuration options.
- The ./configure output separators bold tags are moved to the
  PHP_INIT_BUILD_SYSTEM macro to be available also in phpized extensions
- The obsolete ticks `...` converted to the recommended $(...); Autoconf
  configure re-executes itself in shells where the $(...) still wouldn't
  work ok. For example, the default, initial, non-updated shell on
  Solaris 10.
- Empty new lines in help separators synced (Autoconf default separators
  don't include additional empty newline after the separator title);
  so the PHP_HELP_SEPARATOR additional empty line is also removed
  (see './configure --help' output)
2024-08-06 22:15:22 +02:00
Niels Dossche
74eff98c84
Deprecate passing incorrect data types for options to ext/hash functions (#15236)
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_passing_incorrect_data_types_for_options_to_exthash_functions
2024-08-06 19:13:09 +02:00
Quentin Dreyer
7b32a145d9
Fix GH-15155: Keep stream context in filtered streams
Closes GH-15156
2024-08-06 16:42:33 +01:00
Christoph M. Becker
af8ef4c5b0
Update Windows CI to build with vs17
PHP 8.4 is supposed to be built with vs17 (aka. Visual Studio 2022)[1],
so we also do this for CI.

We mark gh8841.phpt as xfail for known reasons.

[1] <https://windows.php.net/>
2024-08-06 17:19:08 +02:00
Christoph M. Becker
d5c4522547
Use new MSVC preprocessor for VS 17 builds
From the documentation[1]:

| We're updating the Microsoft C++ preprocessor to improve standards
| conformance, fix longstanding bugs, and change some behaviors that
| are officially undefined. We've also added new diagnostics to warn
| on errors in macro definitions.

Thus it appears to be sensible to switch to the new preprocessor for
all VS17 builds.  Note that although the new preprocessor is available
as of VS16.5 (i.e. `version >= 1925`), we don't want to potentially
break older builds, and as such use the new preprocessor only for VS17
builds.  Users who wish to use the new preprocessor with VS16, can
still `set CFLAGS=/Zc:preprocessor` before running `buildconf`/`phpize`.

[1] <https://learn.microsoft.com/en-us/cpp/preprocessor/preprocessor-experimental-overview?view=msvc-170>

Closes GH-15201.
2024-08-06 17:14:34 +02:00
Christoph M. Becker
9c4aa2b4fc
Output diagnostics when SQLFetch with SQL_ERROR
These diagnostics can be useful, and if not for users, at least for the
ext/odbc maintainers.  We only call `odbc_sql_error()` if the previous
`SQLFetch()` or `SQLFetchExtended()` return `SQL_ERROR`, because
otherwise the diagnostic would be unhelpful ("Failed to fetch error
message, SQL state HY000").

Note that the diagnostic is emitted as `E_WARNING` so technically this
is a small BC break.

Closes GH-15256.
2024-08-06 16:59:47 +02:00
Christoph M. Becker
0ca3018887
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix odbc_data_source_001.phpt
2024-08-06 16:55:57 +02:00
Christoph M. Becker
887e6b9c45
Fix GH-15181: Disabled output handler is flushed again
When an `PHP_OUTPUT_HANDLER_FAILURE` occurs, the output handler becomes
disabled (i.e. the `PHP_OUTPUT_HANDLER_DISABLED` flag is set).  However,
there is no guard for disabled handlers in `php_output_handler_op()`
what may cause serious issues (as reported, UB due to passing `NULL` as
the 2nd argument of `memcpy`, because the handler's buffer has already
been `NULL`ed).  Therefore, we add a respective guard for disabled
handlers, and return `PHP_OUTPUT_HANDLER_FAILURE` right away.

Closes GH-15183.
2024-08-06 16:45:51 +02:00
Gina Peter Banyard
bc8909aac3
Zend: Add test disabling assert() function 2024-08-06 13:21:18 +01:00
David CARLIER
b9da6cb3a2
ext/standard: disable one ipv2long test. (#15200)
atypical leading zeros are accepted on this platform.
2024-08-06 12:26:19 +01:00
Peter Kokot
0c3b7677f9
Autotools: Add pkg-config for GMP library (#15166)
GMP has pkg-config integration since 2019-08-22 (version ~6.2.0).

This optionally finds the GMP library using pkg-config or falls back to
find library on the system or with the provided configure option
argument (--with-gmp=DIR).

When using DIR argument, the pkg-config check is silently skipped.

When not using DIR argument, the GMP_CFLAGS and GMP_LIBS can be also
used to find the GMP library:

        ./configure --with-gmp \
            GMP_CFLAGS=-I/path/to/gmp/include \
            GMP_LIBS="-L/path/to/gmp -lgmp"
2024-08-06 10:16:42 +02:00
Peter Kokot
da5362c9b8
Autotools: Add ext/readline preprocessor macros help texts (#15241)
This adds the missing macros help texts for easier understanding. The
AC_DEFINE can be called with only 2 arguments if there is another
definition in the code where template (see AH_TEMPLATE Autoconf macro)
is read by autoheader (the 2nd AC_DEFINE sets the template for all other
definitions with the same name).
2024-08-06 09:21:58 +02:00
Peter Kokot
62f75a7812
Autotools: Refactor thread safety checks (#15214)
- The ZTS is defined on only one place
- Added help text for ZTS preprocessor macro
- The 'enable_zts' variable replaced with PHP_THREAD_SAFETY in
  configure.ac.
- Nits fixed.
2024-08-05 22:30:10 +02:00
Niels Dossche
bb299a03e9
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix crash when converting array data for array in shm in xxh3
2024-08-05 22:07:06 +02:00
Niels Dossche
a0c29f0889
Use unsigned int instead of int for refcount for libxml objects (#15247) 2024-08-05 22:04:24 +02:00
Niels Dossche
0c7cd92414
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix SoapFault property destruction
2024-08-05 22:04:10 +02:00
Tim Düsterhus
31e2d2b86c
random: Optimize Randomizer::getBytes() (#15228)
This patch greatly improves the performance for the common case of using a
64-bit engine and requesting a length that is a multiple of 8.

It does so by providing a fast path that will just `memcpy()` (which will be
optimized out) the returned uint64_t directly into the output buffer,
byteswapping it for big endian architectures.

The existing byte-wise copying logic was mostly left alone. It only received an
optimization of the shifting and masking that was previously applied to
`Randomizer::getBytesFromString()` in 1fc2ddc996.

Co-authored-by: Saki Takamachi <saki@php.net>
2024-08-05 19:12:29 +02:00
Ilija Tovilo
2f27e0b2ab
Fix missing variance check for abstract set with asymmetric type (#15157)
Fixes GH-15140
2024-08-05 16:43:54 +02:00
Peter Kokot
11094d5f24
[skip ci] Fix typo in ext/gd 2024-08-05 16:23:38 +02:00
Peter Kokot
9049d86a78
[skip ci] Fix typo in ext/gd 2024-08-05 16:22:36 +02:00
Peter Kokot
cff39cc400
[skip ci] Fix typo 2024-08-05 16:15:19 +02:00
Peter Kokot
0b25e26b4e
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
2024-08-05 15:54:50 +02:00
Ilija Tovilo
5d9c155dd3
Fix inheritance of hooks onto plain properties 2024-08-05 14:30:37 +02:00
Ilija Tovilo
43f688e1ed
Fix zend_function.prop_info pointer for trait hooks (#15245)
Fixes GH-15240
2024-08-05 13:14:37 +02:00
Ilija Tovilo
50217b35ea
Remove IS_STATIC_VAR_UNINITIALIZED (#15227)
This flag was never necessary. We know a static variable is uninitialized (i.e.
the initializer has never been called) iff the zval in the static variable array
does not contain a reference.

Prompted by a related issue in ext-uopz reported by Christoph.
2024-08-05 11:19:13 +02:00
Peter Kokot
31f256492e
Add and update ext/odbc preprocessor macros help texts (#15223) 2024-08-05 10:12:16 +02:00
Peter Kokot
8bfcbdc5ee
Fix HAVE_LIBGD usage (#15226)
When PHP gd extension uses the external system GD library, the
HAVE_LIBGD preprocessor macro gets defined in Autotools. On Windows it
was previously always defined when bundled library is used. This fixes
the usage and adds help texts.
2024-08-05 09:35:13 +02:00
Peter Kokot
125190186e
Autotools: Check for cross_compiling=yes (#15238)
The cross_compiling variable can initially be "yes", "no", or
"maybe" (when only --host option is added). Autoconf otherwise after
AC_PROG_CC resets it to "no" in such case but to be sure, this
checks for value "yes" instead. The HAVE_FNMATCH template can be also
set after the AC_DEFINE as autoheader scans the templates overall the
source code.
2024-08-05 08:52:09 +02:00
Peter Kokot
95447e03fb
[skip ci] Remove obsolete comment (#15225)
HAVE_ODBC is ambiguous what this does and neither the macro is used in
the current code base anymore.
2024-08-05 07:47:59 +02:00
Niels Dossche
d9eb3783bd
Remove DOMImplementation::getFeature() (#15233)
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#remove_domimplementationgetfeature_feature_version
2024-08-04 23:30:52 +02:00
Peter Kokot
77ad57c6c6
Add and update ext/dba preprocessor macros help texts (#15221) 2024-08-04 23:23:38 +02:00
Niels Dossche
0aec0faa27
Deprecate DOM_PHP_ERR (#15234)
* Deprecate DOM_PHP_ERR

RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_dom_php_err_constant

* Apply suggestions from code review

Co-authored-by: Tim Düsterhus <timwolla@googlemail.com>

---------

Co-authored-by: Tim Düsterhus <timwolla@googlemail.com>
2024-08-04 22:00:01 +02:00
Peter Kokot
18a99a4d33
Autotools: Refactor debug checks (#15215)
- Added help text for ZEND_DEBUG preprocessor macro
- CS synced
2024-08-04 21:59:58 +02:00
Peter Kokot
97eb89afd6
Autotools: Improve --with-mm configure option check (#15212)
The mm check code block needs to done only when session is enabled to
prevent redundant mm library linkage in edge case mistakes like:

    ./configure --disable-session --with-mm

CS is synced with AC_* macros. The 'm4_text_wrap' macro joins the given
text with single space characters and limits it to 79 characters width.

Co-authored-by: Gina Peter Banyard <girgias@php.net>
2024-08-04 21:16:15 +02:00
Niels Dossche
f0b3e3bac7
[ci skip] Fix typo in test file name 2024-08-04 20:32:01 +02:00
Jorg Adam Sowa
b9fef523c1
Deprecate date_sunrise and date_sunset constants (#12978)
RFC: https://wiki.php.net/rfc/deprecations_php_8_4
2024-08-04 20:07:52 +02:00
Tim Düsterhus
49d0d7bcd7
standard: Stop using php_combined_lcg() in uniqid() (#15217)
Fall back to the fallback generator if the CSPRNG fails instead. This removes
the last internal user of `php_combined_lcg()`.
2024-08-04 18:26:40 +02:00
Tim Düsterhus
6910167c48
random: Remove engine_combinedlcg.c (#15216)
The standalone engine cannot be usefully used for any other purpose. Remove it
and inline the implementation into the `php_combined_lcg()` function.
2024-08-04 18:26:15 +02:00
Tim Düsterhus
e8ff7c70f9
session: Deprecate session.sid_length and session.sid_bits_per_character (#15213)
RFC: https://wiki.php.net/rfc/deprecations_php_8_4
2024-08-04 18:25:31 +02:00
Tim Düsterhus
f5f9294153
random: Deprecate lcg_value() (#15211)
RFC: https://wiki.php.net/rfc/deprecations_php_8_4
2024-08-04 18:24:21 +02:00
Tim Düsterhus
ecd11b9687
unserialize: Deprecate the 'S' tag (#12309)
RFC: https://wiki.php.net/rfc/deprecations_php_8_4
2024-08-04 18:23:19 +02:00
Peter Kokot
d6a75e19d1
Sync preprocessor macros help texts (#15218)
This partially syncs help texts a bit further for:
- ext/ffi
- ext/ldap
- ext/opcache
- ext/pcre
- ext/pdo_mysql
- ext/readline
- ext/standard
2024-08-04 12:52:16 +02:00
Peter Kokot
f16ab75171
Refactor HAVE_SQLDATASOURCES check (#15222)
On Windows, this preprocessor macro is moved to odbc extension, in
Autotools check CS is synced and some basic help text is added.
2024-08-04 11:57:01 +02:00
Peter Kokot
dcdcb3cbfe
Autotools: Replace AC_MSG_ERROR with AC_MSG_FAILURE (#15209)
This replaces the AC_MSG_ERROR with AC_MSG_FAILURE, where appropriate.

The AC_MSG_ERROR outputs given message and exits the configure step. The
AC_MSG_FAILURE does the same but also automatically outputs additional
message "See 'config.log' for more details." which might help directing
the user where to look further.

The AC_MSG_ERROR is used for errors where current test step isn't logged
in the config.log and wouldn't make sense, and AC_MSG_FAILURE is mostly
used in cases of library checks, compilation tests, headers checked with
AC_CHECK_HEADER* and similar tests that are also logged in the
config.log.

AC_MSG_ERROR([Sanity check failed.]) output:

```
configure: error: Sanity check failed.
```

AC_MSG_FAILURE([Sanity check failed.]) output:

```
configure: error: in '/path/to/php-src':
configure: error: Sanity check failed.
See 'config.log' for more details
```
2024-08-04 07:36:37 +02:00
Peter Kokot
cf6bbdfb0c
Autotools: Improve ftp and mysqlnd SSL configure options (#15164)
This makes the configure log messages and help text more intuitive what
is being enabled and when.
2024-08-03 22:13:36 +02:00
Peter Kokot
4f07cdc584
Replace PHP_OUTPUT with AC_CONFIG_FILES (#15186)
This is a follow-up of GH-15177
(c96f08aa70)
and GH-15185
(9467ffb43c)

The PHP_OUTPUT macro was introduced in the very early phase of the build
system due to AC_OUTPUT handling issues in the old Autoconf versions
before the AC_CONFIG_FILES, AC_CONFIG_COMMANDS etc were introduced with
the AC_OUTPUT signature without arguments. The PHP_OUTPUT was also
helping Makefile.in back then being properly generated based on whether
all files were generated or only some (when using the obsolete
CONFIG_FILES=... ./config.status invocation instead of the new
./config.status --file=...). Another issue is that PHP_OUTPUT can't be
used by extensions when using phpize.

This replaces the PHP_OUTPUT invocations with default AC_CONFIG_FILES.

The obsolete "REDO_ALL" feature at the config.status invocation is also
removed with a simpler unconditional generation.

In phar extension the "ext/phar" is replaced with $ext_dir variable to
be able to use phpize.
2024-08-03 21:52:14 +02:00
Peter Kokot
16d9bd0aae
Sync AC_DEFINE help texts (#15207) 2024-08-03 09:47:39 +02:00
Niels Dossche
3ad9f4d441
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-15179: Segmentation fault (null pointer dereference) in ext/standard/url_scanner_ex.re
2024-08-03 02:05:44 +02:00
Peter Kokot
20ea4eadc6
[skip ci] Fix NEWS entry for config.* scripts 2024-08-03 01:33:28 +02:00
Peter Kokot
e02fa5f825
Autotools: Update config.guess to 2024-07-27 and config.sub to 2024-05-27 (#15190)
```
wget -O build/config.guess https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
wget -O build/config.sub https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
```
2024-08-03 01:31:34 +02:00
Niels Dossche
e119c72894
Add a test for setting the innerHTML on a prefixed XML element (#15204) 2024-08-03 00:14:04 +02:00
Niels Dossche
76ad89ccff
Fix GH-15192: Segmentation fault in dom extension (html5_serializer)
When cloning a document, doc will not be equal to the actual new
document clone->doc. clone->doc will always point to the correct
document so use that instead when comparing document nodes.

Closes GH-15198.
2024-08-02 18:22:17 +02:00
Ilija Tovilo
85fa983fe6
Add ReflectionProperty::getSettableType() test for get-only backed property
Fix test name while we're at it.
2024-08-02 17:48:08 +02:00
Ilija Tovilo
2e9cc9bc30
Allow optimizer to depend on preloaded symbols (#15021)
* Allow optimizer to depend on preloaded symbols

It is safe for the optimizer to rely on preloaded symbols. This can occur when
compiling non-preloaded files, referencing preloaded ones.

* Disable inline pass for observer test

* Move duplicated code into functions

* Add comment to specific optimization value

* Optimizer should only rely on preloaded symbols in the symbol table

* Fix skipif for windows
2024-08-02 17:35:27 +02:00
Remi Collet
521178709e
use libedit instead of readline for CI 2024-08-02 14:34:42 +02:00
Peter Kokot
9467ffb43c
Autotools: Remove obsolete config.status invocations (#15185)
This was once added to fix the bug https://bugs.php.net/13561 because
the phpize and php-config scripts were located in the pear subdirectory
and were installed only when --with-pear option was used. Then in the
20c43285f7 scripts were moved to scripts
subdirectory with this mechanism used in the generated Makefile when
running 'make install' command.

Before the AC_CONFIG_FILES was introduced to Autoconf AC_OUTPUT once
accepted arguments. This signature is obsolete in current Autoconf
versions.

The old obsolete config.status invocation:
  CONFIG_FILES=... ./config.status

And the new invocation is (if used with AC_CONFIG_FILES in the code):
  ./config.status --file=...

Instead, this simply removes the redundant phpize and php-config
generation with the old obsolete config.status invocations as these
files are always generated in the php-src build context.
2024-08-02 12:35:11 +02:00
Peter Kokot
0339d8c589
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-13199: Redundant prompt in phpdbg with libedit/readline
2024-08-02 08:38:35 +02:00
Peter Kokot
48916cec33
Sync file permissions
Git can track executable (0755) and non-executable (0644) file modes.
This is a minor file permissions sync for the win32/build/mkico.sh
(0755).

[skip ci]
2024-08-02 02:39:52 +02:00
Peter Kokot
f66feaec0f
Sync HAVE_<extension> help texts (#15167)
This syncs all help texts of extension preprocessor macros to the same
style "Define to 1 if the PHP extension '<ext>' is available.".
[skip ci]
2024-08-02 01:41:47 +02:00
Peter Kokot
4993453933
Autotools: Update configure.ac CPP macros help texts (#15189)
- __MUSL__
- DEFAULT_SHORT_OPEN_TAG
- HAVE_BUILD_DEFS_H
- HAVE_GCOV
- HAVE_LIBDL
- PHP_RTLD_NOW
- PHP_SIGCHILD
- ZEND_FIBER_UCONTEXT
2024-08-02 01:14:48 +02:00
Peter Kokot
079f82a8ec
Sync CPP macros in ext/iconv (#15191)
This syncs and adds help texts for CPP macros defined when iconv
extension is configured.
2024-08-02 00:49:18 +02:00
Peter Kokot
eed66e6183
Autotools: Fix ffi checks (#15197)
When libffi is installed on non-default places, also the calling
convention checks need adjusted compilation flags to be able to find the
ffi.h header file.
2024-08-02 00:32:36 +02:00
David Carlier
3c36c7308d
sapi/phpdbg: windows update exception type falling into segfault.
close GH-15098
2024-08-01 11:49:13 +01:00
Peter Kokot
1ca3230966
Autotools: Update php.m4 CPP macros help texts (#15188)
- COMPILE_DL_<extension>
- COOKIE_SEEKER_USES_OFF64_T
- HAVE_BROKEN_GETCWD
- HAVE_LIBEXPAT
- HAVE_PREAD
- HAVE_PWRITE
- MISSING_ASCTIME_R_DECL
- MISSING_CTIME_R_DECL
- MISSING_GMTIME_R_DECL
- MISSING_LOCALTIME_R_DECL
- MISSING_STRTOK_R_DECL
- PHP_PREAD_64
- PHP_PWRITE_64
- SIZEOF_<type>
- HAVE_<type>
2024-08-01 10:08:28 +02:00
Saki Takamachi
0f2f7c6fb4
[skip ci] Update NEWS for PHP 8.4.0alpha4 2024-08-01 09:41:27 +09:00
Peter Kokot
28a7c6243c
[skip ci] Add HAVE_XSL_EXSLT help text (#15174) 2024-08-01 00:46:20 +02:00
Peter Kokot
c96f08aa70
Autotools: Normalize PHP_OUTPUT arguments (#15177)
The m4_normalize([$1]) normalizes items into a single-space-separated
list of files to append them to the global PHP_OUTPUT_FILES variable
that is processed by AC_CONFIG_FILES. Redundant newlines are also
removed in the generated configure script.

PHP extensions using phpize can't use this macro so it's safe to change
this.
2024-08-01 00:14:56 +02:00
Tim Düsterhus
a578c27a51
Improve link styling in PHPInfo (#15077)
* Improve link styling in PHPInfo

The previous styling with the fixed background color didn't work well in dark
mode. Remove the background and make links inherit the regular text color. To
make them visually detectable the underlining behavior is reversed. The
underline is now shown when not hovering and hidden when hovering.

* Preserve the headline linking behavior
2024-07-31 12:10:16 +02:00
David CARLIER
b7e43bd2b7
ext/readline: readline_info fix usage when the buffer is not initialised (#15139)
rl_initialise is only called when readline() is used so the global
 buffer might not be initialised yet.
2024-07-31 11:04:44 +01:00
Niels Dossche
3c68661ec9
Minor cleanup in dom_character_data_append_data (#15173) 2024-07-30 23:05:12 +02:00
Niels Dossche
ceca599649
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix UAF when removing doctype and using foreach iteration
2024-07-30 20:07:48 +02:00
Saki Takamachi
60afeb5537
RFC: Change GMP bool cast behavior (#15151)
Implementation of "RFC: Change GMP bool cast behavior"

https://wiki.php.net/rfc/fix_up_bcmath_number_class

Co-authored-by: Tim Düsterhus <tim@bastelstu.be>
2024-07-31 00:41:49 +09:00
Saki Takamachi
0e33b8dad9
Update NEWS for PHP 8.4.0alpha3 2024-07-30 22:09:31 +09:00
Arnaud Le Blanc
c7b65508d3
[ci skip] NEWS 2024-07-30 15:03:21 +02:00
Arnaud Le Blanc
03149ef962
Merge branch 'PHP-8.3'
* PHP-8.3:
  [ci skip] NEWS
  [ci skip] NEWS
  Fix destruction of generator running in fibers during shutdown (#15158)
2024-07-30 14:59:24 +02:00
Peter Kokot
79af1b5280
Autotools: Remove unused variable FREETYPE2_FOUND
Follow-up of 19d8a6b771.
2024-07-30 11:25:24 +02:00
Peter Kokot
8356dadb59
Autotools: Fix xml extension dependency (#15162)
The PHP_ADD_EXTENSION_DEP Autoconf macro needs to be called after
PHP_NEW_EXTENSION to be fully effective. This simplifies the code and
checks. Also, due to the current order_by_dep.awk script implementation
it needs to be on its own line with arguments unquoted so that awk can
parse the config.m4 file. Until order_by_dep.awk script is fixed.
2024-07-30 09:17:11 +02:00
Peter Kokot
0970fd439a
Autotools: Sync CS in enchant extension 2024-07-30 07:54:32 +02:00
Peter Kokot
8c18ae7899
Autotools: Sync CS in bz2 extension (#15163)
- AS_* macros used
- Checking message refactored
2024-07-30 07:52:48 +02:00
Peter Kokot
49a08d5ca3
Autotools: Move HAVE_DTRACE to configure.ac (#15160)
Following 32210ce967 and
9ea290b72b, this moves the HAVE_DTRACE
preprocessor macro definition back to configure.ac so that
PHP_INIT_DTRACE Autoconf macro can be used in extensions without
redefinition interference.
2024-07-30 07:47:11 +02:00
Peter Kokot
4d46f26327
Autotools: Update skeleton extension config.m4 template (#15147)
- Comments refactored to a bit more guide way
- Basic help text added to the HAVE_<EXTENSION>* preprocessor macro definitions
- Raw shell ifs replaced with AS_VAR_IF M4 macros
- Code wrapped inside the line length of 80 characters
- pkg-config functionality added on top
- non-pkg-config functionality added afterwards
- The loop refactored a bit with a break and check message done
  afterwards

[skip ci]
2024-07-30 00:48:19 +02:00
Christoph M. Becker
2f17f157ca
Support AVX-512 builds on Windows
"Since limited support for `/arch:AVX512` was added in Visual Studio
2017, and expanded in Visual Studio 2019"[1], we can safely offer this
option, since PHP 8.4 is supposed to build with Visual Studio 2022, and
it is unlikely that someone tries to build PHP 8.4 with Visual Studio,
requesting AVX-512 support.

[1] <https://learn.microsoft.com/en-us/cpp/build/reference/arch-x64?view=msvc-170>
2024-07-29 21:19:10 +02:00
Tim Düsterhus
9083ce4d27
[skip ci] Add missing name in NEWS for GH-15121 2024-07-29 19:40:11 +02:00
Dmitry Stogov
53b329e278
Fix GH-15101: _ir_RSTORE: Assertion `ctx->control' (#15153) 2024-07-29 19:17:25 +03:00
Saki Takamachi
28080dce62
round(): Corrected test name and fixed UPGRADING (#14943)
Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>
2024-07-29 20:39:35 +09:00
Peter Kokot
7fd54f9d12
Remove duplicate ZEND_ENABLE_STATIC_TSRMLS_CACHE flag (#15080) 2024-07-29 10:17:23 +02:00
Peter Kokot
9ea290b72b
Sync HAVE_ICONV preprocessor macro usage (#15148)
HAVE_ICONV marks that PHP extension 'iconv' is available, and not only
that iconv library or its functions/headers are available.
2024-07-29 10:12:57 +02:00
Peter Kokot
7d927075ea
Autotools: Sync shared argument CS (#15141)
The 3rd argument of the PHP_NEW_EXTENSION can be "shared" or "yes" to
mark the extension as shared, or anything else to mark that extension as
not shared. This syncs the argument values across the build system to be
"no" as in other always-enabled extensions.
2024-07-29 10:12:32 +02:00
Peter Kokot
575efc0617
Autotools: Quote PHP_ADD_SOURCES* macros arguments (#15146)
- A redundant shell quoted flags argument replaced with Autoconf quotes
  (the PHP_ADD_SOURCES macro already adds the necessary shell quotes
  characters where needed)
- CS synced
2024-07-29 10:08:48 +02:00
Peter Kokot
9cc63e1de9
Autotools: Normalize headers arguments (#15149)
Refactor all "long" arguments into blank-or-newline-separated list of
files with m4_normalize.
2024-07-29 10:08:17 +02:00
Peter Kokot
f3c48f1acd
Autotools: Append hash and opcache build directories (#15132)
When building in out-of-source directory, instead of creating these
build directories right away, this appends them to the list and creates
them at the end of configure phase. These don't need to be created
immediately as no files are generated in these extensions before the
configure phase is finished.

Also, the PHP_ADD_BUILD_DIR is moved after the PHP_NEW_EXTENSION when
the more common $ext_builddir variable is available (the ext/<extension>
isn't available when building with phpize).
2024-07-29 10:02:11 +02:00
Peter Kokot
1ceadaed52
Autotools: Normalize and quote all PHP_NEW_EXTENSION arguments (#15144)
This adds Autoconf quote characters to all PHP_NEW_EXTENSION arguments
and syncs the CS across the php-src Autotools build system.
2024-07-29 00:14:59 +02:00
Peter Kokot
f0788da6b6
Merge branch 'PHP-8.3'
* PHP-8.3:
  [skip ci] Sync CODEOWNERS (#15017)
2024-07-29 00:12:42 +02:00
Pol Dellaiera
664c1d18df
Fix: add missing PHPAPI (#15142)
Issue introduced in commit 5905857fd2 from PR https://github.com/php/php-src/pull/14833
2024-07-28 20:38:52 +02:00
Niels Dossche
e0a2e2e59c
Fix GH-15123: var_dump doesn't actually work on XMLReader (#15130) 2024-07-28 19:36:07 +02:00
Peter Kokot
2b97c84d4c
Autotools: Quote PHP_CHECK_LIBRARY arguments (#15136)
This syncs the quotes across the PHP_CHECK_LIBRARY macro arguments.
2024-07-28 18:39:14 +02:00
David Carlier
a7d856d9bf
ext/readline: fix global readline vars when updating rl_line_buffer.
if the new value was larger, rl_line_buffer_length was never updated.
neither was rl_end (on unixes).

close GH-15120
2024-07-28 14:12:26 +01:00
Niels Dossche
177fd88452
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix CI failure on macOS after Curl update
2024-07-28 14:34:47 +02:00
Gina Peter Banyard
a50adda19e
ext/gmp: Make GMP class final (#15121)
* ext/gmp: Make GMP class final

RFC: https://wiki.php.net/rfc/gmp-final

* Update UPGRADING

Co-authored-by: Peter Kokot <peterkokot@gmail.com>

---------

Co-authored-by: Peter Kokot <peterkokot@gmail.com>
2024-07-28 13:03:26 +01:00
Niels Dossche
9d7e6090df
Fix GH-15137: Unexpected null pointer in Zend/zend_smart_str.h (#15138)
This regressed when I optimized $wholeText. The previous code used xmlStrcat
which implicitly checked for a NULL argument, but now it's a direct memcpy
which you shouldn't pass null pointers to, although it won't result in a
crash because memcpy doesn't do anything if the length is 0.
2024-07-28 13:53:30 +02:00
Peter Kokot
dee29442ba
Autotools: Fix ext/standard sources (#15131)
This appends source files to the PHP_NEW_EXTENSION call and adds the
possible compilation flag -DZEND_ENABLE_STATIC_TSRMLS_CACHE when
building objects as done on all ext/standard sources already. Also, the
PHP_EXT_DIR Autoconf macro doesn't accept any argument.
2024-07-28 10:12:17 +02:00
Peter Kokot
ae9b9ead7b
Autotools: Sync PHP_EXT_* M4 macros (#15134)
PHP_EXT_DIR, PHP_EXT_BUILDDIR, and PHP_EXT_SRCDIR macros don't accept
the argument since 82b73fd1e3.
2024-07-28 10:11:01 +02:00
Peter Kokot
590786adb3
Autotools: Replace PHP_EXT_DIR with $ext_dir (#15133)
- Sync Autoconf syntax
- The PHP_EXT_DIR macro doesn't accept any arguments and since this is
  called after PHP_NEW_EXTENSION, the $ext_dir variable can be used
  instead.
2024-07-28 10:09:26 +02:00
Peter Kokot
21e01f3e70
Autotools: Simplify PHP_ALWAYS_SHARED macro (#15129)
Instead of defining an empty M4 macro PHP_ALWAYS_SHARED when configuring
extensions in php-src using the main configure.ac, the m4_ifdef can be
used to conditionally call the macro when it is defined (when using
phpize).
2024-07-28 01:33:05 +02:00
Peter Kokot
0d36701b32
Autotools: Remove dead code (#15128)
This is a left over from 4dee0c4a14.

These definitions are now always done by the config-stubs file. For
phpize builds they are in the phpize.m4 as before.
2024-07-28 01:30:15 +02:00
Peter Kokot
32210ce967
Autotools: Sync CS in XML related extensions (#15110)
- PHP_SETUP_LIBXML arguments quoted
- Help texts updated for HAVE_LIBXML, HAVE_DOM, HAVE_XMLREADER,
  HAVE_XMLWRITER, HAVE_SOAP, HAVE_SIMPLEXML, and HAVE_XML CPP macros
- Duplicate HAVE_LIBXML symbol definition in PHP_SETUP_LIBXML M4 macro
  removed (the HAVE_LIBXML marks that PHP libxml extension is available and
  not only that libxml2 library is available)
2024-07-27 22:48:51 +02:00
Peter Kokot
003e238436
Autotools: Quote and fix PHP_SELECT_SAPI arguments (#15118)
This macro once had also the 5th argument (the build target), which was
removed via 2a6da0f24c. This quotes all
PHP_SELECT_SAPI arguments and removes the redundant ones. The basic
macro usage help text is moved to the macros section from the obsolete
docs file.
2024-07-27 22:46:36 +02:00
Niels Dossche
5270ada34c
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix nightly failure in test variation due to number of temp variables varying when observers are enabled
2024-07-27 16:37:14 +02:00
Niels Dossche
cf14adf897
Avoid string duplications in simplexml (#15122)
Switch to zend_string which allows us to use zend_string_copy.
2024-07-27 16:21:07 +02:00
Niels Dossche
043a1cb856
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix CI failure after Curl update (#15124)
2024-07-27 16:11:33 +02:00
Peter Kokot
0c0da80a2a
Autotools: Replace PHP_DEF_HAVE with AC_DEFINE_UNQUTED (#15119)
The PHP_DEF_HAVE M4 macro is a simple wrapper around the recommended
AC_DEFINE or AC_DEFINE_UNQUOTED (when shell variables are used in
arguments). This also adds some basic help texts to macros.
2024-07-27 11:25:50 +02:00
Peter Kokot
ef8e792962
Autotools: Quote M4 macro arguments
- AC_CHECK_TYPES
- AC_REPLACE_FUNCS
- PHP_HELP_SEPARATOR needs here double quotes as content contains '['
  and ']' characters
2024-07-27 11:22:28 +02:00
Peter Kokot
a1b45bb87a
Autotools: Sync PHP_SETUP_* M4 macros (#15117)
- arguments quoted
- MYSQLND_HAVE_SSL help text synced
2024-07-27 11:20:07 +02:00
Peter Kokot
c53b272f67
Autotools: Quote AC_CHECK_LIB arguments (#15116)
This syncs CS for AC_CHECK_LIB where possible, and adds minor help texts
to gettext extension AC_DEFINE symbols, including the HAVE_LIBINTL.
2024-07-27 11:18:52 +02:00
Peter Kokot
a7f0fe1f33
Autotools: Quote macro arguments
- PHP_EXPAND_PATH
- PHP_LIBGCC_LIBPATH
- PHP_OUTPUT
- PHP_REMOVE_USR_LIB
2024-07-27 05:26:32 +02:00
David CARLIER
bb8d667f8f
Fix GH-15102: ext/pgsql use after free on persistent connection renewal. (#15115)
simplifying the workflow by just using PQreset which force a new
connection internally, connection process ids ought to be different,
 and let the existing checks do the rest.
2024-07-26 23:12:26 +01:00
Peter Kokot
6e57550f14
Autotools: Normalize DTrace sources argument (#15111)
Using the m4_normalize, the source files can be added more intuitively
using blank-or-newline delimited list of files. This adds also some
basic help text.
2024-07-26 23:30:20 +02:00
Peter Kokot
2141094b2a
Autotools: Fix rl_erase_empty_line check (#15109)
When building with readline/libedit installed at non-standard or
non-system paths the check flags also need to be adjusted a bit to be
able to check for the declared variable.
2024-07-26 23:28:25 +02:00
Peter Kokot
ff4b99e260
Autotools: Quote PHP_ADD_LIB* arguments (#15112)
Following previous CS syncs, this quotes arguments in PHP_ADD_LIB* M4
macros:
- PHP_ADD_LIBRARY
- PHP_ADD_LIBRARY_WITH_PATH
- PHP_ADD_LIBPATH
2024-07-26 23:26:55 +02:00
Christoph M. Becker
a7bd911ad6
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix type incompatibility in assignment.
2024-07-26 14:59:14 +02:00
Peter Kokot
fa7ee84f0b
Autotools: Quote PHP_CONFIG_NICE arguments 2024-07-26 09:58:59 +02:00
Michael Orlitzky
44b0baf705
ext/dba/tests: sort expected test output (#14962)
* ext/dba/tests/setup/setup_dba_tests.inc: sort test output

Iterating through a database with firstkey() and nextkey() is
guaranteed to retrieve all rows, but apparently not in any particular
order. This is causing a test failure for at least one user, so we
steal the sort() approach from GDBM to ensure that the output is
predictable.

* ext/dba/tests/dba_*.phpt: sort expected test output

The actual output is now sorted for consistency, so we need to update
the expected output as well. As a nice side effect, some differences
in the expected outputs for the various engines have been eliminated.

Closes GH-14786

* ext/pgsql/tests/80_bug14383.phpt: sort expected test output

This test uses a routine from ext/dba that now sorts its (actual)
output, so we have to sort the expected output here as well.

* ext/dba/tests/setup/setup_dba_tests.inc: update comment

After doing some more digging, it looks like GDBM isn't the only
engine where the iteration order with firstkey() and nextkey()
might change unexpectedly.
2024-07-26 01:16:52 +01:00
Christoph M. Becker
ab449a7e46
Add missing cstddef include for C++ builds
Closes GH-15096.
2024-07-25 14:33:03 +02:00
Niels Dossche
ad452086d9
Add tidyNode::getNextSibling() and tidyNode::getPreviousSibling()
These get the next and previous sibling nodes, respectively.
We can already kind of do this by using the $child array, but that's
inconvenient when actually walking the tree by only using node
instances. Since the class is final, there is no BC break here.

Closes GH-15047.
2024-07-25 13:55:20 +02:00
Ilija Tovilo
a0a8624346
Fix throw in IS_IDENTICAL in JIT (#15103)
We need to persist opline in case zend_is_identical() throws.
2024-07-25 13:18:47 +02:00
Christoph M. Becker
da72ac11f6
Fix GH-15094: php_random_default_engine() is not C++ conforming
Using compound literals is conforming to C99 (and up), but not with any
C++ standard.  Since the code is in a public header, it might be used
by C++ extensions.  Unfortunately, we cannot even used designated
initializers, because these are a C++20 feature, so we stick with
classic C/C++ code.

Closes GH-15100.
2024-07-25 12:44:25 +02:00
Peter Kokot
82e63a06e2
Add pcre dependency as required to ext/filter (#15099)
This is configure phase dependency synced with already present Autotools
pcre dependency check.
2024-07-24 23:30:57 +02:00
Peter Kokot
b0db5e76a0
Autotools: Normalize ext/mbstring installed headers (#15097)
This uses the default PHP_INSTALL_HEADERS macro instead of a wrapper,
making this in tune with the rest of the extensions.
2024-07-24 22:41:16 +02:00
Peter Kokot
ce8ffedccf
Autotools: Normalize ext/fileinfo sources (#15082) 2024-07-24 19:55:37 +02:00
Peter Kokot
d22abb5fa9
Autotools: Quote PHP_NEW_EXTENSION arguments (#15081)
This removes redundant shell double quotes as PHP_NEW_EXTENSION macro
already wraps the flags argument in quotes.
2024-07-24 19:55:19 +02:00
Peter Kokot
da69755eca
Autotools: Sync CS in opcache Capstone check (#15084)
- Added Capstone check message in configure log
- PKG_CHECK_MODULES already errors out by default if Capstone is not
  found with a bit more informative message
- Autoconf syntax used
- HAVE_CAPSTONE help text synced and updated
2024-07-24 19:55:01 +02:00
Peter Kokot
e3c1e3326c
Autotools: Normalize ext/opcache sources (#15083)
- m4_normalize can simplify the list of source files
- PHP_NEW_EXTENSION arguments quoted and excessive shell double quotes
  character removed (macro already adds double quotes)
- Removed redundant shell variable parameter expansions
- Minor Autoconf CS syncs
2024-07-24 18:59:13 +02:00
Christoph M. Becker
58ac56f4bb
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-15087 IntlChar::foldCase()'s $option is not optional
2024-07-24 16:48:44 +02:00
Christoph M. Becker
6727f548b0
Port "gd2: use existing overflow2() rather than ad-hoc version" (#15090)
We port this modification[1] from libgd into our bundled libgd, because
the change makes sense, and we want the code bases to stay in sync as
close as possible.

We also apply a quick fix to the respective test.

[1] <f0a059be6c>
2024-07-24 14:18:36 +02:00
Ilija Tovilo
8b6f14a9a2
Compile in opcache without COMPILE_IGNORE_INTERNAL_CLASSES (#15025) 2024-07-24 13:07:28 +02:00
Dmitry Stogov
8e93eb2e79
Merge branch 'PHP-8.3'
* PHP-8.3:
  Workaraound against false positive GCC array bounds error (#15078)
2024-07-24 08:21:48 +03:00
Peter Kokot
40cf2e1279
Autotools: Normalize pcre sources (#15085) 2024-07-24 01:53:51 +02:00
Peter Kokot
6cdff7573a
Autotools: Normalize ext/gd sources (#15086) 2024-07-24 01:52:51 +02:00
Levi Morrison
9d25296723
Merge branch 'PHP-8.3' 2024-07-23 16:34:16 -06:00
Arnaud Le Blanc
e63f822e6a
Fix test on alpine/musl (#15072)
When libxml uses musl iconv, GBK encoding is not supported as a target encoding
2024-07-23 16:07:26 +02:00
Simonov Denis
00e45887fa
PDO_Firebird: Supported Firebird 4.0 datatypes (#14897)
Five new data types are now available: INT128, DEC16, DEC34, TIMESTAMP_TZ, TIME_TZ.
These are available starting with Firebird 4.0.

closes #14897
2024-07-23 22:34:21 +09:00
Arnaud Le Blanc
d4ef8b97f5
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix build on platforms without JIT support (#15069)
2024-07-23 13:43:25 +02:00
Peter Kokot
518939a08c
Autotools: Normalize ext/dom sources (#15073) 2024-07-23 01:45:57 +02:00
David Carlier
e1c8a85244
Merge branch 'PHP-8.3' 2024-07-22 23:26:40 +01:00
David Carlier
c8440343cd
Merge branch 'PHP-8.3' 2024-07-22 22:58:54 +01:00
Niels Dossche
32fe9bc430
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix uninitialized memory in network.c
2024-07-22 22:26:02 +02:00
Peter Kokot
40e0d3a276
Autotools: Check for crypt and crypt_r with AC_* macros (#15060)
This checks if crypt and crypt_r functions are available on the system
in default libraries or in the crypt library with the AC_SEARCH_LIBS.
The redundant HAVE_LIBCRYPT symbol is removed.
2024-07-22 21:51:18 +02:00
Peter Kokot
499ea9067d
Sync required phar dependencies (#15058)
Required extensions hash and spl are added to the configure phase as
required. They are also already noted as ZEND_MOD_REQUIRED.
2024-07-22 21:30:15 +02:00
David Carlier
21418b5bb5
ext/intl: SpoofChecker::setAllowedChars support.
To limit the acceptable range of acceptable unicode chars via individual
ones or via a pattern.
2024-07-22 19:52:56 +01:00
Arnaud Le Blanc
b537f01353
[ci skip] NEWS 2024-07-22 19:30:32 +02:00
Arnaud Le Blanc
c60dbecb69
Merge branch 'PHP-8.3'
* PHP-8.3:
  [ci skip] NEWS
  Hint the opcache shm mapping location only when JIT is enabled
  Fix the JIT buffer relocation failure at the corner case (#11266)
2024-07-22 19:28:52 +02:00
Arnaud Le Blanc
f4eb81d70e
Followup GH-14996 (#15062) 2024-07-22 19:16:29 +02:00
Niels Dossche
810999ae31
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix bogus fallthrough path in firebird_handle_get_attribute()
2024-07-22 18:33:41 +02:00
Bob Weinand
e406ec81f4 Merge branch 'PHP-8.3' 2024-07-22 18:32:04 +02:00
Saki Takamachi
f4391d4d2c
Fixed segmentation fault when attribute value was not set (#15065) 2024-07-23 01:17:21 +09:00
Niels Dossche
543c4bb7bc
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix passing non-finite timeout values in stream functions
2024-07-22 17:53:00 +02:00
Niels Dossche
77f870e98e
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-14286 (ffi enum type (when enum has no name) make memory leak)
2024-07-22 17:45:28 +02:00
Peter Kokot
2f0bb9293c
Autotools: Append rt library to FPM_EXTRA_LIBS (#15059)
This appends the possible rt library as needed on Solaris <= 10 to
FPM_EXTRA_LIBS instead of the global LIBS variable for all SAPIs to have
cleaner build. The possible required rt library for other SAPIs is also
checked in the configure.ac.
2024-07-22 17:19:55 +02:00
Ilija Tovilo
82479e89d0
Throw error for recursive comparison, instead of fatal (#14989)
I don't understand the rationale of fatal erroring here. It seems this should
properly unprotect the compared elements when returning up the stack.

Related to GH-14980
2024-07-22 15:53:41 +02:00
Dmitry Stogov
e4d86998f6
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix Windows build
2024-07-22 16:41:43 +03:00
Dmitry Stogov
037da5941c
Merge branch 'PHP-8.3'
* PHP-8.3:
  Regenerate FFI parser using HEAD version of LLK
2024-07-22 16:02:12 +03:00
Saki Takamachi
8a4a30469a
Zend: Add ZEND_BYTES_SWAP32/ZEND_BYTES_SWAP64 (#14910) 2024-07-22 17:57:16 +09:00
Peter Kokot
fe9fdd4fc3
Autotools: Fix unused result and variables warnings in flush IO check (#15056)
- exit() replaced with regular return since these two behave the same in
  main()
- main(void) used as argc and argv aren't used
- if sentences wrapped in curly brackets for readability
- fgets wrapped in if to check for the return result and omit the
  "ignoring return value of 'fgets' declared with attribute
  'warn_unused_result'..." warnings in the config.log
- fclose(fp) added before returning
2024-07-22 10:00:14 +02:00
Dmitry Stogov
7b25cac32b
Update IR
IR commit: 8fb33ceccd39d0052c5949cf96fc135e7ba1fbcb
2024-07-22 09:43:11 +03:00
lwlinux
15470bd16c
sapi/cli/php_cli.c: fix typos (#15057) 2024-07-22 06:41:02 +01:00
Peter Kokot
9f74329bb6
Merge branch 'PHP-8.3'
* PHP-8.3:
  Append -Wno-implicit-fallthrough flag conditionally (#13331)
2024-07-22 07:02:25 +02:00
Peter Kokot
e6089b0920
Add upgrading note about Autoconf cache variables (#14985)
[skip ci]
2024-07-22 02:10:48 +02:00
Peter Kokot
90e63d8a94
[skip ci] Remove GH-14685 artefact 2024-07-22 00:57:34 +02:00
Niels Dossche
af830d866f
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-15034: Integer overflow on stream_notification_callback byte_max parameter with files bigger than 2GB
2024-07-21 22:03:06 +02:00
Niels Dossche
9b78e5ff1c Remove useless return 2024-07-21 18:36:19 +02:00
Niels Dossche
186788f149 Fix error handling in tidy constructor 2024-07-21 18:36:19 +02:00
Niels Dossche
1d045a5c97 Use RETVAL_BOOL or RETURN_BOOL in ext/tidy 2024-07-21 18:36:19 +02:00
Niels Dossche
09c0455f64 Consistently check zend_result in the same way 2024-07-21 18:36:19 +02:00
Niels Dossche
e736d7cd8a Make more pointers const in ext/tidy 2024-07-21 18:36:19 +02:00
David Carlier
f6940b9239
[ci skip] NEWS update 2024-07-21 17:16:43 +01:00
Niels Dossche
c952f5625a
Update Lexbor
Upstream commit 48afb625af9178d1929ec81349f173116b136310.
2024-07-21 18:08:59 +02:00
David Carlier
3713c02803
sapi/fpm: retiring solaris /dev/poll support proposal.
Since Solaris 10, the port API is supported, is more modern, less bug
prone and offers, on average, better performances.

Close GH-14685
2024-07-21 17:03:41 +01:00
Niels Dossche
9435f4d55b
Throw instead of silently failing when creating a too long text node
Lower branches suffer from this as well but we cannot change the
behaviour there.
We also add NULL checks to check for allocation failure.

Closes GH-15014.
2024-07-21 17:08:06 +02:00
Niels Dossche
c4e1f2b4e8
Factor out object creation code in ext/tidy 2024-07-21 17:01:47 +02:00
Niels Dossche
551c4a3bf8
Use OBJ_RELEASE instead of ZVAL_OBJ + zval_ptr_dtor in php_dom.c (#15052) 2024-07-21 16:57:05 +02:00
Niels Dossche
d14b936d4f
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix memory leaks in ext/tidy basedir restriction code
2024-07-21 16:28:51 +02:00
Niels Dossche
d5faf44e90
Remove bogus tree setting code from parentnode/tree.c (#15044)
I don't know why this code was here in the first place, it is present
since the initial implementation. It doesn't make sense because:
1. It would require updating the refcounts if the document wasn't
   actually already set.
2. We enforce that the document is the same as the target document by
   this point, so setting the tree is pointless.
2024-07-21 13:53:12 +02:00
Peter Kokot
c4546d4923
Autotools: Sync CS in ext/standard process check (#15049)
- AC_* macros simplified and arguments quoted
2024-07-21 08:38:06 +02:00
Peter Kokot
97afc86437
Autotools: Quote M4 arguments (#15045)
- AC_MSG_CHECKING
- AC_MSG_RESULT
- AC_MSG_WARN
- AC_MSG_ERROR
- AC_MSG_NOTICE
2024-07-21 01:52:17 +02:00
David Carlier
ba54cebb44
ext/pgsql: pg_convert/pg_insert/pg_update/pg_delete caching regexes.
Close GH-15039
2024-07-20 23:04:48 +01:00
Niels Dossche
2cfcfe09a0
Convert more common methods in dom/node.c to fast ZPP (#15043) 2024-07-20 20:20:32 +02:00
Niels Dossche
29466223d0 Move stricterror fetch to dom_child_removal_preconditions() body 2024-07-20 20:01:55 +02:00
Niels Dossche
74116a4ade Remove impossible condition
The parent's child must exist because otherwise this node could not have
a parent node.
2024-07-20 20:01:55 +02:00
Saki Takamachi
1fc2ddc996
random: Optimize Randomizer::getBytesFromString() (#14894)
Co-authored-by: Tim Düsterhus <tim@bastelstu.be>
2024-07-20 15:42:47 +02:00
Peter Kokot
68ae477796
Autotools: Quote M4 arguments (#15033)
- PHP_ADD_INCLUDE
- PHP_EVAL_INCLINE
- PHP_EVAL_LIBLINE
2024-07-20 07:21:44 +02:00
David CARLIER
39b1006306
ext/pgsql: db metadata simplification for table names. (#15036) 2024-07-19 22:47:52 +01:00
Calvin Buckley
a63fd2a95a
Gate SOCK_DCCP behind its own ifdef (#15031)
AIX 7.1 has SOCK_CONN_DGRAM, but not SOCK_DCCP; the previous change
conflated the availability between the two definitions. Add an
additional #ifdef for this.
2024-07-19 16:41:29 -03:00
Peter Kokot
6857c7c8d6
Autotools: Expand m4_normalize sooner (#15018)
Quoted m4_normalize will expand and change its argument later in the
macro call when M4 is processing the *.m4 sources. Without quotes the
already normalized string is passed to the macro directly. In these
specific cases generated configure script is the same. This is more for
consistency to have this synced and not repeat the pattern too much
in the future when copy/pasting. Note, that many AC_* macros require
similar behavior already (for example, AC_CHECK_FUNCS.)
2024-07-19 15:20:04 +02:00
Niels Dossche
442ae96444
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-15028: Memory leak in ext/phar/stream.c
  Fix GH-15023: Memory leak in Zend/zend_ini.c
  Fix GH-15020: Memory leak in Zend/Optimizer/escape_analysis.c
2024-07-19 14:59:57 +02:00
Niels Dossche
d75abdcec4
Add assertion to error path in streams.c (#15027)
This makes the developer intent clear and should prevent some false
reports.
2024-07-19 14:51:54 +02:00
Christoph M. Becker
004f3d5eef
Merge branch 'PHP-8.3'
* PHP-8.3:
  Update the php-sdk-binary-tools to php-sdk-2.3.0
2024-07-19 12:26:32 +02:00
Arnaud Le Blanc
1fbb666545
Use zend_std_build_properties() to access zend_object.properties
The zend_object.properties HashTable needs to be built just in time by calling
rebuild_object_properties() on the object before accessing it. Normally this is
done automatically in zend_std_get_properties(), but we do it manually in a few
places.

In this change I introduce an inline variant of zend_std_build_properties(), and
refactor these places to use it instead of calling rebuild_object_properties()
manually.

rebuild_object_properties() renamed as rebuild_object_properties_internal(), to
enforce usage of zend_std_get_properties() or zend_std_build_properties_ex().

Closes GH-14996
2024-07-18 22:18:38 +02:00
Peter Kokot
436baae172
[skip ci] Sync HAVE_SIGSETJMP removal
This adds notice in the UPGRADING.INTERNALS file and removes redundant
undefinition from Windows config header.

Follow-up of GH-14942.
2024-07-18 22:15:33 +02:00
Peter Kokot
b9e1ea33b9
[skip ci] Trim trailing whitespace in *.m4 2024-07-18 22:11:13 +02:00
Niels Dossche
80a4783d25
Deduplicate NULL checks in ext/dom (#15015)
This introduces a new helper php_dom_create_nullable_object() that does
the NULL check and puts NULL in return_value. Otherwise it runs
php_dom_create_object(). This deduplicates a bit of code.
2024-07-18 21:20:03 +02:00
Niels Dossche
27205bd3c3
Cleanup DOMAttr::isId() (#15016) 2024-07-18 21:19:54 +02:00
Tim Düsterhus
5905857fd2
RFC: Add the RoundingMode enum (#14833)
see https://wiki.php.net/rfc/correctly_name_the_rounding_mode_and_make_it_an_enum

Co-authored-by: Saki Takamachi <saki@php.net>
Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
2024-07-18 20:44:30 +02:00
Niels Dossche
81da53fccd
Convert forgotten efree to zend_string_release
Follow-up for 2d029efd94
2024-07-18 17:32:50 +02:00
Niels Dossche
2d029efd94
Avoid duplicating the filename string when profiling in XSL (#15010) 2024-07-18 17:27:53 +02:00
Niels Dossche
a59103feed
Fix trampoline leak in xpath callables
Closes GH-15009.
2024-07-18 16:54:46 +02:00
Niels Dossche
5471f3d922
Don't open-code string value accesses in xpath (#15007) 2024-07-18 15:22:44 +02:00
Gina Peter Banyard
efe4e6d38e
ext/spl: Add ArrayObject test with property hooks (#15005)
As expected, ArrayObject is cursed
2024-07-18 13:10:00 +01:00
Niels Dossche
b05de66a3a
Optimize ext/dom $wholeText (#15001)
Use our own string builder instead of using libxml's and then having to
copy over.

For the following test:
```
$dom = Dom\HTMLDocument::createEmpty();
$root = $dom->appendChild($dom->createElement('root'));
$root->append('abc', 'def', 'ghi');
$f = $root->firstChild;

for ($i = 0; $i < 1000000; $i++)
	$f->wholeText;
```

The following results were obtained on an i7-4790:
```
Benchmark 1: ./sapi/cli/php x.php
  Time (mean ± σ):      57.2 ms ±   2.3 ms    [User: 53.2 ms, System: 3.4 ms]
  Range (min … max):    54.7 ms …  69.3 ms    52 runs

Benchmark 2: ./sapi/cli/php_old x.php
  Time (mean ± σ):      89.4 ms ±   3.4 ms    [User: 85.6 ms, System: 3.0 ms]
  Range (min … max):    86.1 ms … 105.8 ms    32 runs

Summary
  ./sapi/cli/php x.php ran
    1.56 ± 0.09 times faster than ./sapi/cli/php_old x.php
```
2024-07-18 12:57:23 +02:00
Christoph M. Becker
2d88427bc7
Merge branch 'PHP-8.3'
* PHP-8.3:
  Revert "Skip bug45161.phpt on Windows"
2024-07-18 12:44:27 +02:00
Christoph M. Becker
f507da913a
[ci skip] Clarify usage of C99 standard (#14993)
This is mostly about mentioning that VLAs which are a required part of
C99 conforming implementations (although made optional in the C11
standard) *must* *not* be used in php-src.
2024-07-18 11:40:58 +02:00
David Carlier
223683dfb5
Merge branch 'PHP-8.3' 2024-07-18 06:26:54 +01:00
Saki Takamachi
c550d341ff
ext/pdo_firebird: Added getApiVersion() and removed from getAttribute (#15004) 2024-07-18 11:17:52 +09:00
Saki Takamachi
4cb82b039e
ext/pdo_firebird: Do not implement new constants in PDO core (#14995) 2024-07-18 08:12:17 +09:00
Niels Dossche
b3a4a6b1e1
Resolve TODOs in ext/dom around nullable content (#14999)
It's indeed possible this is NULL. When you create a new text-like node
in libxml and pass NULL as content, you do get NULL in the content field
instead of the empty string. You can hit this by creating DOMText or
DOMComment directly and not passing any argument. This could also be
created internally.
We refactor the code such that this detail is hidden and we add a test
to check that it correctly throws an exception.
2024-07-18 00:05:40 +02:00
David CARLIER
8d597150ee
zend build making sigjmp_buf and api check as mandatory. (#14942)
* zend build making sigjmp_buf and api check as mandatory.

all unixes support it since long time, the few which don't do not meet
the requirements to build php anyway (minix, dietlibc, ...).
2024-07-17 22:18:35 +01:00
Niels Dossche
1b077725eb
[ci skip] Remove outdated comment 2024-07-17 22:27:09 +02:00
Niels Dossche
7d99a9cea1
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix bug #55639: Digest autentication dont work
2024-07-17 19:35:19 +02:00
Sergey Panteleev
0caaeb68cf
[ci skip] Update release process for pre-GA (#14988) 2024-07-17 17:55:03 +03:00
Peter Kokot
cf1835b8b6
Autotools: Fix Autoconf syntax (erroneous dnl) (#14987)
M4 interprets the dnl in this combination of m4_ifnblank as part of the
preceding text so the [] can be used to avoid this issue.
2024-07-17 15:47:20 +02:00
David CARLIER
2aeff2c988
main: update Winsock api version to 2.2 (#14909)
not been updated since php 4 whereas 2.2 is available even in Win2000.
2024-07-17 14:17:29 +01:00
Saki Takamachi
3c9ab6eb71
ext/bcmath: Moved macros and added a test 2024-07-17 21:48:16 +09:00
Saki Takamachi
acd6ac3324
Fixed parent class of stub (#14990) 2024-07-17 21:38:59 +09:00
Saki Takamachi
d55ef3f339
ext/pdo_firebird: Added Pdo\Firebird::ATTR_API_VERSION (#14916)
closes #14916
2024-07-17 20:32:37 +09:00
Niels Dossche
b2c3f2fead
Delete bug78987.phpt test (#14982)
This test fails over and over again every time we update the library or
because of small changes elsewhere. This leads to a cycle of test
failures and us bumping the values again. This test has little value so
I propose to just get rid of it.

Fixes GH-13795.
2024-07-17 12:59:17 +02:00
Christoph M. Becker
f590b34530
Drop support for OpenSSL < 1.1.0 on Windows
PR #13498 bumped the required OpenSSL version to 1.1.1, but apparently
only for non Windows system.  We catch up somewhat by dropping support
for OpenSSL < 1.1.0 on Windows; besides completely removing detection
of old OpenSSL versions in `SETUP_OPENSSL`, we also ensure that all
bundled extension using this function do no longer accept OpenSSL <
1.1.0, to avoid to still be able to build these extensions with older
`phpize` scripts.

We do not cater to `--phar-native-ssl` yet; that might better be
addressed by #14578.

Closes GH-14973.
2024-07-17 12:22:59 +02:00
Ilija Tovilo
ead679ecf8
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix comments between -> and keyword
2024-07-16 23:41:07 +02:00
Ilija Tovilo
fdbe910b3b
Fix indirect readonly error messages (#14979)
$obj->ro[] = 42;, passByRef($obj->ro); and the likes should emit an indirect
modification error message. This message already existed but was used
inconsistently.
2024-07-16 23:24:07 +02:00
Peter Kokot
71c520c74f
Fix xmlreader extension phpize build
When building ext/xmlreader with phpize, also ext/dom/dom_ce.h needs to
be installed by dom extension as it is used in
the ext/xmlreader/php_xmlreader.c.

    cd ext/xmlreader
    phpize
    ./configure
    make

Closes GH-14978
2024-07-16 22:35:59 +02:00
Niels Dossche
eb181926be
[ci skip] Fix NEWS 2024-07-16 22:25:41 +02:00
Niels Dossche
251b7896ff
Use fast ZPP for ParentNode manipulation methods (#14981)
These are very common, and parsing variadic arguments takes a very long
time, so this optimization makes sense to do.
2024-07-16 20:36:24 +02:00
Niels Dossche
f58a3c392f
Fix references in request_parse_body() options array
Otherwise we get funny messages like
"Invalid string value in $options argument".

Closes GH-14977.
2024-07-16 20:07:59 +02:00
Saki Takamachi
c4f1c5cd9f
Updated firebird version in windows ci (#14912) 2024-07-16 19:56:14 +02:00
Julien Voisin
ae2abcf3e8
Add a check for required extensions in benchmark.php (#14811)
This should prevent people from being disappointed by
an unexpected error message when running the benchmark,
namely:

```
jvoisin@chernabog 21:54 (master) ~/dev/php-src php ./benchmark/benchmark.php false sapi/cgi/php-cgi
> 'valgrind' '--tool=callgrind' '--dump-instr=yes' '--callgrind-out-file=/home/jvoisin/dev/php-src/benchmark/profiles/callgrind.out.bench' '--' 'sapi/cgi/php-cgi' '-T1' '-d max_execution_time=0' '-d opcache.enable=1' '-d opcache.jit=disable' '-d opcache.jit_buffer_size=128M' '-d opcache.validate_timestamps=0' '/home/jvoisin/dev/php-src/Zend/bench.php'
> 'valgrind' '--tool=callgrind' '--dump-instr=yes' '--callgrind-out-file=/home/jvoisin/dev/php-src/benchmark/profiles/callgrind.out.bench.jit' '--' 'sapi/cgi/php-cgi' '-T1' '-d max_execution_time=0' '-d opcache.enable=1' '-d opcache.jit=tracing' '-d opcache.jit_buffer_size=128M' '-d opcache.validate_timestamps=0' '/home/jvoisin/dev/php-src/Zend/bench.php'
> '/usr/bin/php' '/home/jvoisin/dev/php-src/benchmark/repos/symfony-demo-2.2.3/bin/console' 'cache:clear'
> '/usr/bin/php' '/home/jvoisin/dev/php-src/benchmark/repos/symfony-demo-2.2.3/bin/console' 'cache:warmup'
> 'valgrind' '--tool=callgrind' '--dump-instr=yes' '--callgrind-out-file=/home/jvoisin/dev/php-src/benchmark/profiles/callgrind.out.symfony-demo' '--' 'sapi/cgi/php-cgi' '-T50,50' '-d max_execution_time=0' '-d opcache.enable=1' '-d opcache.jit=disable' '-d opcache.jit_buffer_size=128M' '-d opcache.validate_timestamps=0' '/home/jvoisin/dev/php-src/benchmark/repos/symfony-demo-2.2.3/public/index.php'
PHP Fatal error:  Uncaught Error: Call to undefined function gmp_strval() in /home/jvoisin/dev/php-src/benchmark/benchmark.php:128
Stack trace:
  thrown in /home/jvoisin/dev/php-src/benchmark/benchmark.php on line 128
[255]
jvoisin@chernabog 12:05 (master) ~/dev/php-src
```
2024-07-16 19:37:20 +02:00
Pierrick Charron
f0dc7ad5ce
Merge branch 'PHP-8.3'
* PHP-8.3:
  [skip ci] Fix PHP 8.3.10 release date and version in NEWS
  PHP-8.2 is now for PHP 8.2.23-dev
2024-07-16 12:24:03 -04:00
Ilija Tovilo
a26ec58fa1
De-duplicate readonly property modification error message (#14972) 2024-07-16 16:29:40 +02:00
Tim Düsterhus
551038bb16
zend_compile: Fully remove ZEND_DIM_ALTERNATIVE_SYNTAX (#14974)
This flag is longer set since the merge of property hooks in
780a8280d2. This patch removes it completely,
because the corresponding error messages are unreachable.
2024-07-16 16:27:46 +02:00
Eric Mann
a4c867e8cf
Merge branch 'PHP-8.3' 2024-07-16 06:58:03 -07:00
Ayesh Karunaratne
e7c16d2a6a
Build/Windows: Update the Windows icon as svg and build derivatives from it
Co-Authored-By: Nurudin Imsirovic <realnurudinimsirovic@gmail.com>

Closes GH-14964.
2024-07-16 14:47:31 +02:00
Ilija Tovilo
aa006f1cf6
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix use-after-free in property coercion with __toString()
2024-07-16 12:44:01 +02:00
Ilija Tovilo
7e022ea056
Avoid duplicate code in zend_std_write_property() (#14966) 2024-07-16 12:08:46 +02:00
Peter Kokot
a2bc783815
Autotools: Add missing sigil in AC_CASE and fix Autoconf syntax (#14967) 2024-07-16 08:55:22 +02:00
Peter Kokot
ccd2787947
[skip ci] Update PHP version in phpdbg help (#14965) 2024-07-16 07:02:05 +02:00
Peter Kokot
9c84d24706
[skip ci] Update UPGRADING.INTERNALS
Related to GH-14963
2024-07-16 00:42:16 +02:00
Calvin Buckley
6635948b7a
Check for iODBC and unixODBC with pkg-config in PDO_ODBC (#14963)
* Check for iODBC and unixODBC with pkg-config in PDO_ODBC

PDO_ODBC required that these backends had their path specified manually,
which was clumsy and contrary to how procedural ODBC checked it. This
adds a pkg-config based path to check for these backends that ignores
the 'dir' part of the flag, so i.e. --with-pdo-odbc=unixODBC should pick
it up from the correct location.

Generic and the special ibm-db2 usecase should be unaffected. The header
situation is unfortunately ugly, and has a workaround; this should also
be cleaned up.

* Move check for valid headers to after

* Use existing CFLAGS for PDO_ODBC header check

...instead of a separate funny variable. It does mean we have to save
and restore the value of CPPFLAGS, as AC_CHECK_HEADERS and friends rely
on that variable instead of CFLAGS.

Co-authored-by: Peter Kokot <peterkokot@gmail.com>

* Move PDO_ODBC_TYPE to AC_DEFINE, simplify CFLAGS handling

The variable PDO_ODBC_INCLUDE becomes redundant, as is the CFLAGS
override for PHP_NEW_EXTENSION if we call PHP_EVAL_INCLINE in the
generic case.

Co-authored-by: Peter Kokot <peterkokot@gmail.com>

* Use same variable names so evals can be combined

* Fix identation

* Suggested shell syntax cleanups

---------

Co-authored-by: Peter Kokot <peterkokot@gmail.com>
2024-07-16 00:40:02 +02:00
Niels Dossche
7b3d7c6338
[ci skip] NEWS for return type change in ext/standard
See 673b4e890c
2024-07-15 23:22:49 +02:00
Ayesh Karunaratne
673b4e890c
ext/standard: change highlight_string()/print_r stub return type from string|bool to string|true (#14959)
* ext/standard: change `highlight_string()` return type from `string|bool` to `string|true`

* ext/standard: change `print_r` return type from `string|bool` to `string|true`
2024-07-15 23:20:32 +02:00
Ilija Tovilo
913157f71f
Extract obtaining of fake scope into function (#14960) 2024-07-15 20:00:15 +02:00
Peter Kokot
694e04499a
Autotools: Sync LIBS and LDFLAGS handling (#14956)
- ZEND_EXTRA_LIBS holds all possible libraries appended during the
  checks related to Zend.m4, moved after the ZEND_INIT check to make it
  more clear, redundant double quotes removed;
- EXTRA_LIBS has already been populated above in the configure.ac
- redundant 'unset LIBS' removed
2024-07-15 12:16:53 +02:00
Niels Dossche
6980eba863
Support templated content
The template element in HTML 5 is special in the sense that it does not
add its contents into the DOM tree, but instead keeps them in a separate
shadow DOM document fragment. Interacting with the DOM tree cannot touch
the elements in the document fragment.

Closes GH-14906.
2024-07-15 11:10:51 +02:00
Niels Dossche
8ad5c64393
Refactor XML serializer such that passing context is easier 2024-07-15 11:02:53 +02:00
Niels Dossche
4ef7539144
Split off private data from the ns mapper 2024-07-15 11:02:52 +02:00
Jorg Adam Sowa
85b7181d7d
Added property hooks words in fuzzer parser dict (#14958) 2024-07-14 22:52:25 +02:00
Peter Kokot
1fe854ebfa
Autotools: Sync quotes in PHP_INSTALL_HEADERS
Follow-up of GH-13213

[skip ci]
2024-07-14 22:16:48 +02:00
Peter Kokot
8e8dc40765
Fix #78757: Enhance sendmail log notice (#14955)
The sendmail is set to default value of /usr/sbin/sendmail if not found
on the host system. This was already properly fixed via GH-5548
(commit 517431892b). This change now
also outputs "no" when searching for sendmail and a minimalistic notice
that default send_mail INI directive has been set to /usr/sbin/sendmail.

Fixes and closes: https://bugs.php.net/78757
2024-07-14 22:00:43 +02:00
Peter Kokot
47d3ce4545
Autotools: Quote RE2C_FLAGS argument (#14950)
This enables and simplifies adding blank-or-newline-separated global
re2c flags to the PHP_PROG_RE2C macro possibly at some point. Fixed just
in case, so this works normally:

    PHP_PROG_RE2C([1.0.3], [--no-generation-date -W -foo])
2024-07-14 20:38:57 +02:00
Ilija Tovilo
20d8151b35
Add cachegrind support for php-cgi warmups (#14952)
Cachegrind supports cg_annotate --diff, which makes it much easier to compare
the performance of two patches.

Co-authored-by: Peter Kokot <peterkokot@gmail.com>
2024-07-14 19:53:16 +02:00
Peter Kokot
0051b73a3e
Autotools: Refactor PHP-FPM /proc/pid filename check (#14949)
- Check wrapped in AC_CACHE_CHECK using php_cv_file_proc_mem variable
- CS synced
2024-07-14 17:20:41 +02:00
Peter Kokot
0e2e8e0f13
Autotools: Quote all PHP_ADD_BUILD_DIR arguments (#14947)
- All arguments quoted for consistency
- m4_normalize used where list of directories becomes a bit simpler to
  read and see the diff
2024-07-14 16:58:43 +02:00
Christoph M. Becker
82fe4a2d48
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix skip condition of gh13082.phpt
2024-07-14 13:40:38 +02:00
Ilija Tovilo
e38d5107ec
[skip ci] Fix NEWS entry 2024-07-14 13:39:10 +02:00
Ilija Tovilo
a0c42df4f9
[skip ci] Add property hooks entry to NEWS 2024-07-14 13:37:55 +02:00
Ilija Tovilo
f7649dc103
[skip ci] Fix duplicate core header in NEWS 2024-07-14 13:36:45 +02:00
Christoph M. Becker
a6d1844446
Merge branch 'PHP-8.3'
* PHP-8.3:
  Add test case for GH-13774
2024-07-14 12:48:22 +02:00
Ilija Tovilo
780a8280d2
[RFC] Property hooks (#13455)
RFC: https://wiki.php.net/rfc/property-hooks

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2024-07-14 11:55:03 +02:00
Peter Kokot
09d61b6368
Autotools: Refactor curl config.m4 (#14948)
- CS synced
- When checking for libcurl linked against old OpenSSL the LIBS can be
  used instead of LDFLAGS to put -lcurl to proper place. Also, flags
  manipulation variables are wrapped in the AC_CACHE_CHECK commands
  because there is also OpenSSL setup done later in the code which
  changes LDFLAGS, LIBS and/or CFLAGS.
- CFLAGS added to the check to have edge case of -I flags of custom
  installation paths taken into consideration
- All macro arguments quoted
- SSL check simplified a bit
- The HAVE_CURL symbol help text synced
2024-07-14 03:55:23 +02:00
Peter Kokot
35f64bb5e1
Autotools: Trim redundant newlines in PHP_ADD_BUILD_DIR (#14946)
This reduces redundant newlines in the generated configure script while
keeping possible 'dnl' usage before or after this macro call working as
before (backwards compatible).
2024-07-14 00:07:51 +02:00
Peter Kokot
808d5b3047
[ci skip] Add note about --with-openssl-legacy-provider
Added here to have all build system configuration options changes also
at one place for easier overview.

Option added via GH-13951
2024-07-13 23:21:45 +02:00
Peter Kokot
31a21bb0a1
Make ext/fileinfo/generate_patch.sh simpler to use (#14941)
- Shebang added so it can be called with ./generate_patch.sh
- Script changes its working directory to ext/fileinfo (where it is
  located) so it can be also called as ./ext/fileinfo/generate_patch.sh
- Syntax adjusted a bit for using Bourne or a compatible shell (/bin/sh)
- Downloaded files added to .gitignore
2024-07-13 22:38:43 +02:00
David Carlier
79c134a6e8
Merge branch 'PHP-8.3' 2024-07-13 17:00:53 +01:00
Peter Kokot
520787bb93
Autotools: Refactor PDO_ODBC_CHECK_HEADER (#14935)
- Macro renamed to PHP_PDO_ODBC_CHECK_HEADER
- AC_DEFINE_UNQUOTED used instead of PHP_DEF_HAVE
- help texts added to CPP macro definitions
- CS synced a bit
2024-07-13 06:52:25 +02:00
Peter Kokot
1ee4bf1c5f
Autotools: Use LIBS for appending -lonig (#14936)
LDFLAGS is by convention used more for linker options like -s and -L.
The -l option should go to LIBS instead. This does the same check but
is more understandable in the logs and M4 code.
2024-07-13 06:37:58 +02:00
Peter Kokot
fb5d64c300
Autotools: Use FPM_EXTRA_LIBS for SELinux library (#14885)
Instead of appending -lselinux to global LIBS variable, this adds it as
needed only to FPM_EXTRA_LIBS as it was already used in the BUILD_FPM
invocation.

Follow-up of GH-14881
2024-07-13 01:20:44 +02:00
Peter Kokot
2ea79c024c
Autotools: Use FPM_EXTRA_LIBS for apparmor library (#14884)
Instead of appending -lapparmor to global LIBS variable, this adds it as
needed only to FPM_EXTRA_LIBS as it was already used in the BUILD_FPM
invocation.

Follow-up of GH-14881
2024-07-13 01:20:05 +02:00
Peter Kokot
3dd0c11cc3
Autotools: Use FPM_EXTRA_LIBS for systemd library (#14883)
Instead of appending -lsystemd to global LIBS variable, this adds it as
needed only to FPM_EXTRA_LIBS as it was already used in the BUILD_FPM
invocation. Move php_fpm_systemd substitution after its check.

Follow-up of GH-14881
2024-07-13 01:19:16 +02:00
Niels Dossche
1a07bb9252
Fix GH-14873: PHP 8.4 min function fails on typed integer
The problem is that this line in the VM: `ZVAL_NULL(result);` changes the type
of arg1 as well, because after the DFA pass the result and input both use
CV0($result).
We should not contract assignments with CVs in frameless calls with
arguments.
An older attempt is found at GH-14876 that tried to modify the VM/JIT.

Closes GH-14903.
2024-07-13 00:29:09 +02:00
Peter Kokot
8fe127a55e
Autotools: Enhance PHP_EVAL_LIBLINE M4 macro (#14924)
PHP_EVAL_LIBALINE macro processes the given libraries flags (-l) and/or
library paths flags (-L) and appends the -l flags to either LIBS or the
given *_SHARED_LIBADD variables. The -L flags are appended to the
LDFLAGS. The new 3rd argument enables appending libraries to the given
variable in the 2nd argument without manual setting whether the
extension is shared. For example, to simplify usage in SAPIs where
additional libraries need to be appended but they shouldn't go to the
global LIBS. This can be then used in PHP-FPM SAPI to link apparmor,
SELinux, systemd, etc.
2024-07-12 23:48:36 +02:00
Niels Dossche
3703459c3e
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-14930: Custom stream wrapper dir_readdir output truncated to 255 characters in PHP 8.3
2024-07-12 19:28:37 +02:00
Peter Kokot
149abd2fe9
Autotools: Refactor oniguruma invalid KOI8 check (#14928)
- Fixed warning: cast from pointer to integer of different size
  using the intptr_t instead of int type case
- CS synced
- Check wrapped in AC_CACHE_CHECK
- Over-quoted arguments reduced
- Also the include flags added to the check when building with oniguruma
  installed on custom places
2024-07-12 19:26:18 +02:00
Niels Dossche
92c0db398e
Avoid reconciling when cloning into the same document (#14921)
We don't need to reconcile when we clone into the same document because
the namespace mapper is the same. Only when cloning into another
document is the namespace mapper different and do we need a
reconciliation.
2024-07-12 19:23:37 +02:00
Peter Kokot
e935f00fde
Autotools: Simplify the iconv not found error (#14931) 2024-07-12 18:48:22 +02:00
David CARLIER
0f398a437e
sapi/apache: AP_MPMQ_MAX_THREADS is always available. (#14934)
since we upgraded the minimum with 2.4, AP_MPMQ_MAX_THREADS is always
available (since 2.3) and all MPM return a value, including prefork.
2024-07-12 13:22:24 +01:00
Peter Kokot
79215c0727
Autotools: Sync CS for PHP_EBCDIC and PHP_C_BIGENDIAN (#14923)
- Over-quoted arguments reduced
- CS synced a bit
- AS_VAR_IF used instead of raw shell "if test"
2024-07-12 09:05:53 +02:00
Peter Kokot
58a3ab92c3
Autotools: Fix config.status script syntax (#14929)
The init-cmds argument is appended to the config.status script with cat
command and variables $var are replaced during the cat step to their
values, so quoting these values fixes the syntax errors.

* Simplify threaded Apache build detection

Instead of checking for entire "grepped" string, this only checks for
yes|no values instead.

* Redirect the standard output and standard error

The "grep -q" is not portable according to docs so this redirects the
output and checks the exit status.

Fixes report in GH-14872
2024-07-12 02:16:49 +02:00
David CARLIER
246357607c
sapi/apache2handler: function using char * to const char *. (#14925) 2024-07-12 00:34:00 +01:00
Peter Kokot
33928a05a4
Update config.guess to 2024-01-01 and config.sub to 2024-01-01 (#14898)
```
wget -O build/config.guess https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
wget -O build/config.sub https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
```
2024-07-11 21:31:47 +02:00
Saki Takamachi
be4b10e95e
Added scale to bc_compare argument (#14802)
In the original specification, the scale of bc_num was directly changed
and compared.

This becomes a problem when objects are supported, so we will modify it
to compare without changing bc_num.
2024-07-12 00:08:47 +09:00
Christoph M. Becker
32bf50a1d8
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-14888: README.REDIST.BINS refers to non-existing LICENSE [ci skip]
2024-07-11 16:40:39 +02:00
Peter Kokot
5586d0c7de
Autotools: Refactor ptrace check for PHP-FPM (#14907)
- This syncs CS and wraps ptrace function check in a single
  AC_CACHE_CHECK for optional edge case cross-compiling adjustments
- Overquoted arguments are reduced (first the compilation check if
  ptrace in proper form is available on the system and then the run
  check if ptrace works as expected)
- The cache variable php_cv_have_mach_vm_read is renamed to
  php_cv_func_mach_vm_read.
2024-07-11 00:09:08 +02:00
Peter Kokot
d59691c02f
Autotools: Move php_shtool variable initialization to PHP_INIT_BUILD_SYSTEM (#14904)
As this script is still needed across the PHP build system its path can
be also set on once place for both phpize usage and regular php-src's
configure.ac.
2024-07-10 21:15:02 +02:00
David Carlier
17cf7b381a
ext/pcntl adding Pcntl namespace for Qos class.
Close GH-14892
2024-07-10 19:15:04 +01:00
Niels Dossche
71defce4be
Merge branch 'PHP-8.3'
* PHP-8.3:
  ext/gd/tests/gh10614.phpt: skip if no PNG support
2024-07-10 19:51:17 +02:00
Tim Düsterhus
29f98e7485
Replace @deprecated by #[\Deprecated] for internal functions / class constants (#14750)
Co-authored-by: Gina Peter Banyard <girgias@php.net>
Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
2024-07-10 16:47:31 +02:00
Michael
6bb960092a
[skip ci] Fix some typos (#14893) 2024-07-10 00:11:36 +01:00
David CARLIER
93c3ebd209
ext/gd minor corrections concerning image format id for errors. (#14887) 2024-07-09 20:07:07 +01:00
Peter Kokot
9185f613e0
Autotools: Use FPM_EXTRA_LIBS for ACL library (#14881)
- ACL user/group check wrapped in AC_CACHE_CHECK
- instead of appending -lacl to global LIBS variable, this adds it as
  needed only to FPM_EXTRA_LIBS as it was already used in the BUILD_FPM
  invocation
2024-07-09 18:42:31 +02:00
Julien Voisin
c2cbbd9b98
zend_alloc: remove duplicate zend_mm_alloc_large definition (#14880)
The two parts of the #if condition are the same.
2024-07-09 06:46:00 +01:00
Niels Dossche
19813b5b7e
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-14741: Segmentation fault in Zend/zend_types.h
2024-07-09 00:57:35 +02:00
Calvin Buckley
64c7c4c33c Merge branch 'PHP-8.3'
* PHP-8.3:
  Declare that this test needs iconv extension
2024-07-08 18:39:36 -03:00
David CARLIER
479707b4d3
tsrm_realpath_r for win32 mountpoints copy little optimisations. (#14852) 2024-07-08 20:31:12 +01:00
Peter Kokot
9e94d2b040
Autotools: Refactor builtin checks (#14835)
This creates a single M4 macro PHP_CHECK_BUILTIN and removes other
PHP_CHECK_BUILTIN_* macros. Checks are wrapped in AC_CACHE_CHECK and
PHP_HAVE_BUILTIN_* CPP macro definitions are defined to 1 if builtin
is found and undefined if not.

This also changes all PHP_HAVE_BUILTIN_ symbols to be either undefined
or defined (to value 1) and syncs all #if/ifdef/defined usages of them
in the php-src code. This way it is simpler to use them because they
don't need to be defined to value 0 on Windows, for example. This is
done as previous usages in php-src were mixed and on many places they
were only checked with ifdef.
2024-07-08 21:25:16 +02:00
Peter Kokot
745ae8ddd8
Autotools: Remove obsolete crypt link override due to OpenSSL (#14863)
OpenSSL versions before 0.9.7 provided its own crypt() function (and
des_* functions) in its Crypto library that interfered with the
implementation relying on crypt() from some other crypt library. This is
at this point obsolete as crypt and other functions that caused clashes
were removed in OpenSSL version 1.1.0.

In OpenSSL 0.9.7 des_old.c and des_old.h files were provided for BC.

In OpenSSL 0.9.8 crypt() function was renamed to _ossl_old_crypt and the
crypt macro definition was commented out in the des_old.h header.

In OpenSSL 1.1.0 the old DES API was removed, meaning OpenSSL's crypto
library no longer provides crypt() function as it used to.

References:
- Some further historic notes on this:
  https://www.openldap.org/faq/data/cache/1041.html
- OpenSSL Git commit history and changelogs
2024-07-08 20:24:28 +02:00
Calvin Buckley
3618382d07
Handle BSD checksum and file utilities (#14690)
* Handle BSD checksum utilities

The BSDs have different checksum utilities than GNU systems do. If we
don't see the GNU checksum utilities installed, use the BSD ones, as
their output is compatible enough.

Addresses part of GH-14688.

* Prefer GNU touch

BSD touch at least in macOS does not handle local timezone in the
timestamp (like 2024-06-27T10:26:23-03:00). As such, try GNU touch (as
ports systems almost always prefix with g if coreutils is installed) and
prefer that if available. It's not the end of the world though if GNU
touch isn't available, as BSD touch on some systems may support it, and
if it doesn't, then it's just timestamps, nothing too serious.
2024-07-08 13:27:47 -03:00
David Carlier
23a55babb4
ext/gd: checking imagescale/imagefilter invalid values.
close GH-14598
2024-07-08 16:59:40 +01:00
Niels Dossche
8825235348
Reapply "Stop using reserved names in dom"
This reverts commit dda96768ec.
2024-07-08 17:27:39 +02:00
Peter Kokot
7fda12218a
Autotools: Move Apache warning to SAPI's config.m4 (#14872)
This uses AC_CONFIG_COMMANDS macro to conditionally output the warning
message at the end of configure phase if non-threaded Apache
installation has been found and PHP is built without --enable-zts.

Variables set in the 2nd argument (init-cmds) are for the command
invocation scope as the first argument doesn't have any knowledge of
configure variables as described in the Autoconf docs.

This is moved as it is related only to apache2handler SAPI and also
now warning is displayed a bit nicer at the end of the configure phase
after files are generated. This also enables outputting warning when
using config.status script.
2024-07-08 17:17:33 +02:00
Peter Kokot
1f847a0bdf
Check Apache HTTP Server command-line utility (#14173)
The Apache HTTP server command-line tool (/usr/sbin/apache2) might be
part of a separate package, such as apache2-bin or similar. If not
installed, the configure script can still find the apxs tool, but
previously didn't check for the HTTP server tool separately. Otherwise,
configure syntax errors (integer expression expected) are thrown when
checking for the Apache version.
2024-07-08 17:15:09 +02:00
Peter Kokot
05b9345b08
Autotools: Remove unused DEBUG_CFLAGS variable (#12659)
This removes the unused DEBUG_CFLAGS variable from configure.ac. It has
been once set in the build files similarly to Zend.m4 but was then
removed and simplified.

CS synced and DEBUG_CFLAGS checked and appended with AS_VAR_* macros.
2024-07-08 17:05:57 +02:00
Niels Dossche
33289dfa5c
Revert "Remove unnecessary include statements from dom"
This reverts commit dd795022fa.
2024-07-08 16:26:50 +02:00
Niels Dossche
dda96768ec
Revert "Stop using reserved names in dom"
This reverts commit 013bc53f0c.

This somehow breaks the Windows build. Will investigate later.
2024-07-08 16:07:32 +02:00
Niels Dossche
ff770d023a
Throw an exception when using the namespace axis in XPath in modern DOM (#14871)
This was specified in https://wiki.php.net/rfc/dom_additions_84, under
the "NamespaceInfo" section, but was not implemented yet.
2024-07-08 15:15:38 +02:00
Niels Dossche
013bc53f0c Stop using reserved names in dom 2024-07-08 06:09:04 -07:00
Niels Dossche
c98a7c1195 Add parenthesis to macro arguments in dom_properties.h 2024-07-08 06:09:04 -07:00
Niels Dossche
ae0ba1a5c6 Add parenthesis to macro arguments in internal_helpers.h 2024-07-08 06:09:04 -07:00
Niels Dossche
3303c15754 Make some pointers const in php_dom.h 2024-07-08 06:09:04 -07:00
Niels Dossche
dd795022fa Remove unnecessary include statements from dom 2024-07-08 06:09:04 -07:00
Niels Dossche
c695b1dc88
Improve error message for too long file in ext/tidy (#14870)
As suggested in https://github.com/php/php-src/pull/14862#discussion_r1667788025
2024-07-08 15:06:57 +02:00
Peter Kokot
2f97ad9c10
[skip ci] Add link to FPM docs in FPM man page (#14853)
This removes obsolete link to php-fpm.org and redundant manual link in
favor of a dedicated FPM chapters.

Can be tested with:

    man sapi/fpm/php-fpm.8.in
2024-07-08 14:59:45 +02:00
Peter Kokot
083493be57
Fix AS_VAR_* checks (#14868)
AS_VAR_SET_IF doesn't behave the same as "test -n" and/or "test -z",
which becomes an issue for Apache's ZTS automatic enabling and CFLAGS
edge case where it would be explicitly set to empty value. It is safer
to use AS_VAR_IF instead of AS_VAR_SET_IF in these cases.
2024-07-08 14:20:58 +02:00
Niels Dossche
0b3c506b18
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix memory leak in tidy_repair_file()
2024-07-08 13:31:25 +02:00
Peter Kokot
300d092449
Autotools: Refactor phpdbg POSIX Threads checks (#14865)
- AS_VAR_IF, AS_VAR_APPEND used and CS synced
- Added one missing AC_MSG_RESULT to properly put the configure output
  log on each line
- AH_TEMPLATE used for HAVE_USERFAULTFD_WRITEFAULT to have help text on
  lesser places
- Redundant terminating semicolons removed
- Redundant PTHREADS_CHECK call removed as it is already done in
  configure.ac and before including SAPI M4 stubs
- Redundant CFLAGS and LIBS storing and restoring removed
2024-07-08 13:26:53 +02:00
Peter Kokot
3d8bd8fe4f
Remove unused HAVE_PHPDBG (#14864)
This is not defined on Windows and isn't used. Also phpdbg doesn't
install any headers to the public usage.
2024-07-08 00:42:05 +02:00
Peter Kokot
1bdf9aa38d
Remove support for EOL Apache 2.0 and 2.2 in favor of 2.4+ (#14664)
Apache 2.2 has been marked as EOL in December 2017 and doesn't receive
security patches any longer. Also, most *nix distributions and packages
mostly support 2.4 as minimum by now.

On Windows, this removes the configure option --enable-apache2-2handler
and merges the --enable-apache2handler and --enable-apache2-4handler
into a single option with favoring the --enable-apache2handler.

- The upstream MODULE_MAGIC_NUMBER is deprecated in favor of
  MODULE_MAGIC_NUMBER_MAJOR in apache2/ap_mmn.h
- The initial upstream MODULE_MAGIC_NUMBER_MAJOR was 20111025 in Apache
  2.4.0
- The upstream APLOG_USE_MODULE is always available since Apache 2.3.6
- The upstream CORE_PRIVATE is unnecessary and ignored since Apache
  2.4.0

See:
https://forum.apachehaus.com/news-general-discussion/apache-2-2-users-your-time-is-running-out/

Discussion: https://news-web.php.net/php.internals/124067
2024-07-08 00:07:55 +02:00
Peter Kokot
80e0c0aaf4
Autotools: Refactor dmalloc check (#14726)
- AS_VAR_APPEND used for enabling Dmalloc check-funcs token
- CS synced
2024-07-07 23:35:50 +02:00
Peter Kokot
e9254494ff
Autotools: Simplify POSIX Threads check (#14855)
The PTHREADS_CHECK is using cache variables so it is run only once early
during the configuration phase, before including SAPI and other M4
files. This removes the TSRM_CHECK_PTHREADS macro and moves the POSIX
Threads check after the PHP_THREAD_SAFETY variable is set in
configure.ac.

The check and error throw in PHP_BUILD_THREAD_SAFE is also joing into
this single check.

This removes the redundant tsrm.m4 file and PHP_CONFIGURE_PART call for
TSRM as it doesn't run any configuration checks anymore.
2024-07-07 22:44:44 +02:00
Peter Kokot
9def76ebbc
Autotools: Refactor crypt check in ext/standard (#14856)
- AH_TEMPLATE sets the CPP macro help text on a single place
- AC_DEFINE can be used instead of AC_DEFINE_UNQUOTED
- AS_VAR_IF used and CS synced
- crypt() function is at this point required as all required algorithm
  checks are depending on it and error is thrown if not found when using
  external crypt library
2024-07-07 21:46:44 +02:00
Peter Kokot
2acd4c2bbc
Autotools: Sync HAVE_ERASE_EMPTY_LINE help text (#14857)
HAVE_ERASE_EMPTY_LINE always gets the last AC_DEFINE help text, so it is
simpler to have the same help message for both definitions (readline and
editline). First text never got into header via autoheader anyway.
2024-07-07 21:31:31 +02:00
David CARLIER
1db75d42bb
ext/sockets: socket_get_option/socket_set_option SO_LINGER_SEC. (#14858)
9672cd9469 follow-up.
2024-07-07 14:23:01 +01:00
Niels Dossche
23391f1fe7
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-14550: No warning message when Zend DTrace is enabled that opcache.jit is implictly disabled
2024-07-07 13:18:42 +02:00
David Carlier
58b34fbfcc
[ci skip] UPGRADING fix for pcntl_waitid constants 2024-07-07 11:06:59 +01:00
Vladimir Vrzić
c2fd071db7
ext/pcntl: Added new function pcntl_waitid
to obtain status information pertaining termination, stop, and/or
continue events in one the caller's child processes.

close GH-14617
2024-07-07 11:04:14 +01:00
Peter Kokot
af29403ea0
Enable erase_empty_line in ext/readline (#14526)
This wasn't activated due to inconsistent availability over the
editline/readline versions and variants. This now checks whether the
rl_erase_empty_line variable is available in library headers and enables
it based on that. On Windows this is for now still disabled due to
wineditline library, which doesn't have this yet.

Documentation already mentions the erase_empty_line setting:
https://www.php.net/manual/en/function.readline-info.php
2024-07-07 04:36:25 +02:00
Peter Kokot
2ebef11e83
Update http links to https and sync www.php.net URLs (#14854) 2024-07-07 04:23:08 +02:00
Peter Kokot
42530c6543
Remove unused SMART_STR_PREALLOC (#14848) 2024-07-07 01:04:53 +02:00
Niels Dossche
f4af8f3837
Fix libxml test compatibility in xsl 2024-07-07 00:22:41 +02:00
Niels Dossche
477c2afb48 Fix typo in simplexml.c 2024-07-06 14:58:50 -07:00
Niels Dossche
acda7ed5c3 Stop using reserved names in simplexml 2024-07-06 14:58:50 -07:00
Niels Dossche
c6d0181c75 Fix narrowing warning 2024-07-06 14:58:42 -07:00
Niels Dossche
f16590637c Stop using reserved name in php_xsl.h 2024-07-06 14:58:42 -07:00
Niels Dossche
ac4ed1cca6 Remove unused argument 2024-07-06 14:58:42 -07:00
Niels Dossche
0a1f1dd191 Place macro argument in parentheses 2024-07-06 14:58:42 -07:00
Niels Dossche
e2189beaca
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-14639: Member access within null pointer in ext/spl/spl_observer.c
2024-07-06 23:58:37 +02:00
Niels Dossche
776939c3db Avoid function pointer cast to preserve ability to do CFI 2024-07-06 13:49:45 -07:00
Niels Dossche
ff3e7679b1 Avoid pointless cast to prevent implementation-defined conversion warning 2024-07-06 13:49:45 -07:00
Niels Dossche
292e936ca8 Handle invalid values better in PHP_XML_OPTION_SKIP_TAGSTART 2024-07-06 13:49:45 -07:00
Niels Dossche
19358d638b Stop using reserved names 2024-07-06 13:49:45 -07:00
Niels Dossche
335d6f023f Fix grammar mistake in comment in xml.c 2024-07-06 13:49:45 -07:00
Niels Dossche
be2d9fd80e Remove unused include from xml.c 2024-07-06 13:49:45 -07:00
Niels Dossche
ec1998987b Remove pointless const specifier on scalar argument 2024-07-06 13:49:45 -07:00
Niels Dossche
2ab24b0a94 Remove unused arguments from _external_entity_ref_handler() 2024-07-06 13:49:45 -07:00
Jorg Adam Sowa
8e1561cdbe
Check session_create_id() input for null byte (#14728) 2024-07-06 21:18:35 +01:00
David Carlier
c14fa48526
Merge branch 'PHP-8.3' 2024-07-06 20:44:47 +01:00
Niels Dossche
b41e90c6f9
Fix bug #81481 (xml_get_current_byte_index limited to 32-bit numbers on 64-bit builds) (#14845)
The return value is long in both expat and expat2 (with XML_LARGE_SIZE
not set).
2024-07-06 18:34:17 +02:00
Arnaud Le Blanc
ec19abf161
[ci skip] NEWS for GH-14801 2024-07-06 17:59:55 +02:00
Niels Dossche
f0441e05b8
Add LIBXML_NO_XXE constant (#14844)
This constant is available as of libxml2 2.13, and is used together with
LIBXML_NOENT to allow entity subsitution but disallow external entities.
2024-07-06 17:43:46 +02:00
Andy Postnikov
1f64e7c253
Fix build for armv7 (#14801) 2024-07-06 15:21:45 +02:00
Niels Dossche
b418d19c42
[ci skip] Make test more robust 2024-07-06 14:46:07 +02:00
Niels Dossche
fff206ba1e
Merge branch 'PHP-8.3'
* PHP-8.3:
  [ci skip] Test is for libxml only
2024-07-06 14:42:05 +02:00
Niels Dossche
f98aa06c68
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-14834: Error installing PHP when --with-pear is used
2024-07-06 13:52:42 +02:00
Niels Dossche
b4384488bc
Merge branch 'PHP-8.3'
* PHP-8.3:
  NEWS for compatibility in XML
  Stop setting parse options directly
  Stop relying on lastError directly
  Stop relying on the sax2 flag directly
  Port XML_GetCurrentByteIndex to public APIs
2024-07-06 13:50:32 +02:00
Niels Dossche
8c8322f6a1
ext/xml: Use zend_hash_find_ptr_lc() to avoid allocation in some cases (#14840) 2024-07-06 13:44:10 +02:00
Peter Kokot
17ef4b7ced
Autotools: Sync CS in phpize and configure.ac (#14838)
- This syncs Autoconf syntax with AS_VAR_* macros in phpize and
  configure.ac
- The cross-compiling check synced with configure.ac (the check message
  printed after program check message)
- Some redundant quoting removed
2024-07-06 13:35:14 +02:00
Niels Dossche
e4904a2199
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix test conflict between gzfile_basic.phpt and gzfile_basic2.phpt
2024-07-06 01:59:46 +02:00
Arnaud Le Blanc
2269c06042
Fix stack limit under valgrind (#14818)
Valgrind creates a stack mapping that can grow up to RLIMIT_STACK, but the last
page is never useable
2024-07-05 17:09:45 +02:00
Peter Kokot
83cd1c241e
Autotools: Refactor mach_vm_read check in FPM (#14830)
- Check wrapped in AC_CACHE_CHECK
- Synced CS
2024-07-05 15:19:14 +02:00
Peter Kokot
d7ddf83dde
Autotools: Refactor AVX-512 checks (#14831)
* Autotools: Refactor AVX-512 checks

- CS synced
- checks wrapped in AC_CACHE_CHECK
- CPP macros PHP_HAVE_AVX512_SUPPORTS and PHP_HAVE_AVX512_VBMI_SUPPORTS
  are now either defined to 1 or undefined to avoid manual defining on
  Windows (previously they should be either 0 or 1)

* [skip ci] Add basic macros help texts
2024-07-05 15:18:26 +02:00
Peter Kokot
fbc329733c
Autotools: Move crypt_r check (#14832)
The crypt_r() function is required and check can error out separately.
2024-07-05 13:14:48 +02:00
Peter Kokot
955c2e60eb
Autotools: Add ZEND_ENABLE_STATIC_TSRMLS_CACHE to skeleton (#14827)
This enables "Thread Safety Resource Manager Local Storage" static
cache for skeleton template for Autotools build.
2024-07-05 12:52:49 +02:00
Peter Kokot
27879fb5d5
Fix GH-14798: Valgrind and address sanitizer are not compatible (#14826)
When configuring PHP with:

    ./configure --with-valgrind and --enable-address-sanitizer

configuration now errors now since these two are not compatible
configurations.
2024-07-05 12:03:21 +02:00
Christoph M. Becker
ffab987fb1
Update MSVC compiler version detection (#14810)
As of Visual Studio 2015, the major version of the compiler (`cl.exe`)
is 19, and the minor version increases by steps of 10.  However, the
latest Visual Studio 2022 release has the version `19.40`, so that
Visual Studio version is not properly detected.  This is not a big deal
regarding the reported compiler version (`php -v` etc.), but the
filenames of the builds would no longer match the expectations (instead
of `vs17` there is now `19.40.33811` or another build number).  This
implies that the files would have to be renamed manually to be properly
handled by windows.php.net (or that code would have to be adapted).

Therefore we update the version detection to detect all versions < 1950
as Visual Studio 2022, assuming that "For major releases, the minor
version increases by 10."[1] still holds in the future.

[1] <https://learn.microsoft.com/en-us/cpp/overview/compiler-versions?view=msvc-170#visual-studio-2017-and-later>
2024-07-05 11:25:32 +02:00
Peter Kokot
ae420538d2
Autotools: Refactor PHP_BROKEN_GCC_STRLEN_OPT (#14824)
- Synced CS
- Cache variable ac_cv_have_broken_gcc_strlen_opt renamed to
  php_cv_have_broken_gcc_strlen_opt
2024-07-05 10:37:49 +02:00
Peter Kokot
dccc911c04
Autotools: Refactor PHP_TIME_R_TYPE check (#14823)
- Synced CS
- Cache variable ac_cv_time_r_type renamed to php_cv_time_r_type
2024-07-05 10:37:28 +02:00
Peter Kokot
cc7cfcef08
Autotools: Refactor PHP_FPM_BUILTIN_ATOMIC (#14825)
- Check wrapped in AC_CACHE_CHECK
- Synced CS
- Since this can be also compiler agnostic check, "gcc" text replaced
  with "compiler"
2024-07-05 09:42:44 +02:00
Peter Kokot
17a53470d7
Autotools: Refactor PHP_FPM_LQ checks (#14828)
- CS synced
- checks wrapped in AC_CACHE_CHECH
- HAVE_LQ_SO_LISTENQ defined unconditionally for simplifications
2024-07-05 09:41:50 +02:00
Arnaud Le Blanc
a62eda3f88
Fix stack limit on MSAN (#14829) 2024-07-05 01:52:42 +02:00
Peter Kokot
1a380989ee
Remove HAVE_STRPTIME_DECL_FAILS (#14821)
The strptime, where available, needs the _GNU_SOURCE defined or compiler
flag -std=gnuXX appended to be declared in time.h. PHP's strptime is
also deprecated as of PHP 8.1.

This removes the HAVE_STRPTIME_DECL_FAILS in favor of a simpler
AC_CHECK_DECL check and HAVE_DECL_STRPTIME CPP macro.
2024-07-04 20:26:14 +02:00
Peter Kokot
94dc2d2bf3
Autotools: Refactor crypt_r style check (#14820)
- Over-quoted arguments reduced
- AS_VAR_IF and CS synced
- CPP macro help texts updated
2024-07-04 20:18:39 +02:00
Peter Kokot
acac365d95
Autotools: Refactor PHP_TEST_WRITE_STDOUT check (#14819)
- AS_VAR_IF, AS_CASE used, CS synced
- Over-quoted argument reduced
- Cache variable ac_cv_write_stdout renamed to php_cv_have_write_stdout
- CPP macro help text updated
2024-07-04 19:32:31 +02:00
Niels Dossche
c69dedabb2
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-14553: Bug in phpdbg8.3 (also 8.1 and 8.2) echo output - trimmed at NULL byte (?)
2024-07-04 18:44:29 +02:00
Niels Dossche
bcfdf10686
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-13688: Test curl_basic_008 can fail (#13693)
2024-07-04 18:09:16 +02:00
Christoph M. Becker
de354683a0
Make bug49278.phpt more resilient
Due to the hard-coded PHP version, that test easily fails[1], so we
relax the test expectations.

[1] e.g. <2701689469 (step):5:66>

Closes GH-14817.
2024-07-04 16:03:15 +02:00
Niels Dossche
0fb12385fb
Merge branch 'PHP-8.3'
* PHP-8.3:
  NEWS for GH-14814
  ext/standard/tests: strings/wordwrap_memory_limit_32bit.phpt has two outputs
  ext/standard/tests: 32bit wordwrap tests aren't just for Windows
2024-07-04 15:56:48 +02:00
Niels Dossche
279d82bb07
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-14808: Unexpected null pointer in Zend/zend_string.h with empty output buffer
2024-07-04 15:50:44 +02:00
Ilija Tovilo
00cbcb4b6b
Merge branch 'PHP-8.3'
* PHP-8.3:
  [skip ci] Fix exlusion of buggy Symfony test
2024-07-04 15:45:31 +02:00
Niels Dossche
f9844f0348
Merge branch 'PHP-8.3'
* PHP-8.3:
  [ci skip] NEWS
  Backport libxml2 2.13.2 fixes (#14816)
2024-07-04 15:41:15 +02:00
Ilija Tovilo
c6debd788f
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix syntax error in SWITCH VM
2024-07-04 15:07:34 +02:00
Peter Kokot
ad7d1a7be4
Fix GH-14792: Compilation failure on pdo_* extensions (#14797)
When building pdo_mysql, pdo_pgsql, or pdo_sqlite with phpize from
the downloaded PHP 8.4 archive, also pdo_sql_parser.h and
php_pdo_int.h need to be installed.
2024-07-04 14:58:25 +02:00
Peter Kokot
f2300376fc
Autotools: Refactor ext/standard strptime check (#14800)
- Cache variable renamed from ac_cv_strptime_decl_fails to
  php_cv_have_decl_strptime
- CS synced
2024-07-04 14:36:00 +02:00
Peter Kokot
c6ab4b31c0
Autotools: Refactor ext/standard cache variables (#14799)
- Cache variable renamed from ac_cv_flush_io to php_cv_have_flush_io
- CS synced
2024-07-04 14:34:54 +02:00
Niels Dossche
cf914f4184
Implement PHP-specific extensions to Dom (#14754)
See RFC: https://wiki.php.net/rfc/dom_additions_84
2024-07-04 13:50:19 +02:00
Niels Dossche
5b673e99fc
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix uninitialized (dummy) memory in php_strtr_array() (#14812)
2024-07-04 13:36:46 +02:00
Niels Dossche
87599717c9 Avoid pointless duplication in _end_element_handler 2024-07-04 02:21:59 -07:00
Niels Dossche
81cdb8caf2 Remove unused code from xml/compat.c 2024-07-04 02:21:59 -07:00
Peter Kokot
88e36a7d5d
Merge branch 'PHP-8.3'
* PHP-8.3:
  ext/standard/tests: use %d instead of bytes in an overflow message
2024-07-04 00:48:52 +02:00
Peter Kokot
d7cd155e8d
Autotools: Refactor cache variables in configure.ac and ext/ldap (#14784)
- Cache variables ac_cv_ renamed on few places to php_cv_
- Over-quoted arguments reduced
- AS_VAR_IF and CS synced
2024-07-03 21:57:51 +02:00
Peter Kokot
a86163a33c
Autotools: Refactor getaddrinfo check (#14783)
- AS_VAR_IF and AS_CASE used
- CS synced
- Over-quoted arguments reduced
- Cache variable ac_cv_func_getaddrinfo renamed to
  php_cv_func_getaddrinfo
2024-07-03 21:54:13 +02:00
Peter Kokot
a6b336aba6
Refactor HAVE_GETIFADDRS checks (#14787)
- AC_CACHE used with php_cv_func_getifaddrs cache variable
- Synced #if/ifdef/defined checks for HAVE_GETIFADDRS as it is either
  defined to 1 or undefined
2024-07-03 21:53:17 +02:00
David Carlier
0410bf4147
Merge branch 'PHP-8.3' 2024-07-03 18:57:54 +01:00
Niels Dossche
d80be78efd Stop relying on the deprecated xmlLastError global 2024-07-03 10:34:46 -07:00
Niels Dossche
ef80266d99 Fix double entity encoding in soap 2024-07-03 10:34:46 -07:00
Niels Dossche
173a4033a1 Fix tests for libxml2 2.13.2 2024-07-03 10:34:46 -07:00
Niels Dossche
85705eda71 Fix compilation on libxml2 2.13 2024-07-03 10:34:46 -07:00
Arnaud Le Blanc
0bd260218b
Fix stack limit on ASAN/MSAN (#14771)
Increase the reserved stack size in ASAN builds, as instrumentation use more stack.
Increase the max allowed stack size in some tests, and enable these tests under ASAN.
Use __builtin_frame_address(0), instead of some stack variable, when we need a stack address, as ASAN may store local variables outside of the real stack.
2024-07-03 19:23:34 +02:00
Arnaud Le Blanc
e63e1afd84
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix test race condition
2024-07-03 19:17:59 +02:00
Peter Kokot
ec277ce7fe
Autotools: Refactor IPv6 check (#14782)
- Configure option and check grouped together for readability
- Cache variable ac_cv_ipv6_support renamed to php_cv_have_ipv6
- AS_VAR_IF used and CS synced
- Over-quoted argument reduced
2024-07-03 14:51:50 +02:00
Peter Kokot
063213b1ae
Autotools: Refactor PCRE JIT checks (#14781)
- Check message moved to 2nd argument of PHP_ARG_WITH
- AH_TEMPLATE takes care of help message defined on one place for both
  defines
- AS_VAR_IF used and CS sycned a bit
- Cache variables renamed to php_cv_*
- Redundant AC_CANONICAL_HOST call removed. The host_cpu is set together
  with a triplet in PHP_CANONICAL_HOST_TARGET
- Over-quoted arguments reduced
2024-07-03 14:10:29 +02:00
Peter Kokot
dc7b67ebc3
Autotools: Sync PHP_ADD_MAKEFILE_FRAGMENT (#14766)
- Macro help text updated for extensions and general usage
- Arguments quoted
- dnl removes redundant newlines in the generated configure script
2024-07-03 13:15:13 +02:00
Go Kudo
1fa0db0f83 Merge remote-tracking branch 'upstream/PHP-8.3' 2024-07-03 14:57:20 +09:00
Niels Dossche
fc09f4b2bc
Implement Dom\TokenList (#13664)
Part of RFC: https://wiki.php.net/rfc/dom_additions_84

Closes GH-11688.
2024-07-02 21:34:23 +02:00
Niels Dossche
768900b180 Implement Dom $innerHTML property 2024-07-02 11:15:38 -07:00
Niels Dossche
162e71e165 Update Lexbor
Commit: f0539d137a
2024-07-02 11:15:38 -07:00
Niels Dossche
c3a5b98771
Add zend_hash_get_current_pos_ex() (#14770) 2024-07-02 19:11:41 +02:00
Eric Mann
b229f189ee
Update NEWS for PHP 8.4.0alpha1 2024-07-02 08:01:30 -07:00
Arnaud Le Blanc
c08fe2dfc4
[ci skip] NEWS/UPGRADING for GH-13460 2024-07-02 15:24:11 +02:00
Arnaud Le Blanc
3c56af9902
Allow fiber switching during destructor execution
Fiber switching was disabled during destructor execution due to conflicts
with the garbage collector. This unfortunately introduces a function color
problem: destructors can not call functions that may switch Fibers.

In this change we update the GC so that Fiber switching during GC is safe. In
turn we allow Fiber switching during destrutor execution.

The GC executes destructors in a dedicated Fiber. If a destructor suspends, the
Fiber is owned by userland and a new dedicated Fiber is created to execute the
remaining destructors. Destructor suspension results in a resurection of the
object, which is handled as usual: The object is not considered garbage anymore,
but may be collected in a later run.

When the GC is executed in the main context (not in a Fiber), then destructors
are executed in the main context as well because there is no risk of conflicting
with GC in this case (main context can not suspend).

Fixes GH-11389
Closes GH-13460
2024-07-02 15:00:40 +02:00
Arnaud Le Blanc
7c6ff87869
Expose fibers API 2024-07-02 15:00:40 +02:00
David CARLIER
6b037200a4
sapi/cli: setting process name little optimisation. (#14767) 2024-07-02 12:12:34 +01:00
Peter Kokot
7575905db8
Autotools: Refactor PEAR check (#14765)
- Synced CS: AS_VAR_IF style checks and M4 macro arguments quoted
- Error message normalized without checking other errors appended (once
  more dependencies were required and additional error messages were
  appended)
2024-07-02 12:38:09 +02:00
Peter Kokot
a071d1c9cf
Autotools: Refactor PS_STRINGS check in cli (#14763)
- over-quoted arguments reduced
- AS_VAR_IF used
- php_cv_var_PS_STRINGS cache variable name used instead of cli_cv_*
- Macro help text synced according to empty definition
2024-07-02 12:37:33 +02:00
Niels Dossche
fa5e29f7d0 Remove always-false if check
prop_info is NULL in this branch.
2024-07-02 02:51:18 -07:00
Niels Dossche
00691f4322 Remove always-true if check 2024-07-02 02:51:18 -07:00
Niels Dossche
00b36ce44a Remove always-false opcode check
opcode cannot be ZEND_POST_INC because of the if check above.
2024-07-02 02:51:18 -07:00
Niels Dossche
7407e760f1 Remove duplicated code
The exact same code already exists above this.
2024-07-02 02:51:18 -07:00
Niels Dossche
985e5ffdb0 Remove doubled variable name from assignment 2024-07-02 02:51:18 -07:00
Benjamin Eberlei
72c874691b
RFC: Add #[\Deprecated] Attribute (#11293)
see https://wiki.php.net/rfc/deprecated_attribute

Co-authored-by: Tim Düsterhus <tim@tideways-gmbh.com>
Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com>
2024-07-02 09:44:25 +02:00
Peter Kokot
8291e81c00
Remove unused ZEND_JIT_IR (#14760)
Symbol was added when PHP-8.3 JIT engine was used with the IR JIT and is
now unused and redundant.
2024-07-02 08:19:45 +02:00
Peter Kokot
5e27a2a994
Autotools: Simplify SAPI configure log check messages (#14764)
The PHP_ARG_ENABLE and PHP_ARG_WITH 2nd argument is the check message in
the configure log output.
2024-07-02 08:11:10 +02:00
Peter Kokot
2c20811942
Autotools: Remove unused PHPDBG_SHARED compile definition (#14762)
There was also redundant backslash escaping.
2024-07-02 07:13:01 +02:00
Peter Kokot
bee84c0468
Autotools: Quote PHP_SUBST arguments in extensions (#14748) 2024-07-02 06:56:18 +02:00
Peter Kokot
b9f8113a48
Autotools: Quote PHP_SUBST arguments in configure.ac (#14757) 2024-07-02 05:44:45 +02:00
Peter Kokot
7711bdcfba
Autotools: Quote PHP_SUBST arguments in php.m4 (#14758) 2024-07-02 05:44:02 +02:00
Peter Kokot
9674a421b7
Autotools: Move openpty check to libraries section (#14737)
This is just a sync and alignment with Autoconf documentation style
order of checks in configure.ac ("Standard configure.ac Layout"):
https://www.gnu.org/software/autoconf/manual/autoconf-2.72/autoconf.html#Autoconf-Input-Layout
2024-07-02 05:41:13 +02:00
Peter Kokot
2e756e0086
Remove unused PTHREADS CPP macro definition (#14759) 2024-07-02 05:40:18 +02:00
Peter Kokot
1f2948a966
Sync PHP_SUBST in phpize.m4 (#14756)
- Arguments quoted
- Duplicate redundant prefix variable substitution removed
2024-07-01 23:15:44 +01:00
David Carlier
66a06d6fa5
Merge branch 'PHP-8.3' 2024-07-01 22:38:05 +01:00
Peter Kokot
2b2f755a11
Merge branch 'PHP-8.3'
* PHP-8.3:
  Use pattern tags for NDBM ext/dba/tests (#14755)
2024-07-01 22:06:41 +02:00
Peter Kokot
e9a9a2bf81
Autotools: Sync PHP_SUBST in ext/odbc (#14749)
- Argument quoted
- ODBC_INCDIR and ODBC_LIBDIR are not used in the generated Makefile
2024-07-01 21:16:21 +02:00
Peter Kokot
dc1cc503db
Autotools: Sync PHP_SUBST in sapi (#14753)
- Arguments quoted
- Redundant comments removed (some basic help info is in the
  build/php.m4)
- APXS variable as such isn't used in the generated Makefile, the path
  to the apxs tool is inserted during the configure step directly
2024-07-01 21:04:09 +02:00
Peter Kokot
034621760d
Autotools: Sync PHP_SUBST in ext/gd (#14751)
- Argument quoted
- CFLAGS variable changed into normal shell variable
- GDLIB_CFLAGS and GDLIB_LIBS are not used in the generated Makefile
2024-07-01 20:57:43 +02:00
Niels Dossche
0c5d3db79b
Fix includes for separate builds for ext/dom (#14752)
* Update include declaration in Dom css selectors

May fix 88da914910 (r143708340)

* Remove pointless guards

* Fix Windows build

* Use relative path
2024-07-01 20:22:58 +02:00
Niels Dossche
1d905442e5
[ci skip] Add missing simplexml entry to dom test 2024-07-01 20:20:38 +02:00
David Carlier
1bcb57dcab
ext/sockets: socket_accept setting fcntl's FD_CLOEXEC on unixes.
mainly for scenarios when pcntl_fork/pcntl_exec are involved so when
the latter is executed, we avoid unwarranted effects with the file
descriptors, instead the socket will be closed on success.

close GH-14606
2024-07-01 18:50:59 +01:00
Peter Kokot
72326362d7
Sync PHP_SUBST_OLD (#14746)
- All arguments quoted
- PHP_VERSION, PHP_VERSION_ID, PHP_LDFLAGS are used only in templates
  with @...@ placeholders
- These are not used in generated Makefile neither in templates:
  abs_builddir, abs_srcdir, DEBUG_CFLAGS
- These are used only in generated Makefile: EXTRA_LDFLAGS,
  EXTRA_LDFLAGS_PROGRAM, ZEND_EXTRA_LIBS, INCLUDES, EXTRA_INCLUDES,
  INSTALL_IT, NATIVE_RPATHS
2024-07-01 19:28:20 +02:00
tekimen
042ae1559e
[ci skip] Revert2: Add Hamada-san to CODEOWNERS for mbstring (#14744)
This reverts commit 1b47fd026a.
I (@youkidearitai) join to CODEOWNERS for mbstring.
2024-07-01 07:50:07 -07:00
Peter Kokot
ebad61de2d
Autotools: Quote AC_SUBST arguments (#14743) 2024-07-01 14:07:26 +02:00
Peter Kokot
bf139e9b1f
Remove unused defined CPP macros in fpm SAPI (#14740)
* Remove unused defined CPP macros in fpm SAPI

- PHP_FPM_SYSTEMD
- PHP_FPM_USER
- PHP_FPM_GROUP

* [skip ci] Update UPGRADING.INTERNALS
2024-07-01 14:06:45 +02:00
Peter Kokot
9caad3745d
Autotools: Refactor Valgrind support (#14736)
When Valgrind is enabled and not found on the system, default error can
be thrown by PKG_CHECK_MODULES instead of writing a manual error step.
- This uses less redundant variables and has synced CS.
- AS_VAR_IF used instead of raw shell ifs
- Added some basic help descriptions for macro definitions
2024-07-01 00:29:44 +02:00
Niels Dossche
445c1c920b
Update Lexbor (#14735)
Until commit aaa722f9a44a486f361e4266ff322afcf7d6421a
This pulls in some upstream fixes, including some of mine.
2024-06-30 20:01:27 +02:00
Niels Dossche
c97885b3cc
Merge branch 'PHP-8.3'
* PHP-8.3:
  Factor out common check for short-circuited ast
  Fix OSS-Fuzz #69765: Yield reference to nullsafe chain
2024-06-30 13:38:58 +02:00
Peter Kokot
212b2834e9
Autotools: Sync indentation style in build system files (#14725) 2024-06-29 23:25:17 +02:00
Niels Dossche
4df90af44f
Update Lexbor (#14729) 2024-06-29 22:42:56 +02:00
Kamil Tekiela
62a3bbd0e3
Remove MYSQLI_SET_CHARSET_DIR (#14724) 2024-06-29 22:21:03 +02:00
Niels Dossche
88da914910 Implement CSS selectors 2024-06-29 13:00:26 -07:00
Niels Dossche
7defc23532 Import Lexbor CSS component and update the patches for it 2024-06-29 13:00:26 -07:00
Alex Dowad
1b47fd026a Revert "[ci skip] Add Hamada-san to CODEOWNERS for mbstring"
This reverts commit 0bcc1e613b.

It turns out that GitHub expects all users listed in CODEOWNERS to have
write access to the repository, and @youkidearitai does not currently
have such access. I was not aware of this earlier, and still hope that
he can be added back later, since he is very helpful when it comes
to reviewing GitHub issues and pull requests.
2024-06-29 20:59:03 +02:00
Peter Kokot
a5b7850d6c
Wrap Zend max execution timers check in M4 macro (#14696)
- PHP_CHECK_FUNC -> AC_SEARCH_LIBS
- Redundant symbols HAVE_LIBRT and HAVE_TIMER_CREATE removed
- The rt library for some older systems (Solaris <= 10, older Linux)
  appended as needed
- This uses AC_ and AS_* macros and relies more on Autoconf shell
  code handling
- Help texts updated and synced
2024-06-29 19:52:56 +02:00
Peter Kokot
b1c34a9163
Normalize AC_CHECK_HEADER* arguments (#14723)
The m4_normalize is for Autoconf < 2.70 (on 2.70 and later versions a
blank-or-newline separated items can be expanded without using
backslash-newline). The order of headers in configure.ac is left as is
because the first few headers depend on checking other headers (for
those includes the 4th argument).
2024-06-29 19:49:12 +02:00
Peter Kokot
52ed06dc7d
Autotools: Move HAVE_DTRACE and PHP_DTRACE_OBJS to PHP_INIT_DTRACE (#14722)
The sys/sdt.h is required header when using DTrace, HAVE_DTRACE can be
defined together when initializing and PHP_DTRACE_OBJS can be
substituted to simplify the macro usage a bit further.
2024-06-29 19:12:08 +02:00
Peter Kokot
c44834d8ad
Trim trailing whitespace (#14721) 2024-06-29 18:41:45 +02:00
Alex Dowad
0bcc1e613b [ci skip] Add Hamada-san to CODEOWNERS for mbstring
For the last couple years, Hamada-san has provided helpful feedback
on many GitHub issues and pull requests related to mbstring. He is in
a good position to help with reviewing future pull requests.

He agreed (via private mail) that it is fine to add his GitHub account
to CODEOWNERS.
2024-06-29 18:22:57 +02:00
Niels Dossche
4cab7f90a1 [RFC] Implement XMLReader::fromUri() and XMLReader::fromString() 2024-06-29 09:04:35 -07:00
Niels Dossche
c24b8fe616 [RFC] Implement XMLWriter::toUri() and XMLWriter::toMemory() 2024-06-29 09:04:35 -07:00
Niels Dossche
acf2762857 [RFC] Add stream open functions to XML{Reader,Writer}
RFC: https://wiki.php.net/rfc/xmlreader_writer_streams
2024-06-29 09:04:35 -07:00
Peter Kokot
ca3b2482cc
Refactor ZEND_MM alignment check (#14720)
- Check added into a separate M4 macro
- AC_CACHE_CHECK used for running the test program with cache variable
  for optional edge-case overrides
- Help texts updated
- If check fails for some reason, the configure step emits error as
  also done in the Zend C code
- Cross-compilation values updated with type casts as done in the
  current conftest file output
2024-06-29 18:02:17 +02:00
Alex Dowad
bec2532584 Update dates of my mbstring maintainership in EXTENSIONS 2024-06-29 17:28:36 +02:00
Ayesh Karunaratne
421ac9ac28 ext/mbstring: update to Unicode 15
Updates UCD to Unicode 15.1 (released 2023 Sept). The upcoming
Unicode 16 version will be released roughly on 2024 Sept.

Previously: 0fdffc18, #7502

UCD 15.1 `DerivedNormalizationProps` contains multiple properties in
the same line, which breaks the parser. This also updates the
`ucgendat.php` script to allow 2 or three fields in each line, and to
look for the `Cased` and `Case_Ignorable` properties in either of the
fields to mimic the previous behavior.
2024-06-29 17:24:52 +02:00
Ayesh Karunaratne
23f99f08c9 ext/mbstring: update UCD parser to accept characters with multiple properties 2024-06-29 17:24:52 +02:00
Niels Dossche
998997b6a1
Remove nonsensical dom_node_children_valid() checks from parentnode.c (#14706)
Either these are for ParentNode, which are always valid parents that can
hold children. Or these are for ChildNode, which always has a parent
that can have children (by definition).
2024-06-29 16:55:18 +02:00
David Carlier
58a6e5551e
Merge branch 'PHP-8.3' 2024-06-29 15:52:52 +01:00
Niels Dossche
c66221b7ba
Fix arginfo violation in removeChild() (#14717)
It was possible to return false without throwing an exception.
This is even wrong in "old DOM" because we expect either a NOT_FOUND_ERR
or NO_MODIFICATION_ALLOWED_ERR according to the documentation.
A side effect of this patch is that it prioritises NOT_FOUND_ERR over
NO_MODIFICATION_ALLOWED_ERR but I think that's fine.
2024-06-29 16:32:36 +02:00
Niels Dossche
de8b13fde2
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-14563: Build failure with libxml2 v2.13.0
2024-06-29 16:28:57 +02:00
Niels Dossche
4a9ff0f004
Add myself to ext-dom credits (#14718)
Suggested here [1] as well.

[1] https://github.com/php/php-src/pull/13819#pullrequestreview-2146095841
2024-06-29 15:18:34 +01:00
Peter Kokot
7f8e8a08d2
Use AC_CACHE_CHECK for float precision checks (#14663)
- AC_CACHE_CHECK simplifies message checkings and can speed up the
  consequtive configure -C checks
- AC_DEFINE descriptions style synced
- Used php_cv_* cache variables style
- Reduced over-quoted arguments to AC_LANG_PROGRAM
- Sync macro help text
2024-06-28 23:23:06 +02:00
Peter Kokot
bf7be07e7d
Refactor Zend signal handling check (#14678)
This wraps the Zend signal handling check in its own M4 macro for
readability and uses AS_VAR_IF, AS_VAR_APPEND for CFLAGS variable,
updates help texts and fixes CS.
2024-06-28 23:19:58 +02:00
Peter Kokot
1a5c411dc6
Wrap stack direction check in Zend M4 macro (#14694) 2024-06-28 23:07:40 +02:00
Peter Kokot
01b3c05007
Include Zend.m4 with m4_include (#14693)
Zend.m4 is now a collection of only macro definitions.
2024-06-28 22:50:22 +02:00
Peter Kokot
19a9d85d6b
Rely on Autoconf's automatic removal of conftest* files (#14697)
When test programs are finished or when configure script is interrupted,
Autoconf cleans up all conftest* files.
2024-06-28 22:40:38 +02:00
Peter Kokot
2041c133ac
Normalize AC_CHECK_FUNC* first argument (#14700)
The m4_normalize is for Autoconf < 2.70 (on 2.70 and later versions a
blank-or-newline separated items can be expanded without using
backslash-newline).

This also syncs the 1st argument quotes.
2024-06-28 22:40:24 +02:00
Niels Dossche
bcdba83cbb
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-14702: DOMDocument::xinclude() crash
2024-06-28 22:29:03 +02:00
Niels Dossche
2fc27b7d2a
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-14590: Memory leak in FPM test gh13563-conf-bool-env.phpt
2024-06-28 22:10:23 +02:00
David Carlier
532a2604c2
Fix GH-14698: segfault on dom node after dereference.
close GH-14701
2024-06-28 20:52:48 +01:00
Niels Dossche
03dab7ec3d
Merge branch 'PHP-8.3'
* PHP-8.3:
  [ci skip] Move incorrectly placed NEWS items to the right place
2024-06-28 20:16:51 +02:00
Niels Dossche
d883996326
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-14537: shmop Windows 11 crashes the process
2024-06-28 20:14:26 +02:00
Niels Dossche
59e639b5d4
Follow-up on GH-13516: include config.h from build dir for new files in ext-dom (#14705)
GH-13516 was created before the new DOM files were added, and the PR was
never rebased to include the new DOM files, so there are three places
which were not replaced.
2024-06-28 18:29:22 +02:00
Máté Kocsis
a2cecd2a6f
Remove ZEND_STATIC_ASSERT() calls from legacy arginfo files
After report in 5992a29724 (r143540472)
2024-06-27 21:52:27 +02:00
Peter Kokot
c705dd8884
Wrap FPM checks in AC_CACHE_CHECK and fix CS (#14681)
- This simplifies over-quoted arguments to AC_COMPILE_IFELSE
- Indentation and other CS fixes
- php_cv_* cache variables
- AC_DEFINE help texts syncs to make it more clear
- Fix -Wunused-but-set-variable warnings
2024-06-27 21:30:35 +02:00
Peter Kokot
fd28bb0f51
Normalize ext/standard sources (#14677)
Follow-up of GH-14654
2024-06-27 20:45:09 +02:00
Peter Kokot
11f4683ee5
Wrap __cpuid_count check into ZEND_CHECK_CPUID_COUNT M4 macro (#14692)
Instead of checking this when including the Zend.m4 file in configure.ac
check is executed with the ZEND_INIT macro.
2024-06-27 20:16:40 +02:00
Peter Kokot
c7c02f2abf
Wrap global register variables check in M4 macro (#14683)
This adds ZEND_CHECK_GLOBAL_REGISTER_VARIABLES M4 macro to properly
sort the --enable-gcc-global-regs in configure --help output, fixes
over-quoted arguments, syncs CS and updates help texts.
2024-06-27 20:08:03 +02:00
Tim Düsterhus
ac54d1c039
hash: Add simple HashContext::__debugInfo() implementation (#14644)
* hash: Add simply HashContext::__debugInfo() implementation

* NEWS/UPGRADING
2024-06-27 19:29:37 +02:00
Gina Peter Banyard
5b1b3ae673 ext/soap: Initialize a HashTable of size j
The i seems to be a mistake as everything else uses j
2024-06-27 17:41:23 +01:00
Gina Peter Banyard
ee75f344f8 ext/soap: Add const qualifiers for serialize functions
As serializing something should not affect the value of it
2024-06-27 17:41:23 +01:00
Gina Peter Banyard
ca2b131c6e ext/soap: mark string param of sdl_serialize_key() as const
Add const qualifiers to the variables at the call size
Rename variables when they were shadowing a variable from the outer scope
2024-06-27 17:41:23 +01:00
Gina Peter Banyard
325f8f0cfc ext/soap: Remove cast from macro
Move it to the one call site that requires it
2024-06-27 17:41:23 +01:00
Gina Peter Banyard
0e91b4f5e6 ext/soap: convert int type to size_t where appropriate 2024-06-27 17:41:23 +01:00
Gina Peter Banyard
902c8ceab0 ext/soap: Rename MD5 context variable to not shadow the stream context variable 2024-06-27 17:41:23 +01:00
Gina Peter Banyard
26143dae2d ext/soap: Remove unused 'cache' extension global 2024-06-27 17:41:23 +01:00
Peter Kokot
3d6bd16239
Sync missing hash and pcre dependencies for opcache on Windows (#14682)
- ext/hash is required only on Windows
- ext/pcre is required
2024-06-27 18:23:01 +02:00
David CARLIER
54e5e7b507
ext/pdo_pgsql: object initialisation, using smart_str api instead. (#14679) 2024-06-27 05:53:38 +01:00
Peter Kokot
604dafff3a
Rename and refactor Zend.m4 macros (#14671)
- LIBZEND_* -> ZEND_*
- A single "public" initialization M4 macro ZEND_INIT that wraps Zend
  engine related configure step checks and initialization.
2024-06-26 22:57:01 +02:00
Peter Kokot
807273e263
Normalize Zend sources (#14676)
Follow-up of GH-14654
2024-06-26 22:18:46 +02:00
Niels Dossche
1501da0bf9 NEWS and UPGRADING for new DOM features RFC 2024-06-26 12:17:12 -07:00
Niels Dossche
48c9f1e2c3 Implement Dom\HTMLElement class 2024-06-26 12:17:12 -07:00
Niels Dossche
78401ba867 Implement Dom\Document::$title setter 2024-06-26 12:17:12 -07:00
Niels Dossche
04af960397 Implement Dom\Document::$title getter 2024-06-26 12:17:12 -07:00
Niels Dossche
a12db3b656 Implement Dom\Document::$body setter 2024-06-26 12:17:12 -07:00
Niels Dossche
287cf91724 Implement Dom\Document::$head 2024-06-26 12:17:12 -07:00
Niels Dossche
a1485df55a Implement Dom\Document::$body getter 2024-06-26 12:17:12 -07:00
Niels Dossche
e7cc819bd9
Merge branch 'PHP-8.3'
* PHP-8.3:
  Add SKIPIFs for upstream regression in libxslt (#14674)
2024-06-26 19:36:08 +02:00
Niels Dossche
3760c9d001
Add SKIPIFs for upstream regression in libxslt (#14674)
See https://gitlab.gnome.org/GNOME/libxslt/-/issues/113
2024-06-26 19:31:21 +02:00
Peter Kokot
8946099b73
Rename AC_FPM_* M4 macros to PHP_FPM_* (#14670)
This syncs the FPM SAPI M4 macro names with the current naming
conventions prefixed with PHP_.
2024-06-26 15:39:52 +02:00
Derick Rethans
9b5c15ba98 Remove superfluous whitespace 2024-06-26 08:06:41 -05:00
Derick Rethans
df7d304b62 Emit opcode for frameless functions at line number where the function call starts 2024-06-26 08:06:41 -05:00
Arnaud Le Blanc
11accb5cdf
Preferably include from build dir (#13516)
* Include from build dir first

This fixes out of tree builds by ensuring that configure artifacts are included
from the build dir.

Before, out of tree builds would preferably include files from the src dir, as
the include path was defined as follows (ignoring includes from ext/ and sapi/) :

    -I$(top_builddir)/main
    -I$(top_srcdir)
    -I$(top_builddir)/TSRM
    -I$(top_builddir)/Zend
    -I$(top_srcdir)/main
    -I$(top_srcdir)/Zend
    -I$(top_srcdir)/TSRM
    -I$(top_builddir)/

As a result, an out of tree build would include configure artifacts such as
`main/php_config.h` from the src dir.

After this change, the include path is defined as follows:

    -I$(top_builddir)/main
    -I$(top_builddir)
    -I$(top_srcdir)/main
    -I$(top_srcdir)
    -I$(top_builddir)/TSRM
    -I$(top_builddir)/Zend
    -I$(top_srcdir)/Zend
    -I$(top_srcdir)/TSRM

* Fix extension include path for out of tree builds

* Include config.h with the brackets form

`#include "config.h"` searches in the directory containing the including-file
before any other include path. This can include the wrong config.h when building
out of tree and a config.h exists in the source tree.

Using `#include <config.h>` uses exclusively the include path, and gives
priority to the build dir.
2024-06-26 00:26:43 +02:00
Peter Kokot
604e0a7bbe
Fix negation in shell tests (#14662)
According to documentation the `if test ! ...` is preferred to
`if ! test ...`. The later is not portable:
https://www.gnu.org/software/autoconf/manual/autoconf-2.72/autoconf.html
2024-06-25 23:31:08 +02:00
David CARLIER
bc585cd87a
Fix GH-14643 ext/standard: segfault on user shutdown function release. (#14656) 2024-06-25 21:13:15 +01:00
Peter Kokot
4f450b6264
Bump minimum libpq version to 10.0 (#14628)
This bumps the libpq client-side PostgreSQL library minimum required
version from 9.1 to 10.0.

- Sanity check: PQlibVersion -> PQencryptPasswordConn (available since
  libpq 10.0)
- PQsetErrorContextVisibility (available since libpq 9.6)
- lo_truncate64 (available since libpq 9.3), if 32-bit system doesn't
  support lo_*64 functions, error is returned and functions are always
  available

Additionally, the conditional functions usages in pdo_pgsql and pgsql
extensions that got piled up are cleaned and synced:

- pg_prepare (PQprepare available since libpq 7.4)
- pg_query_params (PQexecParams available since libpq 7.4)
- pg_result_error_field (PQresultErrorField available since libpq 7.4)
- pg_send_prepare (PQsendPrepare available since libpq 7.4)
- pg_send_query_params (PQsendQueryParams available since libpq 7.4)
- pg_set_error_verbosity (PQsetErrorVerbosity available since libpq 7.4)
- pg_transaction_status (PQtransactionStatus available since libpq 7.4)

The Windows libpq version is currently at version 11.4:
https://github.com/winlibs/postgresql

Discussion: https://news-web.php.net/php.internals/123609
Follow-up of GH-14540
2024-06-25 20:50:04 +02:00
Peter Kokot
909d331d0a
Add _GNU_SOURCE definition unconditionally (#14651)
Since Autoconf >= 2.70 the _GNU_SOURCE and some other extensions are
defined unconditionally regardless whether the __EXTENSIONS__ can be
safely defined. Some obsolete Solaris systems once had issues with
compiling a default set of standard system headers when __EXTENSIONS__
was defined. Autoconf 2.69 and earlier checked based on that and defined
the _GNU_SOURCE conditionally. This condition is not relevant on current
systems anymore.
2024-06-25 20:07:42 +02:00
Peter Kokot
3cbf5aa63e
Normalize mysqlnd extension sources (#14654)
The m4_normalize() can simplify the list argument. It removes leading
and trailing spaces and tabs, sequences of backslash-then-newline, and
replaces multiple spaces, tabs, and newlines with a single space.
2024-06-25 19:33:51 +02:00
Peter Kokot
0775d68322
Fix configure log message when cross-compiling (#14658)
This puts the configure log into its own lines and makes it readable:

    checking for gcc... gcc
    checking for native build C compiler... gcc
2024-06-25 18:58:53 +02:00
Peter Kokot
5db847e313
Fix --enable-re2c-cgoto check (#11928)
When the computed goto extension is available to optimize conditional
jumps, option --enable-re2c-cgoto adds the -g flag to re2c.

In this case the AC_LANG_SOURCE is used instead of the AC_LANG_PROG to
not wrap the compilation check program in another main() function. Code
is also simplified and help messages updated. This is a
compiler-agnostic extension, not only available with GCC.

When the check is successful, the -g is added, otherwise not.
2024-06-25 16:10:10 +02:00
Arnaud Le Blanc
f7df238971
Merge branch 'PHP-8.3'
* PHP-8.3:
  [ci skip] NEWS for GH-14626
  [ci skip] NEWS for GH-14626
  Fix is_zend_ptr() for huge blocks (#14626)
2024-06-25 15:18:58 +02:00
Peter Kokot
df6d85acf8
Fix CS for fnmatch check (#14659)
This wraps the check when cross-compiling into AS_* macros and uses the
default description template provided the AC_FUNC_FNMATCH. In such case
the 3rd argument can be omitted. Also, newer Autoconf versions have
replaced backticks with single quotes in AC_DEFINE* macros descriptions.
2024-06-25 00:15:54 +02:00
David CARLIER
5c55306a50
Fix GH-14652: segfault on node without document. (#14653)
do not bother trying to clone the inner document if there is none to
begin with.
2024-06-24 22:31:53 +01:00
Peter Kokot
835cb69ab5
Normalize bcmath extension sources (#14655)
Follow-up of GH-14654
2024-06-24 22:51:51 +02:00
Peter Kokot
f3feef8b93
Define default RE2C_FLAGS (#14615)
The --no-generation-date flag is a common re2c flag used in all re2c
invocations. This adds the 2nd optional argument to PHP_PROG_RE2C M4
macro in BC manner to set the default re2c command-line options and sets
the default RE2C_FLAGS similarly on Windows.
2024-06-24 22:09:04 +02:00
Niels Dossche
e4250cec79 Introduce Dom\AdjacentPosition and use it in the insert adjacent methods
See https://wiki.php.net/rfc/dom_additions_84#allowing_php-specific_developer_experience_improvements
2024-06-24 12:36:35 -07:00
Niels Dossche
a068a9a5bb Make XMLDocument::xinclude() return values and error conditions sane
See https://wiki.php.net/rfc/dom_additions_84#api_amendments
2024-06-24 12:36:35 -07:00
Peter Kokot
5236551776
[skip ci] Remove obsolete guideline how to comment out code (#14621)
This can lead to undefined warnings when building with -Wundef and using
undefined FOO macro in #if condition. Also such code disabling should
not be encouraged exactly.
2024-06-24 20:37:42 +02:00
Arnaud Le Blanc
ff58a7f624
Merge branch 'PHP-8.3'
* PHP-8.3:
  [ci skip] NEWS for GH-13922
  [ci skip] NEWS for GH-13922
  Support sysconf(_SC_GETPW_R_SIZE_MAX) == -1 (#13922)
2024-06-24 19:57:28 +02:00
Peter Kokot
cf3b9fca8f
Sync #if/ifdef/defined (-Wundef) (#14623)
These are either define (to value 1) or undefined:
- __GNUC__
- DBA_CDB_BUILTIN
- DBA_GDBM
- HAVE_FORK
- HAVE_PUTENV
- HAVE_SETENV
- HAVE_SYS_SELECT_H
- HAVE_SYS_SOCKET_H
- HAVE_SYS_WAIT_H
- HAVE_UNSETENV
- RFC3678_API
- ZEND_ENABLE_ZVAL_LONG64
- ZTS

Follow-up of GH-5526
2024-06-24 19:37:07 +02:00
Arnaud Le Blanc
ab9a0295c5
[ci skip] NEWS for GH-14650 2024-06-24 16:53:11 +02:00
Julien Voisin
e3c9f5a585
Compute the size of pages before allocating memory (#14650)
`start_memory_manager()` calls `zend_mm_init()` via `alloc_globals_ctor()`
before setting `REAL_PAGE_SIZE` to the right value. Moving the `REAL_PAGE_SIZE`
setting block before the call to `alloc_globals_ctor()` makes the allocator
behave properly on systems with a page size different than 4k.

Suggested-by: arnaud-lb
2024-06-24 16:51:18 +02:00
Peter Kokot
3da6377806
Remove DBA_DB1 definition from Windows build (#14649)
The DBA_DB1 is checked with #ifdef and version 1 emulation is present in
DB version 3.
2024-06-24 16:50:22 +02:00
Peter Kokot
ddcd1c86a3
Remove outdated code from mysqli Windows build (#14648)
The --with-mysqli option once accepted the mysqlnd argument when
also libmysql was used.
2024-06-24 14:18:14 +02:00
Peter Kokot
106581b1b6
Remove outdated libs_version.txt file (#14631)
This is not being synced with changes done in github.com/winlibs and
served only for documentation purposes. Since the list is outdated it is
simpler to remove it than maintain it updated.
2024-06-24 00:54:26 +02:00
Peter Kokot
c2f6fa4ee7
Use AC_DEFINE_UNQUOTED where variables are used (#14647)
According to Autoconf documentation AC_DEFINE_UNQUOTED should be used,
where shell variables are used in the macro arguments.
https://www.gnu.org/software/autoconf/manual/autoconf-2.72/autoconf.html#index-AC_005fDEFINE_005fUNQUOTED-2

This also adds simple help descriptions to these CPP macros.
2024-06-23 23:53:50 +02:00
Peter Kokot
fc36d0e849
Sync spl extension dependency for mysqli extension (#14642)
This is configure time dependency for consistency.
2024-06-23 23:15:47 +02:00
David CARLIER
8eb0889d90
Fix GH-14637: memory leak after failed heap allocation due to mem limit. (#14641) 2024-06-23 21:43:02 +01:00
Peter Kokot
c6dc3bd9f8
Remove obsolete enable_pear BC compatibility check (#14636)
This was added due to configure option rename from --enable-pear to
--with-pear:
2cf1b8d345
2024-06-23 21:39:52 +02:00
Peter Kokot
8d876e435b
Enable static tsrmls cache in pdo_mysql with mysqlnd (#14634)
The tsrmls cache has been integrated in
aac7b1db7c but not enabled when pdo_mysql
is built for mysqlnd extension.
2024-06-23 21:12:35 +02:00
Peter Kokot
df12ffcc77
Check for library functions on one place in Zend.m4 (#14635)
The m4_normalize is for Autoconf < 2.70 (on 2.70 and later versions a
blank-or-newline separated items can be expanded without using
backslash-newline).
2024-06-23 20:18:53 +02:00
Peter Kokot
0ed134100f
Update mysqli and pdo_mysql extension dependencies (#14633)
- The mysqlnd is required dependency in mysqli extension
- When building pdo_mysql with mysqlnd (--with-pdo-mysql or
  --with-pdo-mysql=mysqlnd) mysqlnd is required
- This also adds missing configure time pdo dependency to pdo_mysql
2024-06-23 19:59:31 +02:00
Peter Kokot
678a481f62
Fix unused variable warning when using libpq < 12 (#14630)
The variable S is not used if PQresultMemorySize is not available in
this switch at this point.
2024-06-22 00:09:21 +02:00
Peter Kokot
05f3304b48
Remove unused PHP_PGSQL_API_VERSION (#14629)
The pgsql extension headers aren't installed and this API version hasn't
been used nor bumped yet.
2024-06-21 23:31:20 +02:00
Peter Kokot
338be9dd9c
Fix PHP_DEBUG condition in cgi SAPI (#14620)
PHP_DEBUG is always defined, either to 0 or 1. This matches the
fpm_main.c code with similar check even though it was not executed for
a while.
2024-06-21 20:59:34 +02:00
Peter Kokot
f4ce50ddfb
Add optional pkg-config support for PostgreSQL library (libpq) (#14540)
The pkg-config (libpq.pc file) was added in PostgreSQL 9.3. This adds a
common setup M4 macro PHP_SETUP_PGSQL to find client PostgreSQL library
libpq on the system with pkg-config. If not found, check falls back to
pg_config to find the libpq and its headers in common locations as
before.

The PGSQL_CFLAGS and PGSQL_LIBS environment variables can override the
libpq installation paths:

    ./configure --with-pgsql --with-pdo-pgsql \
        PGSQL_CFLAGS=-I/path/to/libpq \
        PGSQL_LIBS="-L/path/to/libpq -lpq"

Passing manual, non-standard PostgreSQL installation path can be done
with configure option arguments:

    ./configure \
        --with-pgsql=/any/path/to/postgresql \
        --with-pdo-postgresql=/any/path/to/postgresql

If this DIR argument (PostgreSQL installation directory or path to the
pg_config) is passed, it takes precedence over the pkg-config, when
installed on the system.

This also removes the unused HAVE_LIBPQ symbol and passing the
PGSQL_INCLUDE and PGSQL_LIBDIR environment variable to configure in
favor of PGSQL_CFLAGS and PGSQL_LIBS.

Instead of the obsolete backticks the recommended $(...) is used when
invoking the pg_config.

Follow-up of GH-4235 (Use PKG_CHECK_MODULES to detect the pq library)
2024-06-21 18:35:37 +02:00
Peter Kokot
5d359cd4e5
Remove unused PHP-8.3 generated JIT files (#14622)
This remove unused PHP-8.3 generated JIT files and adds PHP-8.3
generated JIT files back to .gitignore to have smoother workflow
when switching PHP branches this can be ignored for a branch
or two.
2024-06-21 17:33:57 +02:00
Peter Kokot
6e2ad3c4ba
Define HAVE_VISIBILITY for fileinfo extension (#14618)
The libmagic library also uses the HAVE_VISIBILITY macro that should be
defined to 1 if visibility is supported or 0 if not.

Follow-up of GH-5526 (-Wundef)
2024-06-21 16:18:28 +02:00
Peter Kokot
b12ccb319f
Add PHP_SETUP_ZLIB M4 macro (#14591)
This enables the zlib library (https://zlib.net/) from a single place to
match the minimum required version across the php-src. This provides a
possible simpler version bump in the future. Macro's 2nd and 3rd
arguments can pass additional actions whether zlib library is found or
not for the possible future adjustments in the ext/standard where also
zlib might be required.

Support for pkg-config was introduced in 1.2.3.1.
The minimum zlib version has been bumped to 1.2.3.1



* Bump minimum zlib version to 1.2.11

This is aligned with CentOS 8, which has 1.2.11 in the default packages.

* [skip ci] Move zlib version change to UPGRADING

This matches the OpenSSL style version change notice already done in
this file.
2024-06-21 15:05:34 +02:00
Ayesh Karunaratne
5a6f07e23c
UPGRADING: add ext/oci8 and ext/pdo_oci removal to UPGRADING file (#14619)
Fixes [13327-comment](https://github.com/php/php-src/pull/13327#issuecomment-2176327609)

Signed-off-by: Ayesh Karunaratne <ayesh@aye.sh>
2024-06-21 08:45:53 +01:00
David Carlier
c1c29143b5
Merge branch 'PHP-8.3' 2024-06-21 05:08:56 +01:00
David Carlier
6847036fec
Merge branch 'PHP-8.3' 2024-06-21 05:04:05 +01:00
Matteo Beccati
5a3c4a2c9c
Fix test when using libmysqlclient
TL;DR
When suing libmysqlclient, ints are fetched as strings, so the strict comparison was failing
2024-06-20 13:25:52 +02:00
Peter Kokot
11914de72c
Sync ext/dom and unistd.h include style (#14597) 2024-06-19 22:25:20 +02:00
Arnaud Le Blanc
dc477b59e3
[ci skip] NEWS for GH-13432 2024-06-19 19:49:06 +02:00
Florian Engelhardt
f4557b48a6
Add gc and shutdown callbacks to ZendMM custom handlers (#13432) 2024-06-19 19:43:57 +02:00
Tim Düsterhus
a1ea464069
gen_stub: Intern the parameter name string for named arguments in internal attributes (#14595)
This is necessary because `zend_get_attribute_object()` will use the persistent
string with the parameter name as the index for a newly created non-persistent
HashTable, which is not legal.

As parameter names are expected to be short-ish, reasonably common terms and
need to sit around in memory anyways, we might as well make them an interned
string, circumstepping the issue without needing to duplicate the parameter
name into a non-persistent string.
2024-06-19 08:06:50 +02:00
David CARLIER
0c3dd16fbd
ext/gd: ownership. (#14601) 2024-06-19 05:49:06 +01:00
Gina Peter Banyard
7a1eded24d
ext/soap: Use zend_string for name parameter of set_soap_fault() 2024-06-19 02:23:08 +01:00
Gina Peter Banyard
e1b59e9edd
ext/soap: Use more accurate return types in implementations of SoapClient::__doRequest()
The do_request() function that calls this methods, assumes that a string is being returned from the method
otherwise it bails out.

However, the default implementation of SoapClient::__doRequest() indicates that it can return null when it
fails to set-up and execute the HTTP SOAP request, but this always results in a SoapFault exception being
thrown, and thus cannot happen in practice.

We need to investigate further if the return type should be changed from ?string to string or not.
2024-06-19 02:23:08 +01:00
Gina Peter Banyard
0fc5ec108e
ext/soap: Add tests for invalid SOAP Headers argument 2024-06-19 02:23:08 +01:00
Gina Peter Banyard
cd61f16ad8
ext/soap: Refactor verify_soap_headers_array()
Make its duty only to check if the provided HashTable is valid
2024-06-19 02:23:08 +01:00
Gina Peter Banyard
e12db87e09
ext/soap: Add some SoapServer tests about handling errors 2024-06-19 02:23:01 +01:00
Gina Peter Banyard
e830306431
ext/soap: Add some SoapClient tests about handling errors 2024-06-19 02:20:37 +01:00
Gina Peter Banyard
062353ce2d
ext/soap: prevent needless computation of strlen() 2024-06-19 02:20:36 +01:00
Gina Peter Banyard
073491bfd8
ext/soap: Refactor SOAP call methods implementation 2024-06-19 02:20:36 +01:00
Gina Peter Banyard
a6a2c66141
ext/soap: Refactor SDL delete functions
Use a common implementation for persistent and non-persistent functions
2024-06-19 02:20:36 +01:00
Gina Peter Banyard
1e7134f07f
ext/soap: Refactor implementation of in_domain() 2024-06-19 02:20:36 +01:00
Gina Peter Banyard
4626c17f41
ext/soap: SoapServer::addSoapHeader() does not need bailout handler wrapper
As this methods never uses the bailout mechanism
2024-06-19 02:20:36 +01:00
Gina Peter Banyard
2459b3ae0d
ext/soap: SoapServer::addFunction() does not need bailout handler wrapper
As this methods never uses the bailout mechanism
2024-06-19 02:20:36 +01:00
Gina Peter Banyard
ce1bb1afa8
ext/soap: SoapServer::getFunctions() does not need bailout handler wrapper
As this methods never uses the bailout mechanism
2024-06-19 02:20:35 +01:00
Gina Peter Banyard
a99a790ad0
ext/soap: SoapServer::setObject() does not need bailout handler wrapper
As this methods never uses the bailout mechanism
2024-06-19 02:20:35 +01:00
Gina Peter Banyard
5a961cbf77
ext/soap: SoapServer::setClass() does not need bailout handler wrapper
As this methods never uses the bailout mechanism
2024-06-19 02:20:35 +01:00
Gina Peter Banyard
8269caab53
ext/soap: SoapServer::setPersistence() does not need bailout handler wrapper
As this methods never uses the bailout mechanism
2024-06-19 02:20:35 +01:00
Gina Peter Banyard
572b2b71cd
ext/soap: Use bool type for _bailout variable 2024-06-19 02:20:35 +01:00
Gina Peter Banyard
b71951baae
ext/soap: Use bool as return type instead of int for do_request() 2024-06-19 02:20:35 +01:00
Gina Peter Banyard
cfc48bd832
ext/soap: Use bool as return type instead of int for parse_packet_soap() 2024-06-19 02:20:34 +01:00
Gina Peter Banyard
a7c7158653
ext/soap: Use bool as return type instead of int for is_blank() 2024-06-19 02:20:34 +01:00
Jakub Zelenka
b5c6d57c05
Merge branch 'PHP-8.3' 2024-06-19 00:06:10 +01:00
Máté Kocsis
09303ad0e7
Fix some ext/date return types (#14600) 2024-06-18 23:25:09 +02:00
David Carlier
9672cd9469
ext/sockets: Adding macOS SO_LINGER_SEC constant.
macOS SO_LINGER, unlike other platforms, functions in term of ticks,
SO_LINGER_SEC is provided to be in line with other platforms.

close GH-14599
2024-06-18 21:57:40 +01:00
Máté Kocsis
c588db1ee7
Use RETURN_THROWS() for WeakMap methods 2024-06-18 22:34:18 +02:00
Matteo Beccati
fbe317bf21
Merge remote-tracking branch 'mbeccati/pdo_driver_specific_parser' 2024-06-18 17:07:14 +02:00
Sergey Panteleev
f4588d55a2
Merge branch 'refs/heads/PHP-8.3'
* refs/heads/PHP-8.3:
  PHP-8.2 is now for PHP 8.2.22-dev
2024-06-18 17:56:49 +03:00
Matteo Beccati
329dfa7e0e
[ci skip] Updated NEWS and UPGRADING 2024-06-17 23:58:09 +02:00
Matteo Beccati
53d7c17474
pdo_pgsql: escaped question marks inside dollar quoted strings
Allow "??" in dollar quoted strings for backwards compatibility,
as it was a viable workaround to insert question marks without them
being parsed as placeholders.

Add a deprecation notice to tell that the escape is no longer
necessary within dollar quotes and that its usage is deprecated.

Ref bug #14244
2024-06-17 23:31:25 +02:00
Matteo Beccati
037243ccd7
pdo_mysql: "--" should be followed by a whitespace character
This required changing how YYFILL works, with no apparent regressions
2024-06-17 23:31:25 +02:00
Matteo Beccati
3096ffa7ab
pdo_sqlite: identifier quoting with square brakets 2024-06-17 23:31:24 +02:00
Matteo Beccati
01879ec254
pdo_pgsql: add support for dollar-quotes
RFC: http://wiki.php.net/rfc/pdo_driver_specific_parsers
2024-06-17 23:31:24 +02:00
Matteo Beccati
e82c486918
pdo_pgsql: add support for "escape" string literals
RFC: http://wiki.php.net/rfc/pdo_driver_specific_parsers
2024-06-17 23:31:24 +02:00
Matteo Beccati
715b9aaa09
Implemented PDO Driver specific SQL parsers
RFC: http://wiki.php.net/rfc/pdo_driver_specific_parsers
2024-06-17 23:31:24 +02:00
David Carlier
ac947925c0
Merge branch 'PHP-8.3' 2024-06-17 17:46:54 +01:00
Tim Düsterhus
9907389007
Fix sprintf_rope_optimization_004.phpt for 32-bit versions
see 2c5ed50d5c
2024-06-17 17:45:46 +02:00
Tim Düsterhus
2c5ed50d5c
zend_compile: Add support for %d to sprintf() optimization (#14561)
* zend_compile: Rename `string_placeholder_count` to `placeholder_count` in `zend_compile_func_sprintf()`

This is intended to make the diff of a follow-up commit smaller.

* zend_compile: Add support for `%d` to `sprintf()` optimization

This extends the existing `sprintf()` optimization by support for the `%d`
placeholder, which effectively equivalent to an `(int)` cast followed by a
`(string)` cast.

For a synthetic test using:

    <?php

    $a = 'foo';
    $b = 42;

    for ($i = 0; $i < 100_000_000; $i++) {
        sprintf("%s-%d", $a, $b);
    }

This optimization yields a 1.3× performance improvement:

    $ hyperfine 'sapi/cli/php -d zend_extension=php-src/modules/opcache.so -d opcache.enable_cli=1 test.php' \
          '/tmp/unoptimized -d zend_extension=php-src/modules/opcache.so -d opcache.enable_cli=1 test.php'
    Benchmark 1: sapi/cli/php -d zend_extension=php-src/modules/opcache.so -d opcache.enable_cli=1 test.php
      Time (mean ± σ):      3.296 s ±  0.094 s    [User: 3.287 s, System: 0.005 s]
      Range (min … max):    3.213 s …  3.527 s    10 runs

    Benchmark 2: /tmp/unoptimized -d zend_extension=php-src/modules/opcache.so -d opcache.enable_cli=1 test.php
      Time (mean ± σ):      4.300 s ±  0.025 s    [User: 4.290 s, System: 0.007 s]
      Range (min … max):    4.266 s …  4.334 s    10 runs

    Summary
      sapi/cli/php -d zend_extension=php-src/modules/opcache.so -d opcache.enable_cli=1 test.php ran
        1.30 ± 0.04 times faster than /tmp/unoptimized -d zend_extension=php-src/modules/opcache.so -d opcache.enable_cli=1 test.php

* Fix sprintf_rope_optimization_003.phpt test expecation for 32-bit integers

* zend_compile: Indent switch-case labels in zend_compile_func_sprintf()

* Add GMP test to sprintf() rope optimization

* Add `%s` test case to sprintf() GMP test
2024-06-17 17:07:50 +02:00
Peter Kokot
9d3907fd85
Fix RAND_egd check (#14588)
When building with OpenSSL (--with-openssl) the OpenSSL libraries
(crypto and ssl) are added to LIBS. When building --with-openssl=shared
the libraries are added to OPENSSL_SHARED_LIBADD. This fixes the check
for the shared build when OpenSSL is built with RAND_egd support.
2024-06-17 13:02:53 +02:00
Dmitry Stogov
1f48715798
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-14475: PHP 8.3.7 with JIT encounters infinite loop on specific paths (#14558)
2024-06-17 09:38:17 +03:00
David CARLIER
1fc083e526
ext/gd: iamgeresolution checks overflow. (#14585) 2024-06-16 23:28:04 +01:00
Gina Peter Banyard
a888c4f0ff
Merge branch 'PHP-8.3'
* PHP-8.3:
  ext/soap: Fix memory leaks when calling SoapFault::__construct() twice
2024-06-16 23:01:52 +01:00
Jakub Zelenka
7c32704a71
Fix GH-14474: Better document remote user in PHP-FPM access.format (#14521) 2024-06-16 12:32:00 +01:00
Jakub Zelenka
c33f58867e
Merge branch 'PHP-8.3' 2024-06-16 12:24:25 +01:00
Peter Kokot
a6b5439e2e
Fix warnings function declaration isn't a prototype (#14577)
This fixes the -Wstrict-prototypes warnings that might pop up in certain
builds.
2024-06-15 21:27:56 +02:00
David Carlier
564914ac1a
ext/pgsql: adding postgresql 17 new libpq wrapper call.
pg_set_chunked_rows_size to allow to fetch results in chunk of max N rows.

close GH-14571
2024-06-15 19:56:15 +01:00
Peter Kokot
12f9b89bc5
Remove redundant win32 include flag for apache2handler (#14576) 2024-06-15 17:45:00 +02:00
Peter Kokot
ca5952a98a
Refactor SHADOW_STACK_SYSCALL check (#14575)
This fixes -Wundef warnings present where SHADOW_STACK_SYSCALL should
be defined to value 0 and refactors the check with cache variable
php_cv_have_shadow_stack_syscall. The SHADOW_STACK_SYSCALL CPP macro
definition is removed from php_config.h in favor of a compilation
definition on asm files and Zend engine files.
2024-06-15 17:00:56 +02:00
Peter Kokot
dd4e2ef5b0
Update ext/xmlreader dependencies (#14572)
- ext/dom is optional (using HAVE_DOM for cases when dom is build as
  a shared extension to make it required in that case)
- ext/libxml is required
2024-06-15 16:25:26 +02:00
Bob Weinand
6a2c5318f9
Optimize observers (#13649)
Inline the lookup whether a function is observed at all.
This strategy is also used for FRAMELESS calls. If the frameless call is observed, we instead allocate a call frame and push the arguments, to call the the function afterwards.
Doing so is still a performance benefit as opposed to executing individual INIT_FCALL+SEND_VAL ops. Thus, even if the frameless call turns out to be observed, the call overhead is slightly lower than before.
If the internal function is not observed at all, the unavoidable overhead is fetching the FLF zend_function pointer and the run-time cache needs to be inspected.

As part of this work, it turned out to be most viable to put the result operand on the ZEND_OP_DATA instead of ZEND_FRAMELESS_ICALL_3, allowing seamless interoperability with the DO_ICALL opcode.
This is a bit unusual in comparison to all other ZEND_OP_DATA usages, but seems to not pose problems overall.

There is also a small issue resolved: trampolines would always use the ZEND_CALL_TRAMPOLINE_SPEC_OBSERVER function due to zend_observer_fcall_op_array_extension being set to -1 too late.
2024-06-15 14:42:27 +02:00
Peter Kokot
6e825dfe43
Add --enable-phpdbg-debug option on Windows (#14568)
This enables outputting additional debugging messages when running
phpdbg for developing and troubleshooting phpdbg itself. Option was
already added in Autotools and this adds it also to Windows build
system.

Because additional info is printed when running tests, the
--enable-phpdbg-debug option is excluded when building with
--enable-snapshot-build if not provided explicitly.
2024-06-15 14:41:15 +02:00
Peter Kokot
e3f10732a8
Remove redundant win32 include flag when building shared phpdbg (#14573) 2024-06-15 13:17:45 +02:00
Gina Peter Banyard
f0fb9e34a5 ext/spl: use ecalloc instead of complicate memset to 0 2024-06-15 01:33:09 +01:00
Gina Peter Banyard
5337172508 ext/spl: Use ArrayObject object handlers for ArrayIterator
They are the same
2024-06-15 01:33:09 +01:00
Gina Peter Banyard
446b7fbab9 ext/spl: Remove unused typedef 2024-06-15 01:33:09 +01:00
Gina Peter Banyard
809410423f ext/spl: Refactor debug handlers
Mainly to use zend_mangle_property_name() directly instead of spl_gen_private_prop_name()
2024-06-15 01:33:09 +01:00
Gina Peter Banyard
54047c1090 ext/spl: Remove some useless header includes and clarify usages 2024-06-15 01:33:09 +01:00
Gina Peter Banyard
3fd60d33ca ext/spl: Refactor SplFileObject::fgetc() 2024-06-15 01:33:09 +01:00
Gina Peter Banyard
f296cba58c ext/spl: Convert current_line to a zend_string* 2024-06-15 01:33:09 +01:00
Gina Peter Banyard
bb4491af88 ext/spl: Adding a const modifier 2024-06-15 01:33:09 +01:00
Gina Peter Banyard
35c5cf9760 ext/spl: Remove useless wrapper 2024-06-15 01:33:09 +01:00
Gina Peter Banyard
90b8db49ac ext/spl: Refactor SplFileInfo::getPathInfo() implementation 2024-06-15 01:33:09 +01:00
Máté Kocsis
bed11e4edc
Generate DocBook 5.2 conformant class synopses pages (#14351)
Related to https://github.com/php/doc-en/pull/3415
2024-06-14 22:12:40 +02:00
David Carlier
2bb8fbd0a8
ext/pgsql: add pg_jit server info.
since PostgreSQL 11, LLVM JIT feature had been brought thus reporting
the settings to the client connection.

Close GH-14566
2024-06-14 16:27:00 +01:00
Niels Dossche
4107cb2eda phpdbg: change uses of sprintf into snprintf 2024-06-14 08:12:03 -07:00
Niels Dossche
80d4d406ba FPM: change uses of sprintf into snprintf 2024-06-14 08:12:03 -07:00
Niels Dossche
1bd33b7476 CLI: change uses of sprintf into snprintf 2024-06-14 08:12:03 -07:00
Niels Dossche
c151d2d135 standard: change uses of sprintf into snprintf and zend_string_concat2 2024-06-14 08:12:03 -07:00
Niels Dossche
a4674654ab opcache: change uses of sprintf into snprintf 2024-06-14 08:12:03 -07:00
Niels Dossche
26fcb5f2b2 win32: change uses of sprintf into snprintf 2024-06-14 08:12:03 -07:00
Niels Dossche
5fffdaa419 openssl: change uses of sprintf into snprintf and zend_string_concat2 2024-06-14 08:12:03 -07:00
Niels Dossche
429f91d80d snmp: change uses of sprintf into snprintf 2024-06-14 08:12:03 -07:00
Niels Dossche
b1fd3477b2 mysqlnd: change uses of sprintf into snprintf 2024-06-14 08:12:03 -07:00
Niels Dossche
cbb81b87f2 intl: change uses of sprintf into snprintf 2024-06-14 08:12:03 -07:00
Niels Dossche
934e385640 gd: change uses of sprintf into snprintf 2024-06-14 08:12:03 -07:00
Niels Dossche
7e2d47d2b8 curl: change uses of sprintf into snprintf 2024-06-14 08:12:03 -07:00
Niels Dossche
8c92b5f7ae TSRM: change uses of sprintf into snprintf 2024-06-14 08:12:03 -07:00
Niels Dossche
3b83d7e3b5 Zend: change uses of sprintf into snprintf 2024-06-14 08:12:03 -07:00
Peter Kokot
3b951e7b04
Rename HAVE_DECL_ARC4RANDOM_BUF to HAVE_ARC4RANDOM_BUF (#14565)
AC_CHECK_DECLS defines HAVE_DECL_ARC4RANDOM_BUF to 0 or 1. On Windows
this isn't defined to 0. To avoid the undefined state, the AC_CHECK_DECL
is used to manually define the HAVE_ARC4RANDOM_BUF to 1 if declaration
is found, otherwise undefined.

In the future on current platforms, also AC_CHECK_FUNCS can be used
instead since the arc4random_buf is located in default libraries (C)
with declaration available in headers.
2024-06-13 22:36:05 +02:00
Saki Takamachi
37488d6e01
ext/bcmath: Minor fixes to bcmul() (#14564)
The original calculation method for prod_arr_size allowed for some error,
which could have increased the number of simple loops without byte tricks
at the end of the calculation when converting to bc_num.

The new method calculates the size accurately, so the number of loops does
not increase unnecessarily.
2024-06-14 02:20:32 +09:00
Ilija Tovilo
460b851214
[skip ci] Fix codecov upload 2024-06-13 17:33:56 +02:00
Peter Kokot
2969889fb8
Remove conditional pg_encoding_to_char usage (#14557)
The pg_encoding_to_char is available in PostgreSQL since ~7.3 where also
the --enable-multibyte option was removed. PHP minimum PostgreSQL
version at this point is 9.1, which also has the pg_encoding_to_char
declaration in libpq-fe.h.

This removes conditional usage and the HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT
symbol.
2024-06-13 16:00:16 +02:00
Derick Rethans
4b24f5d6db
Merge branch 'PHP-8.3' 2024-06-13 14:04:48 +01:00
Ilija Tovilo
8fd1388a7f
Merge branch 'PHP-8.3'
* PHP-8.3:
  Remove GitHub actions junit artifacts
2024-06-13 14:09:17 +02:00
Ilija Tovilo
4542cc66dd
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix windows rename test directories clashing
2024-06-13 14:03:33 +02:00
Ilija Tovilo
86ebc18e38
[skip ci] Add myself as CODEOWNER for some more files 2024-06-13 13:59:55 +02:00
Peter Kokot
5baef94d00
Remove conditional usage of PQfreemem (#14559)
PQfreemem is available since PostgreSQL 7.4.
2024-06-13 13:34:08 +02:00
Peter Kokot
dcd20da8a5
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix incompatible function pointer types
2024-06-13 12:28:27 +02:00
Giovanni Giacobbi
592d899462
ext/gd: de-factorize image output functions (#14523)
The image output functions imagegif/imagepng/imagewebp/imageavif/imagejpeg
were all calling the static function _php_image_output_ctx which was basically
a big switch statement between each image type which also have different
parameters.

The only identical part was the call to create_stream_context_from_zval that
is now merged with create_output_context.
2024-06-13 09:46:47 +01:00
Tim Düsterhus
1e7aac315e
zend_compile: Optimize sprintf() into a rope (#14546)
* zend_compile: Add `zend_compile_rope_finalize()`

This just extracts the implementation as-is into a dedicated function to make
it reusable in preparation of a future commit.

* zend_compile: Use clearer parameter names for `zend_compile_rope_finalize()`

* zend_compile: Fix `zend_compile_rope_finalize()` for ropes containing a single constant string

Without this Opcache will trigger a use-after-free in
`zend_optimizer_compact_literals()`.

Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com>

* zend_compile: Optimize `sprintf()` into a rope

This optimization will compile `sprintf()` using only `%s` placeholders into a
rope at compile time, effectively making those calls equivalent to the use of
string interpolation, with the added benefit of supporting arbitrary
expressions instead of just expressions starting with a `$`.

For a synthetic test using:

    <?php

    $a = 'foo';
    $b = 'bar';

    for ($i = 0; $i < 100_000_000; $i++) {
    	sprintf("%s-%s", $a, $b);
    }

This optimization yields a 2.1× performance improvement:

    $ hyperfine 'sapi/cli/php -d zend_extension=php-src/modules/opcache.so -d opcache.enable_cli=1 test.php' \
          '/tmp/unoptimized -d zend_extension=php-src/modules/opcache.so -d opcache.enable_cli=1 test.php'
    Benchmark 1: sapi/cli/php -d zend_extension=php-src/modules/opcache.so -d opcache.enable_cli=1 test.php
      Time (mean ± σ):      1.869 s ±  0.033 s    [User: 1.865 s, System: 0.003 s]
      Range (min … max):    1.840 s …  1.945 s    10 runs

    Benchmark 2: /tmp/unoptimized -d zend_extension=php-src/modules/opcache.so -d opcache.enable_cli=1 test.php
      Time (mean ± σ):      4.011 s ±  0.034 s    [User: 4.006 s, System: 0.005 s]
      Range (min … max):    3.964 s …  4.079 s    10 runs

    Summary
      sapi/cli/php -d zend_extension=php-src/modules/opcache.so -d opcache.enable_cli=1 test.php ran
        2.15 ± 0.04 times faster than /tmp/unoptimized -d zend_extension=php-src/modules/opcache.so -d opcache.enable_cli=1 test.php

This optimization comes with a small and probably insignificant behavioral
change: If one of the values cannot be (cleanly) converted to a string, for
example when attempting to insert an object that is not `Stringable`, the
resulting Exception will naturally not show the `sprintf()` call in the
resulting stack trace, because there is no call to `sprintf()`.

Nevertheless it will correctly point out the line of the `sprintf()` call as
the source of the Exception, pointing the user towards the correct location.

* zend_compile: Eagerly handle empty format strings in `sprintf()` optimization

* zend_compile: Add additional explanatory comments to zend_compile_func_sprintf()

* Add zero-argument test to sprintf_rope_optimization_001.phpt

---------

Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com>
2024-06-13 10:41:45 +02:00
David CARLIER
18cfd94de4
ext/sockets: multicast simplification on ipv4 table retrieval and buffer handling. (#14542) 2024-06-12 18:33:16 +01:00
Arnaud Le Blanc
25360ef249
Detect heap freelist corruption (#14054)
We keep track of free slots by organizing them in a linked list, with the
first word of every free slot being a pointer to the next one.

In order to make corruptions more difficult to exploit, we check the consistency
of these pointers before dereference by comparing them with a shadow. The shadow
is a copy of the pointer, stored at the end of the slot.

Before this change, an off-by-1 write is enough to produce a valid freelist
pointer. After this change, a bigger out of bound write is required for that.
The difficulty is increase further by mangling the shadow with a secret, and
byte-swapping it, which increases the minimal required out of bound write
length.

Closes GH-14054
2024-06-12 17:28:52 +02:00
Arnaud Le Blanc
d1048a0869
Add zend_random_bytes(), zend_random_bytes_insecure() functions (#14054)
Co-authored-by: Tim Düsterhus <tim@bastelstu.be>
2024-06-12 17:27:01 +02:00
Peter Kokot
d545b1d643
Add missing ext/pcre dependency for ext/pgsql (#14541) 2024-06-11 23:38:23 +02:00
Peter Kokot
5d3fab9334
Sync #if/ifdef/defined (#14520)
These are either undefined or defined (to value 1):
- __DragonFly__
- __FreeBSD__
- HAS_MCAST_EXT
- HAVE_GETCWD
- HAVE_GETWD
- HAVE_GLIBC_ICONV
- HAVE_JIT
- HAVE_LCHOWN
- HAVE_NL_LANGINFO
- HAVE_RL_CALLBACK_READ_CHAR
- HAVE_RL_ON_NEW_LINE
- HAVE_SQL_EXTENDED_FETCH
- HAVE_UTIME

Follow up of GH-5526 (-Wundef)
2024-06-11 22:47:05 +02:00
Jorg Adam Sowa
45714e2cb8
random: Remove redundant assignments in php_random_rangeX() (#14536)
Co-authored-by: Tim Düsterhus <tim@bastelstu.be>
2024-06-11 21:36:02 +02:00
Peter Kokot
61a0e3bd19
Sync HAVE_OPENSSL* symbols (#14333)
This syncs few inconsistencies between the Windows and Autotools build
systems:
- HAVE_OPENSSL_EXT is now defined in the same style on both systems
  (undefined - extension is not available, defined to 1 - extension is
  available)
- HAVE_OPENSSL removed as it was only defined on Windows
2024-06-11 19:18:19 +02:00
Saki Takamachi
bfc988552f
Fixed GH-14383: Fixed usec was carry up (#14463)
If round to the fractional part of a timestamp, a carry will occur in cases
such as 999 999 9. In that case, set usec to 0 and add/sub 1 to sec.
2024-06-11 19:02:43 +09:00
Peter Kokot
5433f02e79
Use default argument in AS_CASE instead of pattern 2024-06-11 11:26:52 +02:00
David CARLIER
1ae544330c
ext/gd using fast ZPP. (#14534) 2024-06-11 09:01:54 +01:00
Peter Kokot
bd7b174044
Update ext/spl as required dependency for ext/pdo (#14535)
Since ZEND_MOD_REQUIRED is used and spl can't be disabled, this marks
the configure time dependency also as required.
2024-06-11 09:59:58 +02:00
Peter Kokot
845af7778e
Remove redundant win32/unistd.h includes (#14533)
At this point win32/unistd.h only declares usleep which isn't used at
these places.
2024-06-11 09:47:23 +02:00
Ilija Tovilo
da7bc2ea04
Merge branch 'PHP-8.3'
* PHP-8.3:
  Set SG(rfc1867_uploaded_files) to null after destroy
2024-06-10 23:03:49 +02:00
Ilija Tovilo
998bce117c
Show enum cases in errors
Closes GH-14496
2024-06-10 22:58:25 +02:00
Peter Kokot
a82d86479c
Replace WIN32 conditions with _WIN32 or PHP_WIN32 (#14462)
* Replace WIN32 conditions with _WIN32 or PHP_WIN32

WIN32 is defined by the SDK and not defined all the time on Windows by
compilers or the environment. _WIN32 is defined as 1 when the
compilation target is 32-bit ARM, 64-bit ARM, x86, or x64. Otherwise,
undefined.

This syncs these usages one step further.

Upstream libgd has replaced WIN32 with _WIN32 via
c60d9fe577

PHP_WIN32 is added to ext/sockets/sockets.stub.php as done in other
*.stub.php files at this point.

* Use PHP_WIN32 in ext/random

* Use PHP_WIN32 in ext/sockets

* Use _WIN32 in xxhash.h as done upstream

See https://github.com/Cyan4973/xxHash/pull/931

* Update end comment with PHP_WIN32
2024-06-10 21:59:41 +02:00
Niels Dossche
bcecbb59d3
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-11078: PHP Fatal error triggers pointer being freed was not allocated and malloc: double free for ptr errors
2024-06-10 19:40:03 +02:00
Levi Morrison
62bfb01e00
refactor: zend_call_stack_get_linux_pthread
GCC doesn't pessimize the error cases correctly:
https://godbolt.org/z/Pa6xsKMWc

This speeds up the happy case and in this case the code size is also
smaller, so it's a double-win.
2024-06-10 10:40:40 -06:00
Peter Kokot
550f840a22
Fix fall through warning in sapi/litespeed (#14530)
This fixes this warning using ZEND_FALLTHROUGH:

```
php-src/sapi/litespeed/lsapi_main.c: In function ‘parse_opt’:
php-src/sapi/litespeed/lsapi_main.c:1196:16: warning: this statement may fall through [-Wimplicit-fallthrough=]
 1196 |             if ( *((*(p-1))+2) == 's' )
      |                ^
```
2024-06-10 16:51:01 +02:00
Arnaud Le Blanc
11a46b31d9
Merge branch 'PHP-8.3'
* PHP-8.3:
  fix memleak due to missing `pthread_attr_destroy()`-call
2024-06-10 16:10:32 +02:00
Florian Engelhardt
3c65375adb
fix memleak due to missing pthread_attr_destroy()-call
Closes GH-14510
2024-06-10 16:07:12 +02:00
Arnaud Le Blanc
b4325d6113
Improve randomness of uploaded file names and files created by tempnam()
Closes GH-14364
2024-06-10 15:37:51 +02:00
Gina Peter Banyard
7130a174bb
ext/opcache/jit: Fix -Wundef warning for HAVE_CAPSTONE
All other times this symbol is references #ifdef is used
2024-06-10 14:19:59 +01:00
Tim Düsterhus
193d3850b2
Leverage object_init_with_constructor() in zend_get_attribute_object() (#14532) 2024-06-10 15:12:22 +02:00
Tim Düsterhus
10a6f0bd92
cli: Clean up formatting in do_cli() (#14531)
* cli: Add spaces around operators in do_cli()

* cli: Unify `switch()` body indentation in `do_cli()`
2024-06-10 15:12:05 +02:00
Dmitry Stogov
6c9d443a21
Update IR
IR commit: 5be6dd81f19f85bc06085617e7231f8699d7f9b0
2024-06-10 11:49:08 +03:00
Tim Düsterhus
bca0c08408
Make the CLI mode available via the SAPI globals (#14479)
* Remove tautologically false condition in php_cli.c

* Make the CLI mode available via the SAPI globals

When hooking into RINIT it is currently pretty much impossible to determine
whether a file will actually be executed or if it just will be linted,
highlighted, or comments stripped: The startup is identical for all of them and
the chosen mode is not currently exposed to other extensions.

The `SG(server_context)` is currently entirely unused for the `cli` SAPI. It
appears to be appropriate to store the mode as a SAPI-specific information
inside of it.
2024-06-10 09:15:55 +02:00
Peter Kokot
c3388c1841
Sync #if/ifdef/defined (#14512)
These are either undefined or defined to 1:
- HAVE_LIBEDIT
- HAVE_LIBREADLINE
- ZEND_MAX_EXECUTION_TIMERS

Follow up of GH-5526 (-Wundef)
2024-06-10 08:56:10 +02:00
Peter Kokot
d3901b8ca6
Sync PHP_FILEINFO_UNCOMPRESS #if/ifdef/defined (#14525)
This fixes few more -Wundef warnings in ext/fileinfo. The
PHP_FILEINFO_UNCOMPRESS seems to be present to be defined at some point
but is currently unused in all build systems. Leaving this intact for
now.

Follow up of GH-5526 (-Wundef)
2024-06-10 08:11:25 +02:00
Niels Dossche
89185745f1
[ci skip] Update contributing guidelines for docs (#14528) 2024-06-09 23:21:47 +01:00
Peter Kokot
84a0da1574
Sync #if/ifdef/defined (#14508)
This syncs CPP macro conditions:
- _WIN32
- _WIN64
- HAVE_ALLOCA_H
- HAVE_ALPHASORT
- HAVE_ARPA_INET_H
- HAVE_CONFIG_H
- HAVE_DIRENT_H
- HAVE_DLFCN_H
- HAVE_GETTIMEOFDAY
- HAVE_LIBDL
- HAVE_POLL_H
- HAVE_PWD_H
- HAVE_SCANDIR
- HAVE_SYS_FILE_H
- HAVE_SYS_PARAM_H
- HAVE_SYS_SOCKET_H
- HAVE_SYS_TIME_H
- HAVE_SYS_TYPES_H
- HAVE_SYS_WAIT_H
- HAVE_UNISTD_H
- PHP_WIN32
- ZEND_WIN32

These are either undefined or defined to 1 in Autotools and Windows.

Follow up of GH-5526 (-Wundef).
2024-06-09 14:23:41 +02:00
Jakub Zelenka
52f6e099b0
Merge branch 'PHP-8.3' 2024-06-09 12:41:46 +01:00
Jakub Zelenka
98736e8bbd
Fix GH-13343: openssl_x509_parse should not allow omitted seconds in UTCTimes
Closes GH-14439

Signed-off-by: Jakub Zelenka <bukka@php.net>
2024-06-09 12:35:05 +01:00
Peter Kokot
65ff5117ab
Check for PQERRORS_SQLSTATE in PGVerbosity enum (#14519)
The PG_VERSION_NUM is not available in intended public PostgreSQL
headers unless the pg_config.h is included or the PostgreSQL server
development headers are installed separately. This instead resorts to
checking for the PGVerbosity enum value. The PQERRORS_SQLSTATE was added
to PostgreSQL 12.0. At the time of writing, on Windows, PostgreSQL is at 11.4 so
it is not defined there yet.
2024-06-09 11:47:06 +02:00
Peter Kokot
aae237aad5
Add missing sodium.h header (#14515)
The php_libsodium.h uses SODIUM_LIBRARY_VERSION_* macros from the
sodium.h (sodium/version.h) header.
2024-06-09 07:17:46 +02:00
Peter Kokot
0dcb467dae
Sync #if/ifdef/defined (#14511)
These are either undefined or defined to value 1:
- ZEND_INTRIN_SSE4_2_PCLMUL_NATIVE
- ZEND_INTRIN_SSE4_2_PCLMUL_RESOLVER
- ZEND_INTRIN_SSE4_2_PCLMUL_FUNC_PROTO
- ZEND_INTRIN_SSE4_2_PCLMUL_FUNC_PTR

Follow up of GH-5526 (-Wundef)
2024-06-09 07:13:23 +02:00
Peter Kokot
01887afdfa
Fix typo s/PGVERSION_NUM/PG_VERSION_NUM (#14516) 2024-06-09 06:48:44 +02:00
Guillaume Outters
a9259c0496
Add Pdo\Pgsql::setNoticeCallback() (#14299)
This moves the new method from magically being added to the PDO class from the driver to just be available on the dedicated subclass. 

Drive-by fixes to NEWS and UPGRADING
2024-06-09 03:04:51 +01:00
Saki Takamachi
25579a8616
ext/bcmath: Renamed macros and variables (#14507)
Made the macro BC_UINT_T a typedef and renamed it BC_VECTOR.

Additionally, several macros have been renamed to be consistent with BC_VECTOR.
2024-06-09 09:11:11 +09:00
Peter Kokot
f109795852
Sync HAVE_GRP_H definition (#14514)
This syncs the HAVE_GRP_H definition on Windows (manually defined) and
Autotools (checked with AC_CHECK_HEADERS):
HAVE_GRP_H is is either undefined or defined to value 1.
2024-06-09 01:55:27 +02:00
Gina Peter Banyard
a5cacba6d8
ext/spl: Remove spl_engine.h header (#14418)
And convert calls to spl_instantiate_arg_* to the new object_init_with_constructor() API
2024-06-08 23:46:34 +01:00
Ayesh Karunaratne
d8795a3503
ext/pcre: update Config to match upstream (#14509)
In GH-14498, we updated pcre2lib to v10.44. However, it missed syncing the config,
that changes upstream `MAX_NAME_SIZE` from 32 to 128.

Ref: [1](ced3b0f06f (diff-91c5b46dc84a94604a4e4d0caed9bf85590a2eddbb12d2e8dc80badf324a9dfb)), [2](6c670c780a)
2024-06-08 21:34:18 +02:00
Peter Kokot
743d1fd2a2
Sync -Wno-implicit-fallthrough
This is a sync of the https://github.com/php/php-src/pull/6252 after few
years:
- ext/date: pending recheck in GH-14187
- ext/hash: warning happens only on 32-bit build in
  ext/hash/sha3/generic32lc/KeccakP-1600-inplace32BI.c
- ext/opcache: IR JIT doesn't seem to have this issue
- ext/pcre remains disabled due to pcre2lib/sljit/sljitNativeARM_64.c
  (should be rechecked and fixed upstream)
2024-06-08 20:04:21 +02:00
Gina Peter Banyard
fd2d869642
Clean-up some more headers (#14416)
Remove unused headers (such as php_ini.h for extensions that don't define INI settings)
Use more specific headers when possible
2024-06-08 17:15:36 +01:00
Gina Peter Banyard
8f6612aca0 ext/date: Fix some [-Wsign-compare] warnings 2024-06-08 17:15:01 +01:00
Gina Peter Banyard
86a4fa3d02 Zend/Optimizer: Fix some [-Wsign-compare] warnings 2024-06-08 17:15:01 +01:00
Gina Peter Banyard
194a2c1b54 ext/standard/url.c fix a [-Wsign-compare] warning 2024-06-08 17:15:01 +01:00
Gina Peter Banyard
8c16076dc3 ext/random: Fix signess issues 2024-06-08 17:15:01 +01:00
Gina Peter Banyard
efee76b8e2 ext/json: Fix sign conversion warnings 2024-06-08 17:15:01 +01:00
Peter Kokot
9dbcb91152
Refactor check for libcurl linkage with OpenSSL < 1.1 (#14319)
- One excessive AC_MSG_RESULT removed
- AC_RUN_IFELSE wrapped in AC_CACHE_CHECK for easier cross-compiling
  edge cases
- Check wrapped in the thread safety condition since this is relevant
  only when ZTS is enabled
2024-06-08 17:59:59 +02:00
Ayesh Karunaratne
d1f14a4609
ext/pcre: update to PCRE2 v10.44 (#14498)
Previously: GH-13413.

This version also contains a fix with `preg_match('\X')`, so that it
can correctly detect grapheme clusters (PCRE2Project/pcre2#410).
This is useful to correctly [polyfill the new `grapheme_str_split`
function](https://php.watch/versions/8.4/grapheme_str_split#polyfill).

Diff: pcre2lib [v10.43..v10.44](https://github.com/PCRE2Project/pcre2/compare/pcre2-10.43...pcre2-10.44)
2024-06-08 13:03:31 +02:00
Peter Kokot
5a03ff4f6c
Remove PHP_SETUP_OPENSSL inactive 3rd argument (#14323)
If OpenSSL is not found, the PKG_CHECK_MODULES errors out already. To
not introduce too big of a BC break with possible PECL extensions using
this macro, it is perhaps simpler to remove this non-working argument.
Redundant macro arguments are ignored by Autoconf anyway.
2024-06-07 23:48:17 +02:00
Peter Kokot
da86eec3db
Sync #if/ifdef/defined (#14371)
These are either undefined or defined to value 1 in Autotools and
Windows:
- HAVE_COMMONCRYPTO_COMMONRANDOM_H
- HAVE_EXIF
- HAVE_FOPENCOOKIE
- HAVE_IF_NAMETOINDEX
- HAVE_LIBICONV
- HAVE_SOCKETS
- HAVE_STRUCT_STAT_ST_RDEV
- HAVE_STRUCT_TM_TM_GMTOFF
- HAVE_STRUCT_TM_TM_ZONE

Follow up of GH-5526 (-Wundef)
2024-06-07 23:45:17 +02:00
Peter Kokot
58f3b676f5
Replace WINDOWS with PHP_WIN32 in ext/standard/filestat.c (#14464)
The WINDOWS symbol is project defined symbol in most cases and can be
replaced with PHP_WIN32 in this case at this point.
2024-06-07 23:38:55 +02:00
Peter Kokot
271f91169e
Remove WINDOWS symbol from ext/ldap/ldap.c (#14468)
The WINDOWS symbol was used up to commit
f79688e848 where it got undefined when
condition `#if WIN32|WINNT` was met. Then the condition was replaced
with simpler PHP_WIN32 (which today implies also 64-bit platforms) and
WINDOWS is undefined in this file when targeting Windows platform.
Conditions otherwise also work on Windows anyway because of the
LDAP_API_VERSION check.
2024-06-07 23:27:22 +02:00
Peter Kokot
9f63836cf4
Remove redundant _WIN32 compile definitions (#14458)
_WIN32 is defined by all compilers on Windows when targeting 32-bit ARM,
64-bit ARM, x86, or x64. This removes redundant definition in ext/zip
and erroneous CFLAG_ENCHANT variable (should be CFLAGS_ENCHANT).
2024-06-07 22:59:30 +02:00
Peter Kokot
cfb739585f
Check ext/pcntl required functions with for loop (#14302)
This omits defining redundant HAVE_<function> symbols since these are
used unconditionally in ext/pcntl.

* HAVE_FORK is defined via ext/standard/config.m4
* HAVE_SIGACTION is defined via Zend.m4
* HAVE_WAITPID symbol is removed
2024-06-07 22:49:02 +02:00
Gina Peter Banyard
51379d66ec
Zend: Add object_init_with_constructor() API (#14440)
This will instantiate the object and execute its constructor with the given parameters.
2024-06-06 21:21:16 +01:00
Gina Peter Banyard
a580d4a1c3 main/php_ini.c: use size_t type instead of int
This does unnecessary conversions
2024-06-06 16:18:23 +01:00
Gina Peter Banyard
e54f564a0a ext/zend_test: Fix [-Wsign-compare] warnings 2024-06-06 16:18:23 +01:00
Gina Peter Banyard
2fa3e8094c ext/pcntl: Fix [-Wsign-compare] warnings 2024-06-06 16:18:23 +01:00
Gina Peter Banyard
672539870d ext/mbstring: Fix some [-Wsign-compare] warnings 2024-06-06 16:18:23 +01:00
Gina Peter Banyard
192fad713e ext/exif: Fix some [-Wsign-compare] warnings 2024-06-06 16:18:23 +01:00
Gina Peter Banyard
b8aa227016 ext/fileinfo: Fix [-Wsign-compare] warnings 2024-06-06 16:18:23 +01:00
Gina Peter Banyard
f52a332d5a ext/dom: Fix [-Wsign-compare] warnings 2024-06-06 16:18:23 +01:00
Gina Peter Banyard
bb2fae1ffc ext/curl: Fix [-Wsign-compare] warning 2024-06-06 16:18:23 +01:00
Gina Peter Banyard
b193b6eb5c ext/bzip: Fix [-Wsign-compare] warning 2024-06-06 16:18:23 +01:00
Gina Peter Banyard
3869a67468
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix bug GH-14456: Attempting to initialize class with private constructor calls destructor
2024-06-06 15:51:47 +01:00
Máté Kocsis
28cac9434d
Fix registration of readonly classes
Properties of readonly classes should be implicitly marked as readonly.
2024-06-06 09:58:23 +02:00
David Carlier
7b2ca071c5
ext/gd: imagewebp/imageavif/imagepng/imagejpeg stricter checks quality/speed.
close GH-14485
2024-06-05 23:07:57 +01:00
Dmitry Stogov
924e7fcb8a
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-14480: Method visibility issue introduced in version 8.3.8 (#14484)
2024-06-05 23:59:49 +03:00
Ayesh Karunaratne
c7366cf6a5
UPGRADING: move Opcache changes to the correct section (#14482)
[ci skip]

Signed-off-by: Ayesh Karunaratne <ayesh@aye.sh>
2024-06-05 20:31:32 +02:00
Eric Mann
8c6ee2ca67
Merge branch 'PHP-8.3' 2024-06-05 10:23:00 -07:00
Niels Dossche
0d913d0ee7
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix parameter numbers for imagecolorset()
  [skip ci] update NEWS
2024-06-05 18:05:45 +02:00
Giovanni Giacobbi
44cbdb107e
Fix parameter numbers and missing alpha check for imagecolorset()
The check for the alpha parameter existed in PHP 7.4 but was lost in PHP 8.0.

Fixes: 50765075db

Closes GH-14477.
2024-06-05 17:54:42 +02:00
Niels Dossche
a3b148e38d
Fix GH-14361: Deep recursion in zend_cfg.c causes segfault
Changes the CFG reachability algorithm to use iteration instead of
recursion.

Closes GH-14432.
2024-06-05 17:43:51 +02:00
Pierrick Charron
2a02d35c2a
Merge branch 'PHP-8.3' 2024-06-05 09:07:24 -04:00
Dmitry Stogov
2e86f6d6c0
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix undefined behavior (left shift of negative number)
2024-06-05 12:27:18 +03:00
Tim Düsterhus
7c2a4dbd72
Replace ZEND_ASSUME() by ZEND_ASSERT() in zend_hash_*_ptr setters (#14466)
I had a case where I was intentionally storing a `NULL` pointer within a
HashTable to mark an entry as “blocked”, without paying for the overhead of
checking the entry type when reading the pointer, resulting in semantics that
are similar to using `isset()` instead of `array_key_exists()` in userland.

This worked fine in unoptimized test builds, but due to the `ZEND_ASSUME()` in
the `zend_hash_find_ptr` functions, the optimized release builds turned the
logic of:

    my_pointer = zend_hash_find_ptr(ht, key);
    if (my_pointer == NULL) {
        return;
    }
    *my_pointer;

into

    zv = zend_hash_find(ht, key);
    if (zv) {
        *Z_PTR_P(zv);
    } else {
        return;
    }

thus introducing a hard-to-debug and compiler-dependent crash when the entry
exists, but the stored pointer is `NULL`.

Change the `ZEND_ASSUME()` in the setters to `ZEND_ASSERT()`. This would have
made my mistake immediately obvious in debug builds when storing the pointer.
The getters still use `ZEND_ASSUME()` under the assumption that they are called
much more often, reducing the impact on debug builds: Assuming the developer
uses the `_ptr` variants for both reading and writing the entries, the mistake
will be reliably caught during writing, making the assert during reading
unnecessary.

For release builds the `ZEND_ASSERT()` will be equivalent to `ZEND_ASSUME()`,
avoiding any performance impact for those.
2024-06-05 11:08:11 +02:00
Ben Ramsey
bda372fc6c
Merge branch 'PHP-8.3' 2024-06-05 01:11:59 -05:00
Niels Dossche
89c4e4c4cb
Fix GH-11188: Error when building TSRM in ARM64 (for IR JIT) (#14459)
This is GH-11236 for IR JIT.
2024-06-04 19:47:07 +02:00
Calvin Buckley
cb8a744b7a Merge branch 'PHP-8.3'
* PHP-8.3:
  [skip ci] update NEWS for GH-14457
  [skip ci] update NEWS for GH-14457
  Remove use of SDWORD and SWORD in ODBC extensions (GH-14457)
2024-06-04 12:51:06 -03:00
David CARLIER
bbbe56eecc
ext/sockets: using fast ZPP. (#14453) 2024-06-03 21:10:23 +01:00
Niels Dossche
259744148e
Cache pcre subpattern table (#14424)
Recreating this over and over is pointless, cache this as well.
Fixes GH-14423.
2024-06-03 21:15:26 +02:00
Niels Dossche
face2abd41
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-11188: Error when building TSRM in ARM64
2024-06-03 21:11:55 +02:00
Niels Dossche
315f2059b7
Remove dead check in pcre
This isn't reachable since ab32d36, because since then the library
itself checks this condition during compilation. The compilation failure
that results of it makes this code not reachable.

This is split off of GH-14424.
2024-06-03 19:58:22 +02:00
Peter Kokot
6a14730d20
Wrap aligning segments checks in AC_CACHE_CHECK (#14450)
This enables cross-compiling edge cases to override checks with
php_cv_have_common_page_size and php_cv_have_max_page_size cache
variables when target matches one of the conditions in case pattern.

Not done as link check yet due to Clang 9 bug and similar issues:
https://github.com/php/php-src/pull/5123
2024-06-03 15:22:15 +02:00
Peter Kokot
df481ef941
Simplify PDO include paths (#14444)
PDO include paths can be simplified and synced as done in other
extensions: either the project root directory or the phpincludedir (for
the system installation). The 'ext' include is automatically appended
when doing phpize build. In php-src it is only present on Windows build.
The PHP_CHECK_PDO_INCLUDES is left intact working as before and checks
if PDO headers are found.
2024-06-03 12:56:21 +02:00
Dmitry Stogov
802612bb54
Update IR
IR commit: 97555e12b525b825ab3b2f12bfdfd5cb6c00b2b4
2024-06-03 12:20:07 +03:00
Peter Kokot
bf845d563e
Use AC_SUBST for CONFIGURE_COMMAND and CONFIGURE_OPTIONS (#14445)
Instead of the PHP_SUBST_OLD, which also adds redundant variables to the
generated Makefile, these two can be done with AC_SUBST to be
substituted in the generated main/build-defs.h header and
scripts/php-config script.
2024-06-03 08:19:26 +02:00
Peter Kokot
6c034ee7e3
Wrap gdImageCreateFrom* checks in AC_CACHE_CHECK (#14443)
This enables cross-compiling edge cases to manually override the checks
with the php_cv_lib_gd_gdImageCreateFrom* cache variables.
2024-06-03 00:00:44 +01:00
Levi Morrison
07a1921a8c
refactor: use ZEND_PARSE_PARAMETERS_NONE() (#14442)
Prefer:

	ZEND_PARSE_PARAMETERS_NONE();

Over:

	if (zend_parse_parameters_none() == FAILURE) {
		RETURN_THROWS();
	}

It's shorter, more modern, and they do the same thing. Technically,
ZEND_PARSE_PARAMETERS_NONE doesn't check that there's an exception,
but it generates one, so it's still cohesive.
2024-06-02 23:58:24 +01:00
Peter Kokot
5afe41bdf3
Update ext/simplexml dependencies (#14446)
This syncs the configure time dependencies for ext/simplexml:
- ext/spl was once optional but since being always available,
  conditional usage was removed
- ext/libxml required
2024-06-02 23:37:50 +02:00
Peter Kokot
354b2636a5
Wrap iconv errno check in AC_CACHE_CHECK (#14438)
Cross-compiling in this case is passed but for the sake of consistency
this check is also cached to enable manual overriding with the
php_cv_iconv_errno cache variable.
2024-06-02 20:41:34 +02:00
Peter Kokot
75033c01c3
Wrap Zend stack limit check in AC_CACHE_CHECK (#14437)
The php_cv_have_stack_limit cache variable enables cross-compiling edge
cases to override the check manually.
2024-06-02 20:13:00 +02:00
Peter Kokot
ca55603d8a
Wrap ext/opcache AC_RUN_IFELSE checks in AC_CACHE_CHECK (#14436)
Cache variables php_cv_shm_ipc and php_cv_shm_mmap_anon enable manual
overriding of checks when cross-compiling.
2024-06-02 19:51:47 +02:00
Peter Kokot
028cfda994
Wrap clock_get_time check in AC_CACHE_CHECK (#14434)
The php_cv_func_clock_get_time cache variable enables cross-compiling
edge cases to manually override the AC_RUN_IFELSE check.
2024-06-02 19:02:12 +02:00
Gina Peter Banyard
d2a932b8af
Merge branch 'PHP-8.3'
* PHP-8.3:
  ext/standard: Fix test conflict with I/O tests
2024-06-02 17:03:57 +01:00
Peter Kokot
5b35740098
Sync #if/ifdef/defined for LIBXML_EXPAT_COMPAT (#14435)
This one can be undefined or defined to value 1.
2024-06-02 15:39:42 +02:00
David CARLIER
c8a8d8aba3
ext/intl last chunk of fast ZPP conversion (#14431) 2024-06-02 10:19:38 +01:00
David CARLIER
354b64720c
ext/intl: calendar/locale use fast ZPP. (#14425) 2024-06-02 08:47:08 +01:00
David CARLIER
9437c32cf4
ext/intl: common use fast ZPP (#14422) 2024-06-01 22:33:12 +01:00
David CARLIER
8c08b03e9b
ext/intl: odn, collator, msgformat using fast ZPP (#14421) 2024-06-01 22:25:00 +01:00
David CARLIER
c39bcaa225
ext/int: UChar using fast ZPP (#14420) 2024-06-01 21:50:07 +01:00
Peter Kokot
8112889a73
Wrap ttyname_r check in AC_CACHE_CHECK (#14417)
This enables cross-compiling to set the php_cv_func_ttyname_r variable
for adjusting the configuration manually.

In case of cross-compiling the AC_CHECK_FUNCS is additionally used to
guess whether the target has the ttyname_r. Current platforms mostly
either have working ttyname_r compatible with POSIX or not.
2024-06-01 22:42:22 +02:00
David CARLIER
bc6f3334d1
ext/intl: further fast ZPP usage. (#14419) 2024-06-01 20:48:55 +01:00
Niels Dossche
2f9de8b9e6
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix reference handling in SpoofChecker
2024-06-01 20:45:01 +02:00
David CARLIER
d005ab20ea
ext/intl converter and formatter using fast ZPP (#14413) 2024-06-01 19:36:40 +01:00
David CARLIER
694bb32119
ext/intl: timezone using fast ZPP and fixing SpoofChecker (#14415) 2024-06-01 19:16:03 +01:00
Peter Kokot
8b1bb91b3e
Sync build system #if/ifdef/defined (#14397)
These are either undefined or defined to value 1:
- HAVE_CRYPT
- HAVE_CRYPT_H
- HAVE_UNISTD_H

Follow up of GH-5526 (-Wundef)
2024-06-01 19:26:38 +02:00
Peter Kokot
ec50b178f1
Update ext/session spl dependency (#14410)
The spl dependency is configured so the spl_autoload_register is
available when session_start() is used, meaning the spl extension needs
to be loaded before the session. It is marked as optional to be more
explicit as spl is not directly used nor required in the session
extension.
2024-06-01 19:13:54 +02:00
David CARLIER
4fca8a6027
ext/intl: SpoofChecker using fast ZPP. (#14412) 2024-06-01 17:40:16 +01:00
Peter Kokot
dedf8fbffd
Add missing pcre dependency definition to zip extension (#14404)
The zip extension also requires the pcre extension.
2024-06-01 17:15:18 +01:00
Gina Peter Banyard
25a5146180
Clean-up unused headers (#14365)
* ext/mbstring.c: clean-up headers and include intrinsics
2024-06-01 17:12:42 +01:00
Gina Peter Banyard
c3b3e90cea
ext/odbc: Remove unused INI settings (#14399) 2024-06-01 17:06:34 +01:00
Peter Kokot
f69c55b5b6
Remove hash dependency from session extension (#14409)
The session extension once depended on the hash extension for having
hash functions available when using the `session.hash_function` INI
directive. This directive was removed in PHP-7.1 via
3467526a65. At the time it could be marked
as optional dependency, because it only needed to be loaded before the
session in that case.

The removed ext/hash/php_hash.h in the ext/session/php_session.h might
cause BC break for PHP extensions if they rely on transitive include and
use hash extension in the code without explicitly including the
ext/hash/php_hash.h header. Solution is to include the
ext/hash/php_hash.h separately.
2024-06-01 17:06:17 +01:00
Niels Dossche
ffe225d686
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix bug #76232: SoapClient Cookie Header Semicolon
2024-06-01 17:38:06 +02:00
Peter Kokot
cf469133a5
Fix ZEND_DEBUG condition (#14408)
ZEND_DEBUG is always defined by the build system automatically, either
to value 0 or value 1.
2024-06-01 16:07:48 +02:00
Niels Dossche
9f89ada76f
Struct-pack some soap datatypes (#14403)
While keeping data that belongs together close too.
2024-06-01 14:11:45 +02:00
David CARLIER
1e2306b4c6
ext/exif: moving few instances from memmove to memcpy. (#14400) 2024-06-01 13:05:49 +01:00
Niels Dossche
61191dc313
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix bug #69280: SoapClient classmap doesn't support fully qualified class name (#14398)
2024-06-01 13:32:58 +02:00
Niels Dossche
8dc2391bae
Fix bug #79701: getElementById does not correctly work with duplicate definitions
This is a long standing bug: IDs aren't properly tracked causing either
outdated or plain incorrect results from getElementById.

This PR implements a pragmatic solution in which we still try to use the
ID lookup table to a degree, but only as a performance boost not as a
"single source of truth". Full details are explained in the
getElementById code.

Closes GH-14349.
2024-06-01 12:55:05 +02:00
Bob Weinand
5fe799a4c6 Merge branch 'PHP-8.3' 2024-06-01 02:42:49 +02:00
Niels Dossche
37f683a70f Remove unused internal functions in soap 2024-05-31 23:05:33 +02:00
Niels Dossche
e8c6c6f15d Fix signedness issues in soap.c 2024-05-31 23:05:33 +02:00
Niels Dossche
ca7a0df35e Make some things const that can be const in soap 2024-05-31 23:05:33 +02:00
Niels Dossche
7834bd1a59 Fix parameter name warning 2024-05-31 23:05:33 +02:00
David CARLIER
47c41d4a0f
ext/sqlite: Sqlite3Stmt::bindParam/bindValue named parameters change. (#14393)
memmove seems unnecessary on `:` autoprepend.
2024-05-31 21:34:37 +01:00
Niels Dossche
62cdaac280
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix memory leaks with string function name lookups
2024-05-31 21:23:20 +02:00
Niels Dossche
59651ee722
Avoid string duplication in Soap function response (#14391) 2024-05-31 21:19:56 +02:00
Niels Dossche
e4246433fb
Fix signedness and argument order issues with argc handling in soap (#14389) 2024-05-31 21:16:21 +02:00
David Carlier
e69bccd7c7
ext/pgsql: adding pg_socket_poll.
Using PQSocketPoll to poll on a connection's socket.
Returns immediatly is there no event expected on read and write.
Other than that, it is a thin wrapper on top of poll, thus reflecting
 its return value.

close GH-14366
2024-05-31 20:10:49 +01:00
Niels Dossche
3096c71594
Fix build warning in release mode
This isn't warned on by default, and can break the build if werror is
used.
2024-05-31 19:56:30 +02:00
Joshua Rüsweg
e4a8d5b16f
RFC: array_find (#14108)
see https://wiki.php.net/rfc/array_find
2024-05-31 19:39:12 +02:00
Niels Dossche
a58c3a7eb1
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix reading zlib ini settings in ext-soap
  Fix memory leak if calling SoapServer::setClass() twice
  Fix memory leak if calling SoapServer::setObject() twice
  Fix missing error restore code in ext-soap (#14379)
  Fix GH-14368: Test failure in ext/session/tests/gh13856.phpt (#14378)
2024-05-31 18:27:22 +02:00
Peter Kokot
5e242fea66
Use AC_DEFINE_UNQUOTED where variables are present (#14377)
According to Autoconf docs and upstream code, AC_DEFINE_UNQUOTED must be
used where variables are present in the arguments.

Follow up of GH-13552
2024-05-30 21:50:46 +02:00
Niels Dossche
1fd40a6983
Merge branch 'PHP-8.3'
* PHP-8.3:
  Partially backport GH-13782 to stable branches
2024-05-30 21:02:14 +02:00
Máté Kocsis
6ec4220148
Amend PDO driver-specific class names (#14069)
As suggested in https://externals.io/message/123166
2024-05-30 20:15:42 +02:00
Gina Peter Banyard
ec54edb9e1
ext/bcmath: Use an enum for comparison result (#14374)
Improve logic of callers of bc_compare
2024-05-30 17:26:03 +01:00
Peter Kokot
cba3891d53
Join SQLite library setup M4 macros to PHP_SETUP_SQLITE (#14372)
Macro can simplify managing minimum version of SQLite library on less
places.
2024-05-30 18:16:30 +02:00
Arnaud Le Blanc
44c199ce6b
random: Make php_random_bytes() useable early during engine startup (#14291)
php_random_bytes() can now be used before RANDOM_G() is initialized
2024-05-30 17:24:34 +02:00
Gina Peter Banyard
c7bdf30daa
Merge branch 'PHP-8.3'
* PHP-8.3:
  ext/bcmath: Fixed bug (bcpowmod() with mod = -1 returns 1 when it must be 0)
2024-05-30 15:52:45 +01:00
Derick Rethans
99950bde3b
Merged pull request #14375 2024-05-30 15:06:20 +01:00
Derick Rethans
92d18b2bec
Fixed rounding error with new DateTime[Immutable]::createFromTimestamp method 2024-05-30 14:08:39 +01:00
Peter Kokot
471aa1141f
Refactor fopencookie check (#14346)
- This checks for a type cookie_io_functions_t and defines the
  HAVE_FOPENCOOKIE based on type check result and the fopencookie()
  function presence.
- Fixed -Wunused... warnings in config.log on stricter compiler
  configurations
- The run check for off64_t is wrapped into AC_CACHE_CHECK for having
  the php_cv_type_cookie_off64_t cache variable available to customize
  possible cross-compilation edge cases
- Comment about glibcs 2.1.2 removed because also some other earlier
  versions provided this type already
2024-05-30 14:56:47 +02:00
Gina Peter Banyard
cd44826c1a
[skip ci] Update UPGRADING after Intl refactoring 2024-05-30 13:02:44 +01:00
Gina Peter Banyard
33f1cf202e
ext/intl: Various refactoring (#14360)
* ext/intl: Small extension cleanup

* ext/intl: Normalize cloning error handling behaviour

Always throw a Error exception as we cannot progress from here

* ext/intl: idn.c use ValueErrors where appropriate

Drive-by refactoring

* ext/intl: Remove some unused headers

Probably more cleanup can be done
2024-05-30 12:51:36 +01:00
Arnaud Le Blanc
1ab4520c30
Add zend_atomic_int (#14242)
Extend the zend_atomic API for ints. Also add `zend_atomic_*_compare_exchange()`, `ZEND_ATOMIC_*_INITIALIZER()`.
2024-05-30 12:53:44 +02:00
Peter Kokot
d8da8d88e0
Remove obsolete Makefile .NOEXPORT target (#13734)
This was once used on GNU Make from versions 3.59 to 3.63 (released in
1994) to not export all variables, otherwise a system limit may be
exceeded. This was the case for the obsolete UNIX System V (SysV) and is
on current systems not applicable anymore, with such target ignored.
2024-05-30 12:41:12 +02:00
Máté Kocsis
c08535c804
Fix regex for searching for constant lists
0242577b33 partly fixed the detection of external constant lists referenced on Predefined Constants pages, but changing the file search regex is needed too in order to fully fix the underlying issue in case of cURL constants.
2024-05-30 09:46:56 +02:00
Peter Kokot
de0415e705
Remove PROG_SENDMAIL from Makefile (#14355)
PROG_SENDMAIL is not used in the generated Makefile. For the
main/build-defs.h it is substituted automatically with AC_PATH_PROG.
2024-05-30 00:53:07 +02:00
Máté Kocsis
0242577b33
Also check constants in referenced constant lists
Some constants are extracted from Predefined Constants pages (e.g. https://github.com/php/doc-en/pull/3413), which should alsobe checked when verifying the manual.
2024-05-29 23:50:46 +02:00
Niels Dossche
c7797fc8c0
Fix bug GH-11941: soap with session persistence will silently fails when "seession" built as a shared object (#14362)
This adds an optional dependency on the session extension and adds the
necessary APIs to make the functionality work with lazy binding.

This can be tested by configuring PHP with `--enable-session=shared` and
`--enable-soap=shared` and running the test suite, in particular the
buggy behaviour can be observed by the existing test `server009.phpt`.
2024-05-29 19:51:49 +02:00
Niels Dossche
5db05955c8
Move more common code into php_dom_next_in_tree_order() (#14363) 2024-05-29 19:50:41 +02:00
Tim Düsterhus
8a87206211
reflection: Add ReflectionGenerator::isClosed() (#14358)
* reflection: Add `ReflectionGenerator::isClosed()`

see https://github.com/php/php-src/pull/14167#issuecomment-2133641998

* Fix test expectation

* Drop `{{{` / `}}}` comments around `ReflectionGenerator::isClosed()`
2024-05-29 19:07:09 +02:00
Niels Dossche
f90a32c9bf
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix build
2024-05-29 18:50:13 +02:00
Niels Dossche
acfa564e72
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix bug #47925 again (#14348)
  Fix GH-14343: Memory leak in xml and dom (#14347)
2024-05-29 17:52:00 +02:00
Niels Dossche
e6abca4d24
Use helper macro in ext/exif (#14352) 2024-05-29 17:48:43 +02:00
Máté Kocsis
0f64901316
Document stubs (#13677)
Co-authored-by: Derick Rethans <github@derickrethans.nl>
2024-05-29 14:18:22 +02:00
Ilija Tovilo
9771302e29
Merge branch 'PHP-8.3'
* PHP-8.3:
  Attempt to fix mysql_native_password error for 32-bit build
2024-05-29 12:49:51 +02:00
Gina Peter Banyard
48d5ae98e7
ext/standard: Refactor exec.c public APIs to use zend_string pointers (#14353)
* Pull zend_string* from INI directive

* Ensure that mail.force_extra_parameters INI directive does not have any nul bytes

* ext/standard: Make php_escape_shell_cmd() take a zend_string* instead of char*

This saves on an expensive strlen() computation

* Convert E_ERROR to ValueError in php_escape_shell_cmd()

* ext/standard: Make php_escape_shell_arg() take a zend_string* instead of char*

This saves on an expensive strlen() computation

* Convert E_ERROR to ValueError in php_escape_shell_arg()
2024-05-29 10:59:17 +01:00
Ilija Tovilo
06fcf3c029
Merge branch 'PHP-8.3'
* PHP-8.3:
  Re-add 32-bit push build
2024-05-29 11:50:45 +02:00
Peter Kokot
e45d2d6046
Sync HAVE_BUNDLED_PCRE #if/ifdef/defined (#14354)
Follow up of GH-5526 (-Wundef)
2024-05-29 07:53:36 +02:00
Peter Kokot
cb2c5de3db
Add PHP_SBINDIR (#13363)
The PHP_SBINDIR symbol was defined on *nix systems but never used. This
adds the constant similar to PHP_BINDIR also to PHP. On Windows it is
the value of prefix configuration when PHP was built (same value as
PHP_BINDIR).
2024-05-29 07:04:05 +02:00
Niels Dossche
7278364f9c
Remove useless RETURN_NULLs() (#14350)
These functions are void, their use of RETURN_NULL() was mildly
confusing.
2024-05-28 22:59:37 +02:00
Peter Kokot
1d0cdd1b41
Remove unused ext/fileinfo/libmagic/elfclass.h file (#14344)
Usage was removed via 919abf0cb1 due to
redundand code in php-src. This also updates the appended libmagic patch
file.
2024-05-28 21:43:38 +02:00
Máté Kocsis
cf004ed47e
Fix implicitly nullable type detection in stubs 2024-05-28 21:06:00 +02:00
Máté Kocsis
661c5ee546
Fix implicitly nullable parameter type for pg_put_copy_end() 2024-05-28 20:11:01 +02:00
David Carlier
162a311cc8
ext/pgsql: adding pg_put_copy_data/pg_put_copy_end.
pg_put_copy_data allows to send COPY commands to the server.
pg_put_copy_end signals the end of the n commands.

Both return 3 states ; 1, 0 and -1 when 1 is success, 0 the buffer queue
is full then -1 for errors.

Close GH-14325
2024-05-28 18:35:40 +01:00
Arnaud Le Blanc
cc6d9523d9
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix TLS access in JIT on FreeBSD/amd64
2024-05-28 15:45:45 +02:00
Arnaud Le Blanc
7c5d6557e1
Merge branch 'PHP-8.3'
* PHP-8.3:
  Use ITIMER_REAL for timeout handling on MacOS / Apple Silicon system
2024-05-28 15:27:32 +02:00
Peter Kokot
2d66562e4b
Sync HAVE_IPV6 and HAVE_GETADDRINFO in #if/ifdef/defined (#14341)
Follow up of GH-5526 (-Wundef)
2024-05-28 11:52:25 +02:00
Dmitry Stogov
5109cf1010
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix incorrect conditions
2024-05-28 08:38:00 +03:00
Valentin Udaltsov
b6b16a1758
[RFC] Implement dereferencable for new exprs with constructor args
https://wiki.php.net/rfc/new_without_parentheses

Closes GH-13029
2024-05-28 00:23:12 +02:00
Máté Kocsis
cc477ff3bb
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix gen_stub.php errors (#14335)
2024-05-27 22:49:59 +02:00
Valentin Udaltsov
be19e7954d
Fix gen_stub.php errors (#14335) 2024-05-27 22:11:23 +02:00
Peter Kokot
329f015c91
Sync HAVE_ENCHANT_BROKER_SET_PARAM definitions (#14340)
This defines the HAVE_ENCHANT_BROKER_SET_PARAM to 1 or doesn't define it
so it can be used in a similar way between platforms. It is only defined
for Enchant versions 1.5.0 to 2.x. Previously on Windows it was defined
to 0 if not found.
2024-05-27 21:59:44 +02:00
Niels Dossche
8896bd3200
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix bug #47925: PHPClient can't decompress response (transposed uncompress methods?)
2024-05-27 19:24:18 +02:00
Niels Dossche
a70fd5386b
Move regression tests of SOAP to bugs directory (#14322)
There's a bugs directory but it wasn't always used, move the regression
tests to this directory.
2024-05-27 19:21:35 +02:00
Peter Kokot
4f311f86cc
Remove redundant ext/spl/spl_exceptions.h include (#14337) 2024-05-27 15:40:07 +02:00
Manuel Mausz
5f2a0c8383
Add support for Curve25519 + Curve448 based keys
For openssl_pkey_get_details we export the priv+pub parameters.

ED25519/ED448 do not support streaming, so we need to use
EVP_Digest{Sign,Verify} instead. In general the older EVP_{Sign,Verify}
interface should be avoided as the key is passed very late.
See BUGS section in OpenSSL manpages of EVP_{Sign,Verify}Final

Additionally per requirement we need to allow sign/verify without
digest. So we need to allow passing 0 as digest. In OpenSSL 3.0+ this also
corresponds to the default digest (see EVP_PKEY_get_default_digest_name).

For CSR creation we need to allow "null" as digest_alg option.

Closes GH-14052
2024-05-27 12:52:57 +01:00
Peter Kokot
6e1d20c86f
Wrap sched_getcpu AC_RUN_IFELSE check in AC_CACHE_CHECK (#14336)
For cross-compiling configuration, this wraps the check with the
php_cv_func_sched_getcpu variable.
2024-05-27 13:40:18 +02:00
Tim Düsterhus
8cf8751533
random: Remove internal aliases for the global Mt19937 functionality (#14314)
* random: Remove `php_rand()`

This effectively is just a slim wrapper around `(zend_long)php_mt_rand()`. It
is not compatible between 32-bit and 64-bit builds of PHP, due to the use of
`zend_long`, which may result in negative integersbeing returned on 32-bit
platforms, whereas 64-bit platforms will be compatible with `php_mt_rand()`. An
example would be the `0` seed, which emits 2357136044 on 64-bit platforms and
-1937831252 on 32-bit platforms.

Users of `php_rand()` should ideally migrate to one of the more modern engines,
with extension-specific state. If drop-in compatibility is desired, they can
just cast the result of `php_mt_rand()`. But providing it out of the box does
not provide a value-add and is potentially dangerous.

* random: Remove `php_srand()`

With `php_rand()` gone, preserving its companion `php_srand()` is just
confusing. The same recommendations apply: Migrate to a modern engine if
possible and just call `php_mt_srand()` with an appropriately casted input.

* random: Remove `PHP_RAND_MAX` and `RAND_MAX`

These are the companions to `php_rand()`, which was removed in a previous
commit.

Generally speaking the maximum returnable value is not particularly useful
anyways. Attempting it to create a random float by dividing the returned
integer by the maximum value would result in a bias if the maximum value would
be larger than 2**53 and even for that case, the various `range()` helpers
allow to easily retrieve a uniformly distributed integer from a suitable range.

* UPGRADING.INTERNALS
2024-05-27 08:12:13 +02:00
Peter Kokot
d4839b96c2
Remove outdated comment
Comment referred to the headers installation step when the
PHP_INSTALL_HEADERS wasn't yet available:
9e9f413aeb
2024-05-27 06:52:00 +02:00
Peter Kokot
8be3426a7f
Add missing ext/libxml dependency to ext/xmlwriter (#14327)
This adds the libxml extension to required dependencies for xmlwriter
during the configuration phase (PHP_ADD_EXTENSION_DEP) and the runtime
(ZEND_MOD_REQUIRED).

The libxml is technically not a required extension in this case but
it necessary to make it work properly (i.e. have proper error
reporting, etc.). Added due to prior libxml requirement in
documentation and build system.
2024-05-26 19:27:55 +02:00
Niels Dossche
36a58b35f2
Use a ROL for mangling the pointer key in namespace_compat.c (#14331)
This might be a safer than throwing the lower bits away.
2024-05-26 17:31:40 +02:00
Niels Dossche
a356d1c0e9
Update OOM error for DOMImplementation::createDocumentType (#14329)
Most of these kinds of error handling were already changed previously,
but this one was apparently missed.
2024-05-26 17:31:27 +02:00
Niels Dossche
ab80392710
Cleanup DOM exception throwing parameters (#14330) 2024-05-26 14:01:37 +02:00
Peter Kokot
1b78121928
Fix tempnam() path in test when running from out-of-source (#14326)
This fixes test when running the test from unusual paths such as in
out-of-source builds:

```sh
mkdir php-build
cd php-build
../buildconf
../configure
make
./sapi/cli/php ../run-tests.php ../ext/standard/tests/file/002.phpt
```
2024-05-25 23:08:40 +02:00
Jorg Adam Sowa
8a24e31bef
Fixed undefined flags in base64 (#14316) 2024-05-25 14:54:44 +02:00
Peter Kokot
f6b217a2e2
Merge branch 'PHP-8.3'
* PHP-8.3:
  [skip ci] Update NEWS
2024-05-25 14:48:37 +02:00
haszi
9864d91ea6
Fix typo in LDAP stub (#14313)
Co-authored-by: haszi <haszika80@gmail.com>
2024-05-25 13:31:54 +02:00
David Carlier
e2fe2ee3ab
Merge branch 'PHP-8.3' 2024-05-24 23:35:21 +01:00
Niels Dossche
3165456980
Include HRESULT error code if native .NET initialization fails (#14317)
This is a local patch I used to figure out why it didn't work on my
machine. Without the error codes: good luck to figure out what's wrong.
2024-05-25 00:20:07 +02:00
Levi Morrison
c461b60060
refactor: change zend_is_true to return bool (#14301)
Previously this returned `int`. Many functions actually take advantage
of the fact this returns exactly 0 or 1. For instance,
`main/streams/xp_socket.c` does:

    sockopts |= STREAM_SOCKOP_IPV6_V6ONLY_ENABLED * zend_is_true(tmpzval);

And `Zend/zend_compile.c` does:

    child = &ast->child[2 - zend_is_true(zend_ast_get_zval(ast->child[0]))];

I changed a few places trivially from `int` to `bool`, but there are
still many places such as the object handlers which return `int` that
should eventually be `bool`.
2024-05-24 15:16:36 -06:00
Peter Kokot
2ab114ebff
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix incompatible pointer type warnings
2024-05-24 21:01:06 +02:00
Ilija Tovilo
547cbf079f
Merge branch 'PHP-8.3'
* PHP-8.3:
  [skip ci] Add missing conflicts for dba test
2024-05-24 14:48:51 +02:00
Niels Dossche
9ad17791c6
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-14307: Test curl_basic_024 fails with curl 8.8.0
2024-05-24 14:42:50 +02:00
Tim Düsterhus
c8ef40af7e
[ci skip] Add missing trailing dots in NEWS
These are required for the NEWS parser to correctly strip the author name.
2024-05-23 23:16:40 +02:00
Tim Düsterhus
6c59c29942
random: Add missing PHPAPI to php_random_generate_fallback_seed() in random.c
The declaration in the header had it.
2024-05-23 23:12:29 +02:00
Niels Dossche
8faaf3faac
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix memory leaks in ext/sodium on failure of some functions
2024-05-23 22:41:03 +02:00
Niels Dossche
4e99bb5935 Faster BCD into integer parsing 2024-05-23 22:38:21 +02:00
Niels Dossche
04a34c3433 Faster writing of BCD representation 2024-05-23 22:38:21 +02:00
Niels Dossche
aef0eada16 Use size_t for length 2024-05-23 22:38:21 +02:00
Dmitry Stogov
58c281a6cf
JIT: Add CPU registers support for ASSIGN_OBJ and ASSIGN_OBJ_OP (#14303)
* JIT: Add CPU registers support for ASSIGN_OBJ and ASSIGN_OBJ_OP

* Fix tests failures

* Fix tests failures

* Add missing GUARD
2024-05-23 19:25:06 +03:00
Ilija Tovilo
706e9ed058
Merge branch 'PHP-8.3'
* PHP-8.3:
  Skip JIT test if php is compiled without jit
2024-05-23 16:35:58 +02:00
Dmitry Stogov
93c20de2f0
Update IR
IR commit: e87914bda3939072bf1e470e923599d73063d9f1
2024-05-23 09:40:35 +03:00
Saki Takamachi
8734a9a4af
ext/bcmath: Prevent overflow of uint32_t/uint64_t (#14297)
If add more than a certain number of times, it will overflow, so need to adjust
the digits before adding.
2024-05-23 06:13:11 +09:00
David Carlier
fe7f699c0a
ext/pcntl: adding SIGTRAP handling for freebsd.
if a restricted file descriptor based syscall by the system had been attempted,
a SIGTRAP is raised with the syscall id.

close GH-14266
2024-05-22 18:40:58 +01:00
Dmitry Stogov
ace18f4919
JIT: Avoid IS_UNDEF check for ZEND_FETCH_DIM/OBJ_IS with a result type guard (#14298) 2024-05-22 17:33:40 +03:00
Ilija Tovilo
2c91b7364b
Also use zval_get_double for op1 in pow comp time check
Mostly for consistency, but this will also allow evaluating more expressions at
compile time.
2024-05-22 16:30:03 +02:00
Ilija Tovilo
69e2ef694e
[skip ci] Add news entry 2024-05-22 16:27:16 +02:00
Jorg Sowa
23afe57f01
Added deprecation Division by zero when using power with zero as base and negative exponent
RFC: https://wiki.php.net/rfc/raising_zero_to_power_of_negative_number

Closes GH-13128
2024-05-22 15:05:47 +02:00
Ilija Tovilo
92b9543ca9
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix enabling of JIT at runtime
2024-05-22 14:33:33 +02:00
Guillaume Outters
c265b9085a
ext/pdo_pgsql: adding pgsqlSetNoticeCallback
Allows a callback to be triggered on every notice sent by PostgreSQL.

Such notices can be sent with a RAISE NOTICE in PL/pgSQL; in a long running
stored procedure, they prove useful as realtime checkpoint indicators.

close GH-6764
2024-05-22 12:32:11 +01:00
Arnaud Le Blanc
182fee1447
Fix removal of optimization cflags in debug builds (#9647)
Discard known '-O' flags, including just '-O', but do not remove only '-O' in '-Ounknown'
2024-05-22 13:22:34 +02:00
Jorg Adam Sowa
c4d9a37e81
Typed constants in date extension (#12361) 2024-05-22 13:17:44 +02:00
Ilija Tovilo
d19fad143b
Merge branch 'PHP-8.3'
* PHP-8.3:
  [skip ci] Adjust CODEOWNERS
2024-05-22 13:17:14 +02:00
Cristian Rodríguez
8e62e2b829
Mark multple functions as static (#13864)
* Mark many functions as static

Multiple functions are missing the static qualifier.

* remove unused struct sigactions

struct sigaction act, old_term, old_quit, old_int;
all unused.

* optimizer: minXOR and maxXOR are unused
2024-05-22 13:11:46 +02:00
Derick Rethans
46540a0cef
Merge branch 'ext-date-zpp' 2024-05-22 10:41:15 +01:00
Derick Rethans
bc9a113a07
Add further ZPP conversions 2024-05-22 10:40:49 +01:00
Max Semenik
6f5ffc2915
ext/date: convert remaining uses of zend_parse_parameters() 2024-05-22 10:40:49 +01:00
Niels Dossche
e16bc4b28e
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-14290: Member access within null pointer in extension spl
2024-05-21 23:24:28 +02:00
Peter Kokot
02f3df177d
Add missing ext/libxml dependency to ext/soap (#14285)
This adds the libxml extension to required dependencies for ext/soap
during the configuration phase (PHP_ADD_EXTENSION_DEP) and the runtime
(ZEND_MOD_REQUIRED).
2024-05-21 21:55:02 +02:00
Pierrick Charron
af4d6765b8
Merge branch 'PHP-8.3'
* PHP-8.3:
  PHP-8.2 is now for PHP 8.2.21-dev
2024-05-21 14:33:26 -04:00
Eric Mann
3b0d137a4f
Merge branch 'PHP-8.3' 2024-05-21 07:56:35 -07:00
Peter Kokot
0927651593
Simplify required functions checks in ext/pcntl (#14288) 2024-05-21 14:53:52 +02:00
Gina Peter Banyard
07a48517ac
Merge branch 'PHP-8.3'
* PHP-8.3:
  ext/readline: Fix [-Wcalloc-transposed-args] compiler warning
  ext/pdo_mysql: Fix [-Wcalloc-transposed-args] compiler warning
  ext/gd: Fix [-Wcalloc-transposed-args] compiler warning
  ext/ffi: Fix [-Wenum-int-mismatch] compiler warning
  ext/bcmath: Fix [-Wenum-int-mismatch] compiler warning
2024-05-21 12:23:45 +01:00
Dmitry Stogov
896517e24f
JIT: Fix missing register store
Fixes master_COMMUNITY_asan "nightly" failure introduced by 13d5c812e0
2024-05-21 14:11:26 +03:00
divinity76
dabafc7b8e
bool "must" be used instead. (#14287) 2024-05-21 13:10:44 +02:00
Ilija Tovilo
62ebe822de
Separate internal and user function extension handles
This allows us to skip zend_init_internal_run_time_cache() when opcache is
enabled. This function can be quite expensive.

Closes GH-14252
2024-05-21 11:56:38 +02:00
Tim Düsterhus
8094bd1b58
Make ReflectionGenerator::getFunction() legal after generator termination (#14167)
* Make `ReflectionGenerator::getFunction()` legal after generator termination

* Expose the generator function name via `Generator::__debugInfo()`

* Allow creating `ReflectionGenerator` after termination

* Reorder `struct _zend_generator` to avoid a hole

* Adjust `ext/reflection/tests/028.phpt`

This is legal now.

* Fix Generator Closure collection

* Add test to verify the Closure dies with the generator

* NEWS / UPGRADING
2024-05-21 08:54:51 +02:00
Niels Dossche
14b92d5181
Add a test for previously-uncovered error condition in C14N (#14283) 2024-05-20 23:55:01 +02:00
Niels Dossche
dbbd01235d
Merge branch 'PHP-8.3'
* PHP-8.3:
  Skip .NET tests if mscoree is not available (#14281)
2024-05-20 23:28:02 +02:00
Ilija Tovilo
6335264c07
Fix header errors when parsed standalone (#14272)
This is annoying for multiple reasons:

1. LSPs can show many errors for these files.
2. LSP can stop parsing these files completely if there are too many errors,
   resulting in spotty LSP features.
2024-05-20 22:30:38 +02:00
Máté Kocsis
78f72cffa4
Add support for generating parameter attributes for the manual (#14270) 2024-05-20 21:03:19 +02:00
Peter Kokot
08e2c6fb7b
Fix fuzzer result message in configure log (#14278)
The 2nd argument of PHP_ARG_ENABLE can be a check message to avoid
manual AC_MSG_* calls.
2024-05-20 20:46:09 +02:00
Niels Dossche
90e0ce7f0d
Throw early when a non-stream-context resource is passed to libxml_set_streams_context() (#14279) 2024-05-20 16:56:38 +02:00
Derick Rethans
412a3954b4
Merge branch 'PHP-8.3' 2024-05-20 15:51:19 +01:00
Niels Dossche
230ab078d1
Avoid code duplication for error instance creation in ext/libxml (#14277) 2024-05-20 16:18:32 +02:00
Peter Kokot
ca3444b1d8
Emit error when building fuzzer with ZTS (#14273)
Thread safety (--enable-zts) is not supported when building fuzzer
(--enable-fuzzer).

Fixes GH-14243
2024-05-20 15:31:33 +02:00
Niels Dossche
b7bf846f72
Fix bug #81227: PDO::inTransaction reports false when in transaction (#14268) 2024-05-20 13:59:26 +02:00
David Carlier
9aa3a0d702
ext/pgsql: adding pg_change_password functionality.
handy call to change an user password while taking care transparently
of the password's encryption.

close GH-14262
2024-05-20 12:57:37 +01:00
Saki Takamachi
1d38656b6d
ext/bcmath: Changed the bcmul calculation method (#14213)
Multiplication is performed after converting to uint32_t/uint64_t, making calculations faster.

---------

Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
Co-authored-by: Gina Peter Banyard <girgias@php.net>
2024-05-20 20:29:19 +09:00
Peter Kokot
39b48f8473
Add -Wno-type-limits and -Wno-logical-op only on 32-bit (#14271)
For ext/sodium these two flags can be added conditionally only for the
32-bit target architecture.
2024-05-20 12:31:07 +02:00
武田 憲太郎
b7dd3d8347
ext/pdo_pgsql: Retrieve the memory usage of the query result resource (#14260)
`getAttribute()` can now retrieve the memory usage of query results.
`PDO::PGSQL_ATTR_RESULT_MEMORY_SIZE` was added for this feature.

closes #14260
2024-05-20 09:08:54 +09:00
Niels Dossche
ba534e70e6
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix undefined behaviour in fastcgi.c (#14269)
2024-05-19 22:57:08 +02:00
Máté Kocsis
8de92952dd
Add cast_object handler for objects which were recently converted from resources 2024-05-19 21:41:07 +02:00
Dmitry Stogov
13d5c812e0
JIT: Add CPU registers support for FETCH_OBJ_R (#14253) 2024-05-19 22:18:30 +03:00
Peter Kokot
bc09cd2bc8
Fix the aligned variable attribute check (#14211)
By default compilers may not treat attribute warnings as errors when
encountering an unknown __attribute__, unless some error option is
provided (-Werror=attributes, -Werror=unknown-attributes, -Werror...).
This fixes the check and wraps it into a separate M4 macro to be
extendable in the future if needed. It checks if conftest.err file was
generated by the compilation check when warnings appear. Also, PHP check
is a bit customized by using __alignof__ keyword, so it is left in there
for now to not break existing checks.
2024-05-19 12:18:59 +02:00
Peter Kokot
52767343b2
Reduce unused variable warnings in config.log (#14264)
This reduces -Wunused-variable and -Wunused-but-set-variable warnings
generated in the Autoconf's config.log to comply with possible stricter
default compiler configuration on the system to avoid having false
results.
2024-05-18 18:28:20 +02:00
Niels Dossche
20fafa7524
Remove XML_GLOBAL_NAMESPACE (#14265)
This constant is only available if it is defined by libxml2, but it is
never defined because the minimum version of libxml2 that we support had
removed XML_GLOBAL_NAMESPACE already.
2024-05-18 16:24:08 +02:00
Peter Kokot
09d0e38ecf
Remove unsynced and unused HAVE_<extension> defines (#14233)
This syncs build system gaps of some extensions' definitions being
defined on Windows and some on *nix. These are not used anywhere and are
only defined in some build system and not the other:

* HAVE_INTL (was present only on Windows)
* HAVE_PDO_DBLIB (was present only on Autotools)
* HAVE_PDO_FIREBIRD (was present only on Autotools)
* HAVE_TOKENIZER (was present only on Windows)
2024-05-18 14:10:47 +02:00
KentarouTakeda
dde5c65bfd
ext/pdo_pgsql: fix typo (#14263) 2024-05-18 19:29:26 +09:00
Saki Takamachi
22c7250d50
ext/bcmath: Avoid unnecessary memset from _bc_do_add (#14257)
Apply the same changes as #14180 to _bc_do_add.
2024-05-18 07:00:47 +09:00
Máté Kocsis
f093015a6c
Fix class constant and property ID generation for the manual (#14249)
Related to https://github.com/php/doc-en/pull/3367
2024-05-17 20:30:16 +02:00
Tim Düsterhus
c2a9166ef0
Merge branch 'PHP-8.3'
* PHP-8.3:
  Make the `fcc` parameter `const` in `zend_call_known_fcc` (#14259)
2024-05-17 16:14:45 +02:00
Kamil Tekiela
73abf4fe93
Merge branch 'PHP-8.3'
* PHP-8.3:
  Clear mysql error in fetch_into
2024-05-17 13:16:59 +02:00
Peter Kokot
b5b9c13c3d
Add missing MYSQLND_SHARED_LIBADD substitution (#14228)
This is used in Makefile when building mysqlnd as shared to get zlib and
crypto libraries linked in the mysqlnd.so (-lz -lcrypto). For static
build these are in the resulting binary like before.
2024-05-17 12:21:11 +02:00
Máté Kocsis
2097237da5
Migrate ext/dba resources to objects (#14239)
Related to https://wiki.php.net/rfc/resource_to_object_conversion and https://github.com/php/php-tasks/issues/6
2024-05-17 08:43:33 +02:00
Saki Takamachi
959ea5fb83
Avoid unnecessary memset (#14180)
Avoid unnecessary memset from `_bc_do_sub`
2024-05-17 08:03:34 +09:00
Tim Düsterhus
4988816126
Use zend_call_known_function() to call #[\SensitiveParameter]’s constructor (#14254)
`zend_call_method_with_1_params()` causes needless overhead, due to the
capability of looking up the function by name. It’s also very rarely used (only
in ext/spl).

`zend_call_known_function()` is the standard methodology to call a known
function and going through `Z_OBJCE_P()` avoids the repeated hardcoding of the
CE name.
2024-05-16 23:23:55 +02:00
Niels Dossche
596fdada15
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix nightly test failure (#14251)
2024-05-16 20:01:48 +02:00
Peter Kokot
2a23c91ad5
Remove unused HAVE_PDO_SQLITELIB symbol (#14232)
Symbol isn't defined on Windows and is redundant since the SQLite
library is required for ext/pdo_sqlite and isn't bundled in php-src
anymore.
2024-05-16 15:21:20 +02:00
Ilija Tovilo
600d591cae
Omit FETCH_THIS in closures
Non-static closures are guaranteed to have $this. The existing comment
highlights this, but fails to handle it correctly.

Closes GH-14181
2024-05-16 12:28:11 +02:00
Dmitry Stogov
5e7baaaad1
JIT: Remove old restriction. FETCH_DIM_R supports regs for indexes.
This affects only function JIT.
2024-05-16 12:02:03 +03:00
David CARLIER
4ed1835f00
ext/pcntl: cpu affinity support for solaris/illumos. (#14199) 2024-05-15 19:43:27 +01:00
David CARLIER
0218af87f2
ext/pgsql: using fast ZPP api for calls. (#14099) 2024-05-15 19:32:02 +01:00
Dmitry Stogov
7843e72f3b
JIT: Avoid useless EG(exception) check in ASSIGN_DIM_OP (#14247) 2024-05-15 21:31:44 +03:00
Niels Dossche
be4d70537e
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-14100: Corrected spelling mistake in php.ini files.
2024-05-15 19:48:11 +02:00
Peter Kokot
c1d71cfeea
Remove forgotten obsolete session INI directives (#14238)
The session.hash_function and session.hash_bits_per_character INI
directives have been removed in PHP 7.1:
3467526a65
2024-05-15 17:01:15 +02:00
Dmitry Stogov
5ef1824ebc
JIT: Improve x86_64 code generated for PHP Array Bounds Checks (#14246) 2024-05-15 16:38:23 +03:00
Dmitry Stogov
0eb68eb8d8
JIT: Fix incorrect deoptimization info
Fixes third recently introduced failure in "Nightly" "master_COMMUNUTY_asan" job
2024-05-15 14:22:20 +03:00
Dmitry Stogov
273c2de6a7
JIT: Fix incorrect PHP register allocation
Fixes 2 of 3 recently introduced failures in "Nightly"
"master_COMMUNUTY_asan" job
2024-05-15 12:46:58 +03:00
Máté Kocsis
43ac009c87
Add prefix for ext/odbc persistent resource hash
In order to make sure that it doesn't accidentally clash with other resource types
2024-05-15 09:17:13 +02:00
Dmitry Stogov
446ff6a742
JIT: Implement CPU register usage for ASSIGN_DIM_OP (#14236) 2024-05-14 23:35:31 +03:00
Dmitry Stogov
4a91c8a1be
JIT: Implement CPU register usage for ASSIGN_OP (#14235) 2024-05-14 22:54:00 +03:00
Niels Dossche
889f308e01
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-14215: Cannot use FFI::load on CRLF header file with apache2handler
2024-05-14 19:56:05 +02:00
Dmitry Stogov
c8920aaf94
JIT: JIT: Implement CPU register usage for ISSET_ISEMPTY_DIM (#14227) 2024-05-14 14:05:04 +03:00
Dmitry Stogov
64f4aca6ba
IT: Implement CPU register usage for FETCH_DIM_W (#14225) 2024-05-14 13:19:56 +03:00
Dmitry Stogov
bf7d4d7eb2
JIT: Implement CPU register usage for ASSIGN_DIM (#14224) 2024-05-14 12:10:28 +03:00
Tim Düsterhus
c90c4fe553
Add zend_get_attribute_object() (#14161)
* Add `zend_get_attribute_object()`

This makes the implementation for `ReflectionAttribute::newInstance()`
reusable.

* Add test for the stack trace behavior of ReflectionAttribute::newInstance()

This test ensures that the `filename` parameter for the fake stack frame is
functional. Without it, the stack trace would show `[internal function]` for
frame `#0`.

* Fix return type of `call_attribute_constructor`
2024-05-14 08:39:43 +02:00
Dmitry Stogov
89305574b2
JIT: Improve CPU register usage in FETCH_DIM_R, FETCH_DIM_IS and FETCH_LIST_R (#14222) 2024-05-14 01:12:01 +03:00
武田 憲太郎
77fa4c0fce
ext/pgsql: add pg_result_memory_size
Close GH-14214
2024-05-13 22:58:02 +01:00
Peter Kokot
44ed17cab5
Replace configure option --with-openssl-dir (#14028)
This is a leftover from the refactoring of the --with-openssl-dir option
that once accepted the path to OpenSSL but wasn't renamed back then.

Instead of --with-openssl-dir, SSL support in ext/ftp and ext/mysqlnd
can be enabled implicitly when building with ext/openssl enabled
(--with-openssl) or explicitly by using new separate configure options
--with-ftp-ssl and --with-mysqlnd-ssl.
2024-05-13 22:54:54 +02:00
Niels Dossche
f20707491e
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix Windows SKIPIF (#14219)
2024-05-13 22:10:53 +02:00
Niels Dossche
a95d001a8a
Change calls to setmode to _setmode (#14220)
setmode is the deprecated alias of _setmode [1].

[1] https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/posix-setmode?view=msvc-170
2024-05-13 22:08:24 +02:00
Peter Kokot
173f51365d
Update AX_CHECK_COMPILE_FLAG to serial 7 (#14217)
This syncs the file with upstream:
https://github.com/autoconf-archive/autoconf-archive/blob/master/m4/ax_check_compile_flag.m4
2024-05-13 21:15:20 +02:00
Niels Dossche
8eb9969013
Add support for LIBXML_NOXMLDECL for modern documents (#14209)
This wasn't supported before, but should be.
2024-05-13 19:47:07 +02:00
Niels Dossche
e95b06c5ad Make some more arguments const 2024-05-13 19:46:51 +02:00
Niels Dossche
eeae9875f8 Avoid narrowing 2024-05-13 19:46:51 +02:00
Niels Dossche
1d573000d5 Remove unused arguments 2024-05-13 19:46:51 +02:00
Niels Dossche
01bab845a2 Rename variable to avoid shadowing 2024-05-13 19:46:51 +02:00
Niels Dossche
1fdbb0aba6 Get rid of unused declarations 2024-05-13 19:46:51 +02:00
Niels Dossche
e7af2bfd5b Get rid of reserved name usage 2024-05-13 19:46:51 +02:00
Dmitry Stogov
7e2831f074
Update IR
IR commit: 94e71e613221e79b033c48b54230e128755c95f9
2024-05-13 20:26:24 +03:00
Peter Kokot
9aee546919
Update PEAR failed download installation banner (#14216)
There was once install-su Makefile rule, now the install-pear can be
used instead.
2024-05-13 19:01:05 +02:00
Ilija Tovilo
f07f3b4078
Merge branch 'PHP-8.3'
* PHP-8.3:
  [skip ci] Fix typo
2024-05-13 13:08:56 +02:00
Ilija Tovilo
7a20168800
Merge branch 'PHP-8.3'
* PHP-8.3:
  [skip ci] Adjust port for gh13860.phpt
2024-05-13 12:17:12 +02:00
Jakub Zelenka
fba8e210e9
Merge branch 'PHP-8.3' 2024-05-12 13:37:05 +01:00
Saki Takamachi
7203ca8286
ext/bcmath: Made the same changes to _bc_do_add as _bc_do_sub (#14196)
The code for _bc_do_add and _bc_do_sub were written slightly differently for
similar processing (and add was slower than sub), so I changed the code to one
similar to sub.

Also, _bc_do_add has been changed to use SIMD to perform faster calculations
when possible.
2024-05-12 15:07:37 +09:00
Niels Dossche
525cbe0a6b
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix crash in ParentNode::append() when dealing with a fragment containing text nodes
2024-05-12 02:07:54 +02:00
Niels Dossche
aa3e6eec50
Optimize and reduce memory usage of XML serialization (#14204)
The serialization process uses the system allocator and requires a copy
to request allocated memory once finished. This patch improves this by
using smart_str to build the resulting string, reducing the number of
copies and reducing total peak memory usage.
2024-05-12 01:57:29 +02:00
Niels Dossche
8776561581 Add note for libxml handlers in UPGRADING.INTERNALS 2024-05-11 18:09:39 +02:00
Niels Dossche
dfde0d4cef Handle dumping node to file 2024-05-11 18:09:39 +02:00
Niels Dossche
0c490ade0d Handle dumping document to file 2024-05-11 18:09:39 +02:00
Niels Dossche
4ae3be379b Add test for serialization interaction 2024-05-11 18:09:39 +02:00
Niels Dossche
44485892df Factor out all common code for XML serialization and merge common paths 2024-05-11 18:09:39 +02:00
Niels Dossche
de4c9c3398
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix missing deref in C14N (#14203)
2024-05-11 17:13:20 +02:00
David Carlier
19c8a10f3f
ext/pcntl: add pcntl_getcpu support for solaris.
using getcpuid having similar signature too.

close GH-14188
2024-05-11 05:53:10 +01:00
Niels Dossche
46db8931f1 Fix unused argument warning 2024-05-11 01:21:15 +02:00
Niels Dossche
e9355fa162 Remove unused prototype from php_dom.h 2024-05-11 01:21:15 +02:00
Calvin Buckley
db37f3e35b Merge branch 'PHP-8.3'
* PHP-8.3:
  Update NEWS for ICU regression fix
2024-05-10 15:35:58 -03:00
Calvin Buckley
25b224d111 Merge branch 'PHP-8.3' 2024-05-10 15:09:26 -03:00
Niels Dossche
f88fc9c6e8
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-14189: PHP Interactive shell input state incorrectly handles quoted heredoc literals.
2024-05-10 16:49:05 +02:00
Niels Dossche
d934840f44
Fix deprecation warning 2024-05-10 16:26:44 +02:00
Niels Dossche
94479fefe5
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-14183: XMLReader::open() can't be overridden
2024-05-10 15:58:48 +02:00
Saki Takamachi
8276560e65
Merge branch 'PHP-8.3'
* PHP-8.3:
  ext/hash: Swap the checking order of __has_builtin and __GNUC__ (#14185)
2024-05-10 09:39:00 +09:00
Saki Takamachi
e976c2d4f0
ext/bcmath: Fixed an issue where macros may become undefined (#14179) 2024-05-10 09:13:03 +09:00
Niels Dossche
2956f55d17
[ci skip] UPGRADING: Update capitalization of Dom namespace 2024-05-09 12:47:39 +02:00
Niels Dossche
25860ee670
[ci skip] UPGRADING: Expand upon BCMath performance improvements 2024-05-09 12:46:42 +02:00
Saki Takamachi
1a3d870c1e
ext/bcmath: Use SIMD for trailing zero counts during conversion (#14166)
Changed to count trailing zeros using SIMD when converting a string to
a bc_num structure if possible.

Removed unnecessary pointer resetting.

Added UNEXPECTED to some branches.
2024-05-09 19:23:59 +09:00
Niels Dossche
6e7adb3c48
Update ext/dom names after policy change (#14171) 2024-05-09 10:40:53 +02:00
Máté Kocsis
0dfd2a93ab
Add ext/dba symbols in a namespace blok
In preparation of the opaque object to resource conversion
2024-05-08 23:44:31 +02:00
Niels Dossche
6091395b59
Cleanup some repetition and macros in xml_serializer.c (#14182) 2024-05-08 23:25:12 +02:00
Máté Kocsis
920591064e Migrate SOAP table resource to array
Related to https://wiki.php.net/rfc/resource_to_object_conversion and https://github.com/php/php-tasks/issues/6
2024-05-08 22:48:19 +02:00
Tim Düsterhus
48971af482
Update CODING_STANDARDS for the acronym casing RFC (#14169)
* [skip ci] Update CODING_STANDARDS for the acronym casing RFC

see https://wiki.php.net/rfc/class-naming-acronyms

* Improve formatting in CODING_STANDARDS.md

Co-authored-by: Larry Garfield <larry@garfieldtech.com>

---------

Co-authored-by: Larry Garfield <larry@garfieldtech.com>
2024-05-08 20:35:44 +02:00
Niels Dossche
70b5a4d554
BCMath: Avoid using the heap for temporary objects by using arena allocations (#14170)
* BCMath: Avoid using the heap for temporary objects by using arena allocations

* Fix alignment

* Improve size computation
2024-05-08 19:36:14 +02:00
Peter Kokot
06428559e3
Update .gitignore (#14158)
- The headers mentioned in the comment are not "generated" anymore as
  done via eb76a83008
- zend_jit_<arch>.c files are now generated as part of the
  ext/opcache/jit/ir
- generated minilua is ignored in ext/opcache/jit/ir/.gitignore
2024-05-08 07:19:59 +02:00
Tim Düsterhus
b80faeb8cb
Merge branch 'PHP-8.3'
* PHP-8.3:
  CI: Do not save the ccache for PRs (8.3+)
  CI: Do not save the ccache for PRs (#14168)
2024-05-07 20:53:55 +02:00
Niels Dossche
90a5b871ef
Simplify conversion in BCMath (#14157)
This simplifies the code, and also might indirectly improve performance
due to a decrease in instruction cache pressure. Although the latter is
probably negligible.

This works because 0x30 has no overlapping bits with [0, 9].
2024-05-07 18:24:00 +02:00
Niels Dossche
304f19b139
Remove unused fields from phar_entry_data() (#14144)
These fields are only ever written to, but never read.
2024-05-07 18:23:47 +02:00
Niels Dossche
e218ca2161
Improve error message in Phar::buildFromIterator() (#14145) 2024-05-07 18:23:28 +02:00
Ilija Tovilo
d2a9edfee6
Callable curl options should be nullable
symfony/http-client/Response/CurlResponse.php depends on this behavior.

Closes GH-14165
2024-05-07 16:34:49 +02:00
Saki Takamachi
90c5b2a43b
Merge branch 'PHP-8.3'
* PHP-8.3:
  Cast the parameter type of arm BLOCKCONV_LOAD (#14159)
2024-05-07 19:44:32 +09:00
Dmitry Stogov
c5982c961d
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix incorrect inheritance of private trait methods (#14163)
2024-05-07 13:20:00 +03:00
Máté Kocsis
60336de2ba Migrate SOAP SDL resource to object
Related to https://wiki.php.net/rfc/resource_to_object_conversion and https://github.com/php/php-tasks/issues/6
Closes GH-14121
2024-05-07 09:21:39 +02:00
Máté Kocsis
44b3cb2a13 Migrate SOAP URL resource to object
Related to https://wiki.php.net/rfc/resource_to_object_conversion and https://github.com/php/php-tasks/issues/6
2024-05-07 09:21:39 +02:00
Saki Takamachi
02732007f7
Refactor BCMath _bc_do_sub (#14132)
_bc_do_sub now uses SIMD to perform calculations at high speed.

Moved the macros used for SIMD to `private.h`, and added some constants
and macros.
2024-05-07 11:39:31 +09:00
Dmitry Stogov
bb21d195c1
Update IR
IR commit: fe4ba285bc576d83bea4a8099fb7315b8bc8c7fb
2024-05-06 22:22:15 +03:00
Dmitry Stogov
3fcf6ffbc4
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix prototype for trait methods (#14148)
2024-05-06 21:46:13 +03:00
Niels Dossche
79af2ad9bf Remove unused return value from phar_entry_delref() 2024-05-06 19:50:22 +02:00
Niels Dossche
f0f05c7923 Introduce some const pointers 2024-05-06 19:50:22 +02:00
Niels Dossche
35f30b388a Fix implementation-defined conversion warning 2024-05-06 19:50:22 +02:00
Niels Dossche
e575ab5b77 Remove redundant check
There's no point in checking the length, this just wastes time.
2024-05-06 19:50:22 +02:00
Niels Dossche
edf9c4de3d Remove prototypes for non-existent functions 2024-05-06 19:50:22 +02:00
Niels Dossche
9102e97fec Use bool in globals where possible 2024-05-06 19:50:22 +02:00
Niels Dossche
4cbe88b220 Remove unused typedefs in phar.c 2024-05-06 19:50:22 +02:00
Niels Dossche
07e1bcae2f Use bool instead of int in _phar_zip_pass 2024-05-06 19:50:22 +02:00
Niels Dossche
7b60f53f07
Remove unused field from _phar_archive_data (#14146)
This field is only ever written to, but never read.
2024-05-06 19:50:12 +02:00
Ilija Tovilo
55966f098b
Merge branch 'PHP-8.3'
* PHP-8.3:
  Add test for GH-14109
2024-05-06 16:03:15 +02:00
Ilija Tovilo
858008b1c6
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix persisting of inherited class constants
2024-05-06 16:02:29 +02:00
Ilija Tovilo
9b387ac69a
Remove now empty attribute validator 2024-05-06 13:02:25 +02:00
Ilija Tovilo
bb8de67da5
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix attribute test on newer branches
2024-05-06 13:01:12 +02:00
Ilija Tovilo
2ba30f0299
Merge branch 'PHP-8.3'
* PHP-8.3:
  Delay #[Attribute] arg validation until runtime
2024-05-06 12:48:45 +02:00
Dmitry Stogov
2d66993c64
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix undefined behavior (left shift of negative number)
2024-05-06 09:52:49 +03:00
Máté Kocsis
e4c52e603d
One more EXPECTF-related change
These cause test failures when we migrate resources to objects. But anyway, hardcoding the object IDs and the number of properties is hardly ever useful, so it's fine to get rid of them.
Related to #14121
2024-05-06 08:46:31 +02:00
Máté Kocsis
e869186d17
EXPECTFize ext/soap tests where exact object IDs are displayed
These cause test failures when we migrate resources to objects. But anyway, hardcoding the object IDs and the number of properties is hardly ever useful, so it's fine to get rid of them.
Related to #14121
2024-05-06 08:43:41 +02:00
Dmitry Stogov
ad16767d58
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix zend_string_starts_with_literal_ci (#14137)
2024-05-06 08:49:52 +03:00
Saki Takamachi
45ab6074ae
[ci skip] Added myself to CODEOWNERS 2024-05-05 22:14:59 +09:00
Máté Kocsis
41b2fb5db1
Session extension is needed to run bug51561.phpt 2024-05-05 14:40:33 +02:00
Niels Dossche
f1b8020718
[ci skip] Update CODEOWNERS and EXTENSIONS (#14139)
I'm defacto already maintaining most XML stuff anyway, so update
CODEOWNERS accordingly. The EXTENSIONS file was not yet updated for my
maintenance status so do that as well.

Furthermore, as suggested by @Girgias, add myself as CODEOWNER to
BCMath.
2024-05-05 14:21:45 +02:00
Niels Dossche
f97bd071d5
Implement SeekableIterator for SplObjectStorage (#13665) 2024-05-05 13:26:54 +02:00
Niels Dossche
8637a3f5b0 Fix getDocNamespaces() not working when only having xmlns attributes without an internal declaration in the document 2024-05-05 10:14:40 +02:00
Niels Dossche
fae25ca2df Move dom_attr_value() into ext/libxml 2024-05-05 10:14:40 +02:00
Gina Peter Banyard
70acd6e9ad
ext/bcmath: Remove unused ODD() macro function 2024-05-05 01:02:46 +01:00
Peter Kokot
04c417a35e
Remove unused always-enabled extension headers (#14042)
These were once used in these files but at this point aren't and are
only causing confusion whether file depends on additional extension.

- locale.h is added in main/SAPI.c for _ENABLE_PER_THREAD_LOCALE
2024-05-04 21:06:29 +02:00
Niels Dossche
8aec95e23f
Fix build on Clang 18 (#14136)
Clang 18 only allows counted_by to work on real flexible array members,
not ones with a zero size. Otherwise you get errors like:
```
ext/opcache/jit/zend_jit_ir.c:149:12: error: 'counted_by' only applies to C99 flexible array members
```
2024-05-04 19:17:42 +02:00
Niels Dossche
bf3c4870b6
Avoid needless memsets by creating a variant of bc_new_num that doesn't memset (#14133)
Also avoid some memsets where we do call bc_new_num.

After:
```
1.2066178321838
1.5389559268951
1.6050860881805
```

Before:
```
1.3858470916748
1.6806011199951
1.9091980457306
```
2024-05-04 17:11:57 +02:00
Saki Takamachi
1ae58d4784
ext/bcmath: Removed unnecessary zero padding (#14134)
bc_num is initialized to 0 by `memset`, so there is no need to write it to 0.
2024-05-05 00:03:08 +09:00
Niels Dossche
a728e541e9
Remove some dead code from BCMath (#14130)
* Remove unused output.c code

* Remove unused ignore_last parameter from _bc_do_compare()
2024-05-04 16:00:54 +02:00
Niels Dossche
b8abd2693e
Increase test coverage of _bc_do_add() (#14131)
The final carry code was not tested.
2024-05-04 16:00:47 +02:00
Niels Dossche
d2ce90caf8
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-14124: Segmentation fault on unknown address 0x0001ffff8041 with XML extension under certain memory limit (#14126)
2024-05-04 14:11:08 +02:00
Niels Dossche
22a113b99c
Try to use an interned local name in createElementNS (#14127) 2024-05-04 13:59:43 +02:00
Niels Dossche
234b3cb241
Fix GH-14124: Segmentation fault on unknown address 0x0001ffff8041 with XML extension under certain memory limit (#14126)
The ltags were not initialized, so when an OOM happens before the new value is written, uninitialized data is used.
2024-05-04 13:57:50 +02:00
武田 憲太郎
d9a9696e89
Fix libmysql download to stable URL 2024-05-04 17:54:18 +09:00
Saki Takamachi
4b95da6163
Merge branch 'PHP-8.3'
* PHP-8.3:
  CI: fix oci setup (#14123)
2024-05-04 17:49:21 +09:00
Saki Takamachi
f442cecab6
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix the MySQL Server version used for testing to  (#14120)
2024-05-04 07:49:46 +09:00
Peter Kokot
4465e5082c
Use AC_SEARCH_LIBS for socketpair, gethostname and gethostbyaddr (#14116)
The socketpair():
* C library: Solaris 11.4 and most other systems
* libsocket: Solaris <= 11.3 and illumos
* libnetwork: Haiku

The gethostname() check is moved to AC_CHECK_FUNCS:
* C library: most systems
* libnsl: none
* libnetwork: Haiku (which is already checked in the libraries section)

The gethostbyaddr():
* C library: most systems, Solaris 11.4
* libnsl: Solaris 11.3, illumos
* libnetwork: Haiku

This also removes redundant unused symbols:
- HAVE_GETHOSTBYADDR
- HAVE_LIBNETWORK
- HAVE_LIBNSL

The outdated comment about -lnsl and -lsocket linking has been removed
because these systems are long not supported anymore and this issue is
not relevant anymore like mentioned. The initial solution was different
than the one with the PHP_CHECK_FUNC macros at the current versions.
See commit a188fac946 where the
gethostbyaddr() was checked conditionally based on the gethostname()
availability in libc. Main issue was mostly related to the redundant nsl
library being always linked because of the AC_CHECK_LIB.
2024-05-03 19:55:24 +02:00
Niels Dossche
cad0e555ac
Faster validation logic in bc_str2num() (#14115)
Using SIMD to accelerate the validation.

Using the benchmark from #14076.

After:
```
1.3504369258881
1.6206321716309
1.6845638751984
```

Before:
```
1.4750170707703
1.9039781093597
1.9632289409637
```
2024-05-03 17:34:38 +02:00
Niels Dossche
039344cf70 Avoid extra inits while flooring or ceiling 2024-05-02 20:03:59 +02:00
Niels Dossche
34b2116eb5 Avoid unnecessary destruction in bc_mul() 2024-05-02 20:03:59 +02:00
Niels Dossche
0cd952d851 Avoid unnecessary destruction in bc_sub() 2024-05-02 20:03:59 +02:00
Niels Dossche
959e11544c Avoid unnecessary destruction in bc_add() 2024-05-02 20:03:59 +02:00
Niels Dossche
a604d1d342 Use SSE2 in bc_copy_and_shift_numbers() if possible 2024-05-02 20:03:59 +02:00
Niels Dossche
4964c5cb23 Move bc_copy_num to header to allow inlining 2024-05-02 20:03:59 +02:00
Niels Dossche
be072d7be4 Use RETVAL_NEW_STR
The strings are always new, not interned.
2024-05-02 20:03:59 +02:00
Matteo Beccati
36f9d18e27
Merge branch 'PHP-8.3' 2024-05-02 19:53:43 +02:00
Peter Kokot
8c8287abf6
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix tests for glibc 2.39 (#14097)
2024-05-01 20:43:53 +02:00
Niels Dossche
a66439adbb
Avoid unnecessary number initializations in BCMath (#14104)
Since freeing can deal with NULL, we can avoid calling bc_init_num and
avoid resetting the number during parsing.

Using benchmark from #14076.

Before:
```
1.544440984726
2.0288550853729
2.092139005661
```

After:
```
1.5324399471283
1.9081380367279
2.065819978714
```
2024-05-01 17:52:06 +02:00
Niels Dossche
b1bb9c34e8
[ci skip] NEWS and UPGRADING 2024-05-01 16:57:36 +02:00
Niels Dossche
0a3ccc0b99
Use bulk conversion in BCMath of BCD/CHAR where possible (#14103)
On my i7-4790 with benchmark from #14076, on top of #14101 I obtain the
following results:

before (with #14101):
```
1.672737121582
2.3618471622467
2.3474779129028
```

after (with #14101 + this):
```
1.5878579616547
2.0568618774414
2.0204811096191
```
2024-05-01 16:48:42 +02:00
Saki Takamachi
cf92a191e8
ext/pdo_sqlite: Use new F ZPP (#14059)
closes #14059
2024-05-01 23:44:41 +09:00
Gina Peter Banyard
6303d1fc6a
ext/sqlite3: Use new F ZPP modifier (#14040) 2024-05-01 15:38:48 +01:00
Niels Dossche
d2d4596f20 Use an unsigned number for the refcount of bcmath objects 2024-05-01 16:18:37 +02:00
Niels Dossche
5dc11de558 Merge n_value and n_ptr 2024-05-01 16:18:37 +02:00
Niels Dossche
3215e86a11 Avoid double allocation in _bc_new_num_ex
Since the two allocations are tied together anyway, we can just use a
single allocation. Moreover, this actually seemed like the intention
because the bc_struct allocation already accounted for the length and
scale.
2024-05-01 16:18:37 +02:00
Gina Peter Banyard
f4dbe2390d
ext/curl: Refactor cURL to only use FCC (#13291)
* ext/curl: Convert handlers.progress to just be a FCC

* ext/curl: Convert handlers.sshhostkey to just be a FCC

* ext/curl: Convert handlers.xferinfo to just be a FCC

* ext/curl: Convert handlers.fnmatch to just be a FCC

* ext/curl: Convert handlers.server_push to just be a FCC

* ext/curl: Convert php_curl_write to just use FCC without a function name zval

* ext/curl: Convert php_curl_read to just use FCC without a function name zval

* ext/curl: Remove workaround for old libcurl

* ext/curl: Create macros to codegen the handling of callable options
2024-05-01 15:09:11 +01:00
Saki Takamachi
0540a4211d
[skip ci] NEWS 2024-05-01 22:31:08 +09:00
Saki Takamachi
10ae87969e
NEWS/UPGRADING 2024-05-01 22:02:43 +09:00
David Carlier
0a134e5d85
Merge branch 'PHP-8.3' 2024-05-01 14:00:03 +01:00
Saki Takamachi
a481556d31
Refactor BCMath (#14076)
Optimized the order of structure members and the process of converting
strings to bc_num structures.

closes #14076
2024-05-01 21:54:23 +09:00
Niels Dossche
378b015360
Fix Windows failure (#14096) 2024-05-01 00:03:43 +02:00
Niels Dossche
4167d75024
[ci skip] Fix typo in NEWS 2024-04-30 23:38:08 +02:00
Niels Dossche
fed1d5efb6
Add extra test for stale entity references 2024-04-30 22:56:20 +02:00
Niels Dossche
6f989cdb75
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix crash when calling childNodes next() when iterator is exhausted
  Fix references not handled correctly in C14N
  Fix crashes when entity declaration is removed while still having entity references
2024-04-30 22:53:48 +02:00
Máté Kocsis
afa034df99
Add GC_PERSISTENT_LOCAL flag for ODBC structures (#14094)
Fixes nightly builds where ZEND_RC_DEBUG is enabled
2024-04-30 22:30:38 +02:00
Niels Dossche
d3b38fa8de Fix narrowing warning 2024-04-30 22:28:24 +02:00
Niels Dossche
86352d8c0e Use fast ZPP in nodelist.c 2024-04-30 22:28:24 +02:00
Máté Kocsis
53de62561d
Fix some typos on the reference counting docs page 2024-04-30 22:16:45 +02:00
Máté Kocsis
2fd30a2000
Fix casing of the ODBC namespace in error messages 2024-04-30 22:14:22 +02:00
Tim Düsterhus
d5cc7e9109
random: Add PHPAPI to all php_random_algo definitions (#14088)
The php_random.h header already defines them as `PHPAPI` and they actually are
part of the public API.

Co-authored-by: Arnaud Le Blanc <arnaud.lb@gmail.com>
2024-04-30 21:01:13 +02:00
David CARLIER
8d67f23eb2
sapi/phpdbg: Update of userfaultfd workflow. (#13955)
unpriviliged_userfaultfd is set to 0 by default. Since Linux 5.11
handling memory ranges from the user-space is allowed with the
`UFFD_USER_MODE_ONLY` fd open mode flag.
2024-04-30 19:33:19 +01:00
Saki Takamachi
5359392717
[RFC] Add bcfloor, bcceil and bcround to BCMath (#13096)
Implementation for the "Adding bcround, bcfloor and bcceil to BCMath" RFC: https://wiki.php.net/rfc/adding_bcround_bcfloor_bcceil_to_bcmath

* Separated round mode into separate header file

Co-authored-by: Gina Peter Banyard <girgias@php.net>
2024-04-30 18:32:33 +01:00
Niels Dossche
78ec2bde62
Respect constness in casting in dom/entity.c (#14080) 2024-04-30 17:29:53 +02:00
Niels Dossche
d24a04bba8
Use fast ZPP in very commonly used DOM functions (#14077)
Start using fast ZPP in very commonly used DOM functions, and also try
to unify some branches by using RETURN_BOOL where appropriate.
2024-04-30 17:29:33 +02:00
Niels Dossche
cf7c592143 Simplify property check in php_libxml_node_free_resource() 2024-04-30 17:29:19 +02:00
Niels Dossche
974edc7939 Cleanup php_libxml_internal_error_handler_ex() 2024-04-30 17:29:19 +02:00
Niels Dossche
e5e8b193e0 Remove bogus entity reference cleanup code 2024-04-30 17:29:19 +02:00
Niels Dossche
2fab1437f2 Cleanup php_libxml_streams_IO_open_wrapper() 2024-04-30 17:29:19 +02:00
Niels Dossche
a54d63aefe Cleanup php_libxml_unregister_node() 2024-04-30 17:29:19 +02:00
Tim Düsterhus
6e8b134023
reflection: Fix ReflectionFunction::getShortName() for first class callables (#14087)
Fix fixes an incorrect fix in php/php-src#14001.
2024-04-30 17:27:11 +02:00
Tim Düsterhus
b5ffac7f6a
Add ReflectionClassConstant::isDeprecated() (#14086)
This is in preparation for php/php-src#11293 and for consistency with
ReflectionConstant::isDeprecated() that was added in php/php-src#13669.
2024-04-30 17:26:27 +02:00
Peter Kokot
d26617f760
Remove unused PARSE_SESSION and PARSE_REQUEST (#14081)
These were removed via 0904dd3dc2.
2024-04-30 16:39:00 +02:00
Ilija Tovilo
1c30c5e707
Print location on class redeclaration
Fixes GH-13950
Closes GH-13999
2024-04-30 14:34:43 +02:00
Ilija Tovilo
d52605db15
Replace xhtml image with base64 data 2024-04-30 14:10:46 +02:00
Ilija Tovilo
cb55588a7e
Skip online tests by default
Fixes GH-14058
Closes GH-14070
2024-04-30 14:10:46 +02:00
Ilija Tovilo
7f3fd30c3b
[skip ci] Fix intl test on 32-bit machines 2024-04-30 11:40:32 +02:00
David Carlier
1cf4cc3894
ext/intl: IntlDateFormatter::parseToCalendar addition.
Unlike IntlDateFormatter::parse, the timezone is updated
accordingly.

Close GH-13779
2024-04-29 18:55:00 +01:00
David Carlier
5823a96f1e
ext/gettext: update arguments handling.
using zend_string whenever relevant too.

Close GH-13582.
2024-04-29 18:38:34 +01:00
Ilija Tovilo
782af7a963
Fix -Walloc-size warning
It's indeed unsafe to treat zend_internal_function as zend_function, because
sizeof(zend_internal_function) < sizeof(zend_function), which can lead to buffer
overflows. This might also be UB.

Either way, this would need to be addressed in the whole codebase.
2024-04-29 16:36:24 +02:00
Ilija Tovilo
529a71ff2e
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix __SANITIZE_ADDRESS__ redeclaration warning
2024-04-29 16:14:24 +02:00
David CARLIER
32936c518a
ext/pcntl: porting pcntl cpu affinity api to netbsd. (#14056) 2024-04-29 13:54:07 +01:00
Niels Dossche
ed916214c4
Avoid additional allocation in Document\createElementNS (#14071)
For the following benchmark code:
```php
$dom = DOM\XMLDocument::createEmpty();
for ($i = 0; $i < 1000*100; $i++) $dom->createElementNS("urn:a", "thisisaveryverylongname");
```

We obtain the following on an i7-4790:
```
Benchmark 1: ./sapi/cli/php bench.php
  Time (mean ± σ):      34.5 ms ±   1.2 ms    [User: 31.4 ms, System: 2.9 ms]
  Range (min … max):    32.4 ms …  39.3 ms    84 runs

Benchmark 2: ./sapi/cli/php_old bench.php
  Time (mean ± σ):      36.6 ms ±   1.6 ms    [User: 33.6 ms, System: 2.9 ms]
  Range (min … max):    34.3 ms …  45.3 ms    80 runs

Summary
  ./sapi/cli/php bench.php ran
    1.06 ± 0.06 times faster than ./sapi/cli/php_old bench.php
```
2024-04-29 08:39:44 +02:00
Adam Saponara
956c3c2c03
ext/openssl: Add option to load legacy algorithm provider
OpenSSL 3.x relegated a set of insecure algorithms to a "legacy"
provider which is not loaded by default. Some of these algorithms
have utility beyond encryption such as for hashing, e.g., DES[1]

Add a compile-time option to load the legacy provider in 3.x. When
enabled, also load the default provider because loading any provider
explicitly disables auto-loading the default provider.

[1] 9e40015748/go/vt/vtgate/vindexes/hash.go (L157)

Closes GH-13951
2024-04-28 14:52:45 +01:00
Máté Kocsis
afd91fb9ac
Migrate ext/odbc resources to opaque objects (#12040)
Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
2024-04-28 15:45:56 +02:00
Pascal Christen
57cd23d6d0
Adjust zlog warning and error message in kqueue (#14053) 2024-04-28 13:18:06 +01:00
David CARLIER
d5d227a43a
[ci skip] ext/sockets: followup on #14065. (#14066)
freebsd supports SO_NOSIGPIPE too.
2024-04-28 13:01:49 +01:00
David Carlier
b147a22bb8
ext/sockets: adding SO_NOSIGPIPE constant.
it s the macOs way to disable the SIGPIPE signal emission, same
 as doing `signal(SIGPIPE, SIG_IGN)` but on the socket level.

Close GH-14065
2024-04-28 12:01:03 +01:00
Niels Dossche
b0da6ed6ee
Be specific for the namespace of the id attribute (#14060) 2024-04-28 11:40:54 +02:00
Niels Dossche
a86e668764 Improve performance of text node allocation by marking the text node construction as always inline 2024-04-28 10:32:41 +02:00
Niels Dossche
acdf63b999 Get rid of error gotos in HTML5 parse conversion 2024-04-28 10:32:41 +02:00
Máté Kocsis
3876225763
Fix casing of NULL default values 2024-04-27 23:45:55 +02:00
David Carlier
243827b83f
Fix GH-13519: another attempt after the faulty fix.
Close GH-14055
2024-04-27 12:15:59 +01:00
Dmitry Stogov
8e4363de55
Update IR
IR commit: 3b35a1fd61b2b72da8a0852549880d2aff391dbe
2024-04-26 23:53:27 +03:00
Dmitry Stogov
bad5d2c78a
Update IR
IR commit: ae34ae52b7b1c359afa03a0a1f45cbf689a64471
2024-04-26 02:40:42 +03:00
Niels Dossche
3626e2d552
Get rid of remaining usages of zval_try_get_string() (#14041)
This isn't necessary because the cases where we use it will always
succeed because the properties always have the type string|null.
2024-04-24 23:47:10 +02:00
Gina Peter Banyard
f68d72527a UPGRADING 2024-04-24 15:39:47 +01:00
Gina Peter Banyard
c96e8946e1 ext/mbstring: Check encoding passed to mb_http_output() has no null bytes 2024-04-24 15:39:47 +01:00
Gina Peter Banyard
86dfbadc06 ext/mbstring: Always pass length to php_mb_get_encoding_or_pass()
We have access to this information, so propagate it instead of calling strlen().
This also removes the newly introduced _ex() variant.
2024-04-24 15:39:47 +01:00
Gina Peter Banyard
b61479bb28 ext/mbstring: Pass string length to _php_mb_ini_mbstring_http_output_set() 2024-04-24 15:39:47 +01:00
Niels Dossche
a70786304b
[ci skip] UPGRADING 2024-04-24 09:10:13 +02:00
Niels Dossche
f81370847c
Fix GH-13815: mb_trim() inaccurate $characters default value (#13820)
Because the default characters are defined in the stub file, and the
stub file is UTF-8 (typically), the characters are encoded in the string
as UTF-8. When using a different character encoding, there is a mismatch
between what mb_trim expects and the UTF-8 encoded string it gets.

One way of solving this is by making the characters argument nullable,
which would mean that it always uses the internal code path that has the
unicode codepoints that are defaulted actually stored as codepoint
numbers instead of in a string.

Co-authored-by: @ranvis
2024-04-24 09:07:55 +02:00
Gina Peter Banyard
13a5a8126e ext/gmp: Fix leading whitespace before explicit octal prefix 2024-04-23 23:39:48 +01:00
Gina Peter Banyard
4719ef258f ext/gmp: Improve error message 2024-04-23 23:39:48 +01:00
Dmitry Stogov
71194ea767
Update IR
IR commit: 65586bd4cf9cd2d3b41492f52823c5083cea77e4
2024-04-23 23:14:54 +03:00
Jakub Zelenka
b6cf38836f
Merge branch 'PHP-8.3' 2024-04-23 19:28:58 +01:00
Sergey Panteleev
77d38d33d5
Merge branch 'refs/heads/PHP-8.3'
* refs/heads/PHP-8.3:
  PHP-8.2 is now for PHP 8.2.20-dev
2024-04-23 17:24:06 +03:00
Arnaud Le Blanc
6d285e3d08
[ci skip] UPGRADING 2024-04-23 11:58:51 +02:00
Arnaud Le Blanc
9bbc195d11
Remove zend_strtod mutex (#13974)
`zend_strtod.c` uses a global state (mostly an allocation freelist) protected by a mutex in ZTS builds. This state is used by `zend_dtoa()`, `zend_strtod()`, and variants. This creates a lot of contention in concurrent loads. `zend_dtoa()` is used to format floats to string, e.g. in sprintf, json_encode, serialize, uniqid.

Here I move the global state to the thread specific `executor_globals` and remove the mutex.

The impact on non-concurrent environments is null or negligible, but there is a considerable speed up on concurrent environments, especially on Alpine/Musl.
2024-04-23 11:52:38 +02:00
Julien Voisin
07337df1d7
Add two checks for zend_mm_heap's integrity (#13943) 2024-04-23 11:50:24 +02:00
Niels Dossche
bffab33a89
Update Lexbor (#14032) 2024-04-22 23:19:42 +02:00
David Carlier
3a300e9213
ext/pcntl: signals list update for dragonflybsd related to checkpoint.
- SIGCKPT checkpoint and continue.
- SIGCKPTEXIT checkpoint and exit.

Close GH-14011
2024-04-22 21:21:52 +01:00
Peter Kokot
a27cdd65f3
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-13727: Building with -Werror=strict-prototypes (#14029)
2024-04-22 21:23:15 +02:00
Ilija Tovilo
8a7d79da90
Merge branch 'PHP-8.3'
* PHP-8.3:
  Temporary reset filename and lineno override before autoload
2024-04-22 10:58:02 +02:00
Laurent Arnoud
3f0b204f5a
cli: allow to change ~/.php_history with PHP_HISTFILE
Closes GH-13313
2024-04-22 10:05:47 +02:00
Peter Kokot
7151855d67
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix erroneous dnl appended in configure (#14013)
2024-04-21 17:24:51 +02:00
Ilija Tovilo
76a254a19e
Merge branch 'PHP-8.3'
* PHP-8.3:
  [skip ci] Backport 0e7ef95 and 4f0d4c0
2024-04-21 16:14:00 +02:00
Niels Dossche
dd1a32dc1c
NEWS
Closes GH-13782.
2024-04-21 16:08:26 +02:00
Niels Dossche
43cbeb3bf0
Add an assertion for certainty 2024-04-21 16:07:40 +02:00
Niels Dossche
bb8234d2bd
Use php_stream_auto_cleanup() consistently 2024-04-21 16:07:40 +02:00
Niels Dossche
0b69c3aea4
Fix crash in shutdown when using a named pipe with a persistent mysqli connection
The code originally posted in GH-10599 triggers the bug for
non-persistent connections, but changing the host to `p:.` reveals that
there is also a crash bug for persistent connections.
2024-04-21 16:07:40 +02:00
Niels Dossche
a20d9d72b1
Factor common code out into mysqlnd_fixup_regular_list()
This prevents the code from getting desynced again, which was the reason
for the leak of GH-10599.
2024-04-21 16:07:40 +02:00
Niels Dossche
319fb50eca
Fix memory leak in mysqlnd_vio::open_pipe
This fixes the memory leak part of GH-10599.
2024-04-21 16:07:40 +02:00
Niels Dossche
06b87f912b
Remove broken hack in mysqlnd_vio::close_stream
What happens is that the persistent network stream resource gets freed, yet
stays inside EG(persistent_list). This causes a crash on shutdown when the
persistent list is getting cleared, as the engine will try to free the network
stream again.

The code in close_stream gets confused between persistent vs
non-persistent allocations when EG(active) is false.
This code was introduced in c3019a1 to fix crashes when the persistent list
gets destroyed before module shutdown is called. This is indeed a potential
problem that was fixed on the master branch in 5941cda.

This fixes the crash reason of GH-10599.
2024-04-21 16:07:39 +02:00
Ilija Tovilo
4f0d4c0872
[skip ci] Also skip all other push jobs on non php-src 2024-04-21 16:00:48 +02:00
Ilija Tovilo
0e7ef95a0a
[skip ci] Also skip benchmarking on non php-src 2024-04-21 02:22:57 +02:00
Ilija Tovilo
c3b07a6e5e
Adjust nightly org restriction check
Check for the specific repository.

Closes GH-14026
2024-04-21 02:13:49 +02:00
Niels Dossche
b3700e29cc
Simplify prop handler of XMLReader (#14023)
As XMLReader only exposes a single class, and the property handlers are
statically set, we don't need to store the pointer to the property
handler table inside the object.
This simplifies the code and reduces the memory required for XMLReader.
2024-04-20 23:22:38 +02:00
Niels Dossche
7428a92c5b
[ci skip] Be more specific about ext-dom incompatibilities in UPGRADING (#14024)
The previous text was put there before I decided to add the new classes.
Therefore the only new feature that can affect BC is
compareDocumentPosition(). Only when the declaration is incompatible can
the user experience errors.
2024-04-20 23:21:40 +02:00
David CARLIER
23640542dc
ext/pcntl: pcntl_fork refining error handling. (#14021) 2024-04-20 21:01:09 +01:00
David Carlier
151a677acb
Merge branch 'PHP-8.3' 2024-04-20 17:12:20 +01:00
Saki Takamachi
3e3875c379
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-13998: Manage refcount of agg_context->val correctly (#14004)
2024-04-20 22:34:53 +09:00
Niels Dossche
bca94e3420
[ci skip] Fix typo in release-process.md (#14012) 2024-04-20 10:46:07 +02:00
Peter Kokot
e93d23a9cb
Remove unused ext/spl SPL_API code (#13985)
The ext/spl is always enabled and building it as shared is no longer
relevant.
2024-04-19 22:50:36 +02:00
Ilija Tovilo
8160869e3d
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix missing handling of CALLABLE_CONVERT in cleanup_unfinished_calls()
2024-04-19 20:06:27 +02:00
Jakub Zelenka
edb13b60e9
CI: Skip building docs if GitHub repository is not php-src (#14006) 2024-04-19 17:44:28 +02:00
Jakub Zelenka
1b015947a0
Merge branch 'PHP-8.3' 2024-04-19 14:10:18 +01:00
Gina Peter Banyard
e0f24ab3e3
Revert php_output_stack_* signature change
This was unintentional and meant to be done in a follow-up PR
2024-04-19 13:44:21 +01:00
Tim Düsterhus
d03d436528
reflection: Fix ReflectionFunction::getShortName() for Closures (#14001)
see php/php-src#13550
2024-04-19 12:14:16 +02:00
Gina Peter Banyard
2447cb25c6
main/output.c: Refine int return type to bool or zend_result (#13997) 2024-04-19 10:46:40 +01:00
David Carlier
de490c5e01
Merge branch 'PHP-8.3' 2024-04-19 10:07:35 +01:00
Peter Kokot
719237954b
Substitute PEAR_INSTALLDIR only when enabling PEAR (#13994)
When not using --with-pear configure option, the Makefile doesn't need
the PEAR_INSTALLDIR variable. Also, this variable isn't directly
substituted using the @PEAR_INSTALLDIR@ in any template, so the
PHP_SUBST can be used.
2024-04-18 23:05:46 +02:00
Peter Kokot
6fed6d85db
Use AC_SUBST instead of PHP_SUBST_OLD where possible (#13993)
The PHP_SUBST_OLD adds variables to generated Makefile and creates
output shell variables to replace the @variable_name@ placeholders in
templates. These changed variables are not used in the generated
Makefile so the AC_SUBST is sufficient.

- ext/odbc
- sapi/embed
- sapi/fpm
- only substituted in scripts/php-config.in:
  - PHP_INSTALLED_SAPIS
  - SAPI_LIBNAME_SHARED
  - SAPI_LIBNAME_STATIC
2024-04-18 22:17:27 +02:00
Derick Rethans
742c2e8458
Split out tasks from requested info, and fix typo 2024-04-18 13:42:26 +01:00
Derick Rethans
fe0e1d875b
Describe what you need to ask systems@php.net for 2024-04-18 13:39:36 +01:00
Ørjan Malde
ff76cb738b
rudimentary midipix port (#13896) 2024-04-18 08:19:44 +02:00
Saki Takamachi
d14b208552
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-13984: Buffer size is now checked before memcmp (#13991)
2024-04-18 08:38:18 +09:00
Ilija Tovilo
e23440e5a6
Implement reflection constant
Fixes GH-13570
Closes GH-13669
2024-04-17 22:53:09 +02:00
Ilija Tovilo
7a10b97137
Merge branch 'PHP-8.3'
* PHP-8.3:
  Add missing COMPILE_IGNORE_OTHER_FILES check for static calls
2024-04-17 22:40:24 +02:00
Gina Peter Banyard
1f8c899dcb
ext/reflection: Add test for ReflectionParameter::getDeclaringFunction() with a ReflectionMethod creation from a Closure (#13987) 2024-04-17 20:36:17 +01:00
Niels Dossche
47ec32044e
Make documentURI and URL not readonly (#13982)
These aren't actually readonly right now because `@readonly` means
nothing, and the setters are configured in php_dom.c. So no functional
changes here.

DOM spec marks these as readonly, but the problem is that this reduces
usefulness in XML contexts (like WSDL scheme handling). In context of a
browser, for which DOM was designed, this actually makes sense to have
as readonly because it is tied to the origin of the page etc. But PHP is
not a browser. This also wasn't readonly in "old DOM".
2024-04-17 17:35:29 +02:00
Dmitry Stogov
58c0202506
Update IR
IR commit: 6933937a5f4c9e84ddd984d23d765733c59e8c0f

Fixes PHP nightly test failures in AMPHP and Symfony unit tests
2024-04-17 09:11:45 +03:00
Dmitry Stogov
a2e924e582
Update IR
IR commit: 81ccde4c3f41afb75723db2315403181e5e7cac1

Fixes JIT failures on ARM Linux
2024-04-17 00:27:34 +03:00
tekimen
bedafdcf4a
Fix GH-13968: Build failed when with --enable-mbregex on MSVC (#13971)
I added /utf-8 flag in CFLAGS_MBSTRING at config.w32

Advised from Hirokawa-san thanks
2024-04-16 22:33:49 +02:00
Niels Dossche
14cd67a42a
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-13978: Fuzzer readme still mentions obsolete --enable-json flag (#13983)
2024-04-16 22:17:59 +02:00
Dmitry Stogov
fe25afe5d0
Update IR
IR commit: c407241e1be34ed2ee4f2177842cc527abf25867
2024-04-16 22:37:34 +03:00
Peter Kokot
7d6bb3e86d
Fix extension_dir variable quoting in php-config (#13963)
When configuring the build with:

    ./configure EXTENSION_DIR="\${prefix}/lib/php/20230901"

The $prefix variable wasn't replaced when running the installed script:

    php-config --extension-dir

It shows ${prefix}/lib/php/20230901 instead of
/usr/local/lib/php/20230901 because of single quotes.
2024-04-16 19:07:49 +02:00
Arnaud Le Blanc
46b6ad6dae
Inline GDB scripts in the PHP binary (#13600)
This inlines .gdbinit and php_gdb.py in the .debug_gdb_scripts section of the PHP binary so that GDB can auto-load them regardless of the current directory or the availability of the PHP source code (albeit some functionalities of php_gdb.py currently rely on the source being available).
2024-04-16 15:10:01 +02:00
Arnaud Le Blanc
af5db45dc9
Merge branch 'PHP-8.3'
* PHP-8.3:
  [ci skip] NEWS
  [ci skip] NEWS
  fix: zend-max-execution-timers with negative or high timeout value (#13942)
  Use return value of getpwuid_r(), not errno (#13969)
2024-04-16 14:20:23 +02:00
Arnaud Le Blanc
326dc17bb4
Fix tests when stdout is unbuffered (#13924) 2024-04-16 13:49:11 +02:00
Laurent Arnoud
a64fc008c8
tests: add php_history file check (#13967) 2024-04-16 12:39:46 +02:00
David Carlier
d40726670f
ext/pcntl: pcntl_getqos_class/pcntl_setqos_class addition.
Introducting macOs Quality Of Service through those two calls.
on macOs arm64/M*, there is no concept of individual cores, thus
the old thread policy for cpu affinity does not work here.
Instead, the user can apply to the current process the level of
 performance/energy consumption they wish from the highest
QosClass::UserInteractive to QosClass::Background.

Close GH-13945
2024-04-15 18:52:28 +01:00
Niels Dossche
584a7b8e78
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-13931: Applying zero offset to null pointer in Zend/zend_opcode.c
2024-04-15 19:40:08 +02:00
Ilija Tovilo
c2456e97f5
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fixed missed exception
2024-04-15 17:44:10 +02:00
Ilija Tovilo
887ed94a89
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix clean section in test
2024-04-15 14:15:17 +02:00
Ilija Tovilo
5c671c396e
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix rename test file name collision
2024-04-15 13:43:16 +02:00
Ilija Tovilo
8475cfb695
[skip ci] Add missing if: always() to community tests 2024-04-15 13:20:48 +02:00
Ilija Tovilo
89e744d1e1
[skip ci] Fix old {closure}() name reference in 32-bit tests 2024-04-15 13:11:38 +02:00
Niels Dossche
a136117eaa
Make (DOM)XPath::quote only accept strings without NULL bytes (#13960)
* Make (DOM)XPath::quote only accept strings without NULL bytes

The reason is that libxml will cut off on a NULL byte, and so strings
containing NULL bytes may not be necessarily safe even when coming out
of quoting.

* Add test

Co-authored-by: divinity76 <divinity76@gmail.com>

---------

Co-authored-by: divinity76 <divinity76@gmail.com>
2024-04-14 21:16:07 +02:00
Niels Dossche
8ce9f2e2b0
Add test for performing special operations on XSLTProcessor properties (#13959)
This covers some uncovered code paths in custom property handling in
php_xsl.c
2024-04-14 16:52:54 +02:00
Jakub Zelenka
7fa94c9e54
Merge branch 'PHP-8.3' 2024-04-14 14:33:19 +01:00
Jakub Zelenka
ce4c8ab412
Merge branch 'PHP-8.3' 2024-04-14 14:27:49 +01:00
Niels Dossche
47feb5795c
Support named items in dimension handling for HTMLCollection
Closes GH-13937.
2024-04-14 14:46:04 +02:00
Niels Dossche
b3f820b408
Split off nodelist header components to nodelist.h 2024-04-14 14:45:46 +02:00
Niels Dossche
aa6564cd55
Refactor dom_modern_nodelist_get_index() 2024-04-14 14:45:46 +02:00
Niels Dossche
53f6e5ecd8
Move node list dimension handling to a separate file 2024-04-14 14:45:46 +02:00
Niels Dossche
ac039cf716
Implement HTMLCollection::namedItem() 2024-04-14 14:45:45 +02:00
Niels Dossche
5c69b2e86f
Factor out reading an attribute value 2024-04-14 14:45:45 +02:00
Jorg Adam Sowa
4829b8f2cb
ext/session: Add test for session_start with read_and_close option (#13799) 2024-04-14 13:22:43 +01:00
Niels Dossche
6df8111a8d
[ci skip] UPGRADING
Reorganize performance section.
Add performance entry for GH-13041.
2024-04-14 13:59:47 +02:00
David CARLIER
26c432d850
ext/posix: changing helpers return to zend_result. (#13957) 2024-04-13 22:04:55 +01:00
Niels Dossche
72b2524c58
[ci skip] NEWS
News for GH-13041.
2024-04-13 01:40:57 +02:00
Niels Dossche
55dfd45581
Fix bug #63937: Upload speed 10 times slower with PHP (#13041)
There are two slow parts in the upload logic:
- Reading from the input stream character by character
- Checking each character one by one to normalize line endings

First of all, the line normalization isn't necessary for binary
transfers, so we can use a simple read while loop to read bytes into the
transfer buffer.

Second, for the ASCII transfer where we do have to normalize line
endings, we can be smarter than reading one character at a time. There's
a php_stream_get_line() function that we can repurpose if the flags for
the stream are set up properly.

This patch implements these fixes.

Results: I tested this on an 850 MiB file, transferring this to an FTP
server running locally.

Results before patch:
Binary/ASCII transfer (same code path): 8.21s

Results after patch:
Binary transfer: 0.65s
ASCII transfer: 0.74s

Further improvement is probably possible by having a larger send buffer.
2024-04-13 01:39:31 +02:00
Tim Düsterhus
08b2ab22f4
Include the source location in Closure names (#13550)
* Include the source location in Closure names

This change makes stack traces involving Closures, especially multiple
different Closures, much more useful, because it's more easily visible *which*
closure was called for a given stack frame.

The implementation is similar to that of anonymous classes which already
include the file name and line number within their generated classname.

* Update scripts/dev/bless_tests.php for closure naming

* Adjust existing tests for closure naming

* Adjust tests for closure naming that were not caught locally

* Drop the namespace from closure names

This is redundant with the included filename.

* Include filename and line number as separate keys in Closure debug info

* Fix test

* Fix test

* Include the surrounding class and function name in closure names

* Fix test

* Relax test expecations

* Fix tests after merge

* NEWS / UPGRADING
2024-04-12 18:21:13 +02:00
Arnaud Le Blanc
ab589e4481
Add GDB pretty-printers for zend_ast, zval (#13520) 2024-04-12 13:58:24 +02:00
Arnaud Le Blanc
4058082459
Add GDB pretty-printers for zend_string, zend_type (#13463) 2024-04-12 13:00:07 +02:00
Jakub Zelenka
d24086b7ba
Merge branch 'PHP-8.3' 2024-04-12 11:04:41 +01:00
Peter Kokot
a6fdd8fb19
Update ext/ldap sanity check (#13946)
The ldap_bind_s() has been deprecated and isn't used in the code in
favor of ldap_sasl_bind_s(). PHP falls back to deprecated
ldap_simple_bind_s() if for some reason ldap_sasl_bind_s() isn't
available and this check likewise.
2024-04-12 10:20:26 +02:00
Ørjan Malde
3a40e3d95b
Use a link test to check for GNU libiconv (#13894) 2024-04-11 21:57:59 +02:00
Máté Kocsis
843946a867
Add upgrading note for the "Dedicated StreamBucket class" RFC
[skip-ci]
2024-04-11 20:16:54 +02:00
Máté Kocsis
be2f454d6e
Add dedicated StreamBucket class (#13111)
RFC: https://wiki.php.net/rfc/dedicated_stream_bucket
2024-04-11 20:11:40 +02:00
Niels Dossche
bc62b41126
Merge branch 'PHP-8.3'
* PHP-8.3:
  ext/fileinfo/tests/bug78987.phpt: increase a memory limit
2024-04-11 15:58:25 +02:00
Arnaud Le Blanc
91b84571f0
Fix TLS access in JIT with Musl (#13927)
ABI specifies that each DTV element is 8 bytes in size on x86-64. The factor 16
was defined in 71cccc0bcc, but it's probably
a merge error of 94ba883e19, which used the right
value.
2024-04-11 13:34:54 +02:00
Arnaud Le Blanc
47f0a06d34 Merge branch 'PHP-8.3'
* PHP-8.3:
  [ci skip] NEWS
  [ci skip] NEWS
  Fix usage of reentrant functions in ext/posix (#13921)
2024-04-11 13:32:17 +02:00
Saki Takamachi
5d91f8761b
Remove rscale in bc_raisemod
power is a copy of base and returns early if base->n_scale is non-zero. Since
scale is size_t, it is always greater than or equal to 0, so rscale is always
the value of scale.
2024-04-11 08:59:48 +09:00
David CARLIER
c2553a28e1
sapi/fcgi: update listen queue size handling. (#13939)
the default backlog does not necessarily need to be higher than 128,
however for systems like haiku it s mor benefitial to be actually lower.
2024-04-10 23:46:41 +01:00
Máté Kocsis
4a0ec3de46
Make ext/odbc default value handling more consistent (#13910)
These changes are carved off from https://github.com/php/php-src/pull/12040/files. I noticed that there are some inconsistencies between odbc_fetch_object()/odbc_fetch_array(), odbc_fetch_into(), as well as odbc_fetch_row(), specifically in how they handle the $row parameter. Now, I tried to align their behaviour the following way:

- I made null the default value. Previously, the default values were one of the following: -1, -1, 0, and null, respectively.
- odbc_fetch_row() has been returning false indicating there is no more rows when 0 is passed as $row. Now, a warning is also emitted in this case, because the null default value is not new, because it's available since PHP 8.0.
- When HAVE_SQL_EXTENDED_FETCH is not defined, the $row parameter is always ignored. Previously, some of the functions didn't accept it at all. Now a warning is emitted if the feature is not supported, but the parameter has any meaningful value (is greater than or equal to 1).
2024-04-10 22:49:41 +02:00
Peter Kokot
4d28e40804
Improve check for broken iconv //IGNORE (#13898)
Previous check defined the symbol ICONV_BROKEN_IGNORE to 0 or 1 and the
`#ifdef` macro condition in iconv.c file was always using a bypass. Even
when the //IGNORE is supported (for example, on GNU Libiconv).

With this change, the ICONV_BROKEN_IGNORE symbol is only defined if the
//IGNORE Autoconf check fails or when cross-compiling without setting
the php_cv_iconv_ignore variable.

This also enables overriding the ext/iconv //IGNORE check when
cross-compiling, by setting the php_cv_iconv_ignore variable to "yes" in
case the iconv library is known to have a working //IGNORE (for example,
GNU libiconv).

These cache variables can be set at configure step, when cross-compiling

    ./configure php_cv_iconv_ignore=yes
2024-04-10 22:16:15 +02:00
Bob Weinand
99cfedfcf6 Merge branch 'PHP-8.3' 2024-04-10 20:39:02 +02:00
David Carlier
0e16e29b40
ext/sockets: socket_create_listen update.
going from 128 to system's SOMAXCONN by default to be able to increase
the queue of connections to be handled.
Also, for Haiku SOMAXCONN is only 32.

Close GH-13854
2024-04-10 18:39:38 +01:00
Yuya Hamada
44e8301cf6
Add grapheme_str_split function
I noticed that PHP does not have a grapheme cluster based str_split function.
So I created the grapheme_str_split function.

This feature will allow you to correctly handle emoji
and variable selectors.

Co-authored-by: Ayesh Karunaratne <Ayesh@users.noreply.github.com>

Close GH-13580
2024-04-10 18:20:23 +01:00
Niels Dossche
78ccea4e40
Fix GH-13863: Removal during NodeList iteration breaks loop
The list is live, so upon cache invalidation we should rewalk the tree
to sync the index again with the node list. We keep the legacy behaviour
for the old DOM classes.

Closes GH-13934.
2024-04-10 19:07:59 +02:00
Niels Dossche
2bf9da6e3d
Fix key data for NodeList iterations 2024-04-10 19:07:52 +02:00
Niels Dossche
51ff37b618
Factor out dom_fetch_first_iteration_item() 2024-04-10 19:07:52 +02:00
Eric Mann
c18fa43202
Merge branch 'PHP-8.3' 2024-04-10 08:46:35 -07:00
Kamil Tekiela
72f94a127f
Merge branch 'PHP-8.3'
* PHP-8.3:
  ext/mysqlnd: support ER_CLIENT_INTERACTION_TIMEOUT
2024-04-10 13:37:36 +02:00
David Carlier
39c67e37db
Merge branch 'PHP-8.3' 2024-04-10 10:01:57 +01:00
Dmitry Stogov
a37d661db5
Fix false positive test failure 2024-04-10 09:01:46 +03:00
Ben Ramsey
2a1cc4eecb
Merge branch 'PHP-8.3' 2024-04-10 00:51:42 -05:00
Ben Ramsey
7ca4300db8
Merge branch 'PHP-8.3' 2024-04-09 23:55:11 -05:00
Saki Takamachi
fc14f17a20
remove ZWSP 2024-04-10 10:02:24 +09:00
Saki Takamachi
158788e05f
Merge branch 'PHP-8.3'
* PHP-8.3:
  NEWS: remove ZWSP
2024-04-10 10:00:46 +09:00
Bob Weinand
6d848fa2de Add zend_test.observer.enabled=0 to more tests 2024-04-10 01:17:10 +02:00
Peter Kokot
de03a7c8f9
Remove unused os/signpost.h header check (#13920)
Removed via be275433d9.
2024-04-09 23:52:57 +02:00
David Carlier
645af9fb17
ext/sockets: adding solaris/illumos SO_EXCLBIND constant.
when set to "true", neutralises the effect of SO_REUSEADDR/SO_REUSEPORT
making the socket binding exclusive.

Close GH-13912
2024-04-09 21:41:22 +01:00
Dmitry Stogov
11d3ded235
Fix more "Applying non-zero offset XX to null pointer" warnings (See GH-13834) 2024-04-09 23:12:33 +03:00
Dmitry Stogov
5708df71a7
Update IR
IR commit: babd9980d84be8b804b16859ed52704e7895f0e5
2024-04-09 22:41:33 +03:00
Arnaud Le Blanc
fd73681c86
Fix GCC warning when using getThis() in a conditional (#13923)
Since GCC 12.x, using getThis() in a conditional yields a warning:

    <source>:12:22: warning: the comparison will always evaluate as 'true' for
                    the address of 'This' will never be NULL [-Waddress]
       12 |     return getThis() ? 2 : 3;
          |                      ^
2024-04-09 19:09:07 +02:00
David Carlier
db2869346c
ext/posix: posix_isatty set errno for it too.
Close GH-13918
2024-04-09 17:34:03 +01:00
Máté Kocsis
2079da0158
Fix #13865 Improve parameter and return value related deprecation messages (#13913)
I added the function/method name to some compile-time deprecation messages which are related to parameters/return values. Consistently with the other similar error messages, I included the function/method name at the start of the message.
2024-04-08 22:20:32 +02:00
Niels Dossche
0bc5cb625e
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-13903: ASAN false positive underflow when executing copy()
2024-04-08 21:04:41 +02:00
Bob Weinand
e9292c3d3d Merge branch 'PHP-8.3' 2024-04-08 20:22:02 +02:00
qiangxuhui
0766ac6e35
loongarch64 support for fibers
Add loongarch64 assembly files from Boost, needed for fibers support,
and hook up loongarch64 fibers support during configure.

Close GH-13914
2024-04-08 18:59:02 +01:00
Niels Dossche
ae5220aed6
Avoid call to php_socket_errno() if possible (#13909)
This call is only necessary if ret < 0.
Note that I also had to reoder the checks for EWOULDBLOCK, EMSGSIZE, EAGAIN
to avoid a false positive GCC warning about a duplicate condition
(EAGAIN == EWOULDBLOCK on my system).
2024-04-08 19:53:01 +02:00
Niels Dossche
9b5749a97e
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix potential NULL pointer dereference before calling EVP_SignInit
2024-04-08 19:31:20 +02:00
Bob Weinand
13c8d9317f Merge branch 'PHP-8.3' 2024-04-08 15:25:00 +02:00
Arnaud Le Blanc
345580c5e8 Merge branch 'PHP-8.3'
* PHP-8.3:
  [ci skip] NEWS
  [ci skip] NEWS
  Fix cookie_seek_function_t signature under musl (#13890)
2024-04-08 15:03:37 +02:00
David CARLIER
7c860628cd
ext/pcntl: getpriority/setpriority who default value handling change. (#13911)
0 refers to the calling process, all across unixes, thus saving one
syscall.
2024-04-07 22:30:48 +01:00
Niels Dossche
68592c84a1
Merge branch 'PHP-8.3'
* PHP-8.3:
  Improve stability of test gh13860.phpt
2024-04-07 22:50:28 +02:00
tekimen
0f1e97957a
Fix GH-13789: build failed mbstring_arginfo.h when Visual C++ on Windows (#13906)
Probably CP932 environment can't compile. So add /utf-8 flag.
2024-04-07 21:43:46 +02:00
Niels Dossche
1e4bb039eb
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-13860: Incorrect PHP_STREAM_OPTION_CHECK_LIVENESS case in ext/openssl/xp_ssl.c - causing use of dead socket
2024-04-07 21:37:09 +02:00
David Carlier
d8f2900574
ext/pcntl: adding pcntl_getcpu.
using sched_getcpu under the hood (Linux and FreeBSD).
Returns the current cpu id for the current process.
For Linux, we need to see beyond the sole presence of the symbol
to consider it.
Mostly useful, for now, in the cpu affinity context since
the os can migrate processes as it sees fits otherwise.

Clos GH-13908
2024-04-07 20:05:03 +01:00
David CARLIER
dd2ffaab2c
ext/pcntl: pcntl affinity improves EINVAL handling in both cases. (#13907)
also disable tests on travis.
2024-04-07 16:43:36 +01:00
Niels Dossche
814098248c
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix persistent local flag in session url updating (#13905)
2024-04-07 15:25:15 +02:00
David Carlier
01817e99ab
ext/pcntl pcntl_signal_get_handler update.
The situation varies from platform to another, thus taking in
account the complexity of it.

Close GH-13902
2024-04-07 13:25:45 +01:00
Bob Weinand
a22a87243f
Add next handler parameter to zend_observer_remove_begin/end_handler (#13807)
The usage of the current API within an observer handler leads to bugs like https://bugs.xdebug.org/view.php?id=2232.
Given two observer handlers, next to each other. The first one is executed. It removes itself. The second observer handler gets moved to the place of the first. The first one returns. The handler in the second slot is fetched, but is now NULL, because the it's now in the slot of the first observer; i.e. the second handler is skipped and the begin/end symmetry guarantee is violated.

Providing the next handler to the caller is a zero-cost way to avoid any impact in the paths of zend_observe_fcall_begin/end.

Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
2024-04-07 14:06:25 +02:00
Niels Dossche
a0da32a42d
Cleanup and optimize attribute value reading (#13897)
When the attribute has a single text child, we can avoid an allocating
call to libxml2 and read the contents directly.

On my i7-4790, I tested the optimization with both the $value and
$nodeValue property.

```
Summary
  ./sapi/cli/php bench_value.php ran
    1.82 ± 0.09 times faster than ./sapi/cli/php_old bench_value.php

Summary
  ./sapi/cli/php bench_nodeValue.php ran
    1.78 ± 0.10 times faster than ./sapi/cli/php_old bench_nodeValue.php
```

Test code:
```
$dom = new DOMDocument;
$dom->loadXML('<root attrib="this is a relatively short text"/>');
$attrib = $dom->documentElement->attributes[0];

for ($i=0; $i<1000*1000; $i++) {
	$attrib->value; // or nodeValue
}
```
2024-04-07 13:08:31 +02:00
David CARLIER
0086815773
adding myself to ext/pcntl ext. (#13901) 2024-04-07 09:35:36 +01:00
Máté Kocsis
365e211884
Convert odbc_bindcols() function to void (#13900) 2024-04-07 08:44:37 +02:00
David Carlier
1cf8291c85
ext/pcntl: cpu affinity api introduction.
For now, working on Linux, FreeBSD >= 13.x and DragonFlyBSD.
Handy wrapper to assign an array of cpu ids or to retrieve the cpu ids
assigned to a given process.

pcntl_setaffinity inserts valid unique cpu ids (within the range of available
cpus).

Close GH-13893
2024-04-07 00:56:54 +01:00
Juan Morales
c96b975f67
filter_input_array - Implement solution 2 of GH-13805 (#13804) 2024-04-07 00:18:12 +02:00
Máté Kocsis
9a4847acf5
Get rid of non-exposed solid_fetch_prev() function
Somehow it wasn't exposed to userland.
2024-04-06 22:56:23 +02:00
Máté Kocsis
b981d4aff9
Declare true return type for ext/odbc functions 2024-04-06 22:56:23 +02:00
Tim Düsterhus
7c851042cb
random: Add clarifying comments to the implementation of CombinedLCG
The implementation is needlessly obfuscated. It's not immediately clear that
MODMULT is a simple modular multiplication, despite its name. Specifically it's
not clear which of the parameters is the second factor.

Furthermore the stated period is off-by-one: A value of `0` is part of its own
chain, thus it may not be included in the period of the underlying generators.
2024-04-06 17:46:28 +02:00
Niels Dossche
cf313321c2
Merge branch 'PHP-8.3'
* PHP-8.3:
  [ci skip] NEWS
  Fix GH-13891: memleak and segfault when using ini_set with session.trans_sid_hosts (#13892)
2024-04-06 13:45:10 +02:00
Niels Dossche
0a0e8064e0
Fix serialization of entity references in attributes (#13884) 2024-04-05 19:58:01 +02:00
Ilija Tovilo
536305436f
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix opcache dump varying tmps
2024-04-05 14:12:23 +02:00
David CARLIER
2508138532
ext/pcntl: pcnt_setns few nitpicks changes. (#13885) 2024-04-04 21:05:35 +01:00
David Carlier
ae4978a139
ext/pcntl: adding pcntl_setns for Linux >= 5.3
allows a given process to join an existing Linux namespace, relatively
complementary to the existing pcntl_unshare.

Close GH-13878
2024-04-04 18:45:15 +01:00
Niels Dossche
e08a5dce8f
Merge branch 'PHP-8.3'
* PHP-8.3:
  [ci skip] NEWS
  Fix shift out of bounds on 32-bit non-fast-path platforms (#10941)
2024-04-04 19:29:36 +02:00
Tim Düsterhus
98b43d07f9
Merge branch 'PHP-8.3'
* PHP-8.3:
  makedist: Reset tar timestamps to the commit date (#13879)
2024-04-04 13:26:47 +02:00
Dmitry Stogov
0bf574afa3
Update IR
IR commit: 709ccf854ec708c36c0dd2a77996554f13e722f3

Fixes failures in function JIT introduced in d2b54dc
2024-04-04 10:09:51 +03:00
Dmitry Stogov
d2b54dc53e
Update IR
IR commit: eee484977acfe97b81b338a16390e218a852ec1c
2024-04-04 01:11:28 +03:00
Niels Dossche
bb1688d732
Fix argument signedness of dom_sanity_check_node_list_types() (#13875) 2024-04-03 18:18:24 +02:00
Niels Dossche
5ca72eca8e
Remove broken check in var_unserializer (#13852)
`end = *p+maxlen`, and pointer overflow is UB, so that means that a check
of the form `end < *p` will always be false because it can only be true
on pointer overflow. In particular, the compiler simplifies this to
`maxlen < 0` which is always false because maxlen is unsigned.
2024-04-03 18:15:56 +02:00
Niels Dossche
15259a0a6c Factor out common "first container's child" code 2024-04-03 18:15:43 +02:00
Niels Dossche
b7bc41341c Remove random newline 2024-04-03 18:15:43 +02:00
Niels Dossche
fc9b58f602 Remove duplicated code for entity vs notation handling 2024-04-03 18:15:43 +02:00
Niels Dossche
fa4d8cd4fa Cleanup create_notation()
We're already clearing memory, and we can merge the declaration and
assignment.
2024-04-03 18:15:43 +02:00
Niels Dossche
aa19461151 Don't use a heap allocation to track the current item 2024-04-03 18:15:43 +02:00
Niels Dossche
6de0486e19 Express php_dom_libxml_notation_iter() using php_dom_libxml_hash_iter() 2024-04-03 18:15:43 +02:00
Niels Dossche
f02fd58809 Get rid of impossible error branch 2024-04-03 18:15:43 +02:00
Niels Dossche
88449f6798 Simplify control flow for special case of php_dom_iterator_move_forward() 2024-04-03 18:15:43 +02:00
Niels Dossche
899b916f71 Merge declarations and assignments in php_dom_iterator_move_forward() 2024-04-03 18:15:43 +02:00
David CARLIER
7a3516cca5
zend_alloc trailing 1 calculation helper ZEND_ATTRIBUTE_CONST addition. (#13874) 2024-04-03 13:46:07 +01:00
Ilija Tovilo
e5f4cdd62f
Fix test that behaves differently w and w/o opcache 2024-04-03 13:24:57 +02:00
David CARLIER
7db7c420f1
ext/pcntl: pcntl_unshare minor error message clarification (for EINVAL). (#13872)
it is not necessarily a bad flag but can just be unsupported by the
current kernel.
2024-04-02 23:26:07 +01:00
Niels Dossche
04e0d80554
Optimize levenshtein a bit for memory usage (#13830)
When all costs are equal, levenshtein fulfills the requirements
of being a metric. A metric is symmetric, so we can swap the strings in
that case. Since we use rows of a partial matrix of length |string2| we
can make the choice of using string1 instead if |string1| < |string2|,
which will optimize memory usage and CPU time.
2024-04-02 23:00:10 +02:00
Bob Weinand
33a523f64e Add missing show_output to test after merge of e7462bff19
Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
2024-04-02 18:39:20 +02:00
Niels Dossche
248b5f5b0f
Remove useless NULL-check in phpdbg_print (#13853)
&method->op_array cannot possibly be NULL because it takes a pointer to
a field of method.
2024-04-02 18:17:21 +02:00
Bob Weinand
18496cc3d4 Merge branch 'PHP-8.3' 2024-04-02 18:13:10 +02:00
David CARLIER
dad2d561e8
adding const attribute to trailing/leading zeros helpers. (#13861)
and adding noreturn to php_sighup_handler for compiler/dev clarification sake.
2024-04-02 12:10:18 +01:00
Niels Dossche
ce2dd0b20b
Fix potential NULL pointer argument to memcpy (#13859)
This is only possible when the length is 0, but memcpy doesn't like NULL
pointers, as UBSAN trips over it.
2024-04-01 22:47:38 +02:00
Niels Dossche
eb1cdb5b72
Fix opline argument for getting the function info for range()
Short-lived regression from 00c6d538ab,
where in one of its commits (that was squashed) not all changes were
reverted correctly.
2024-04-01 22:42:18 +02:00
Dmitry Stogov
50573904b8 Update IR
IR commit: 1689cad28a7af72043a0bc10a04ec8d9dc04b368
2024-04-01 23:35:03 +03:00
Niels Dossche
b9a2533cb3
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix gcc-14 Wcalloc-transposed-args warnings
2024-04-01 20:34:44 +02:00
Niels Dossche
0dc599853a
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-13856: Member access within null pointer of type 'ps_files' in ext/session/mod_files.c
2024-04-01 14:16:28 +02:00
Niels Dossche
17f936eec7
[ci skip] NEWS 2024-04-01 13:49:27 +02:00
Niels Dossche
00c6d538ab
Fix GH-13834: Applying non-zero offset 36 to null pointer in zend_jit.c (#13846)
* Fix GH-13834: Applying non-zero offset 36 to null pointer in zend_jit.c

ssa_op can be NULL in function JIT. Doing pointer arithmetic on a NULL
pointer is undefined behaviour. Undefined behaviour can be dangerous
because the optimizer may assume then that the variable is not actually
NULL.

To solve this:
1. Add ADVANCE_SSA_OP() to safely add an offset to ssa_op in zend_jit.c
2. For inference, add an extra offset argument to the helper functions.

To reproduce this, use Clang (not GCC) on a test like
sapi/cli/tests/gh12363.phpt (or other tests also work).

* Remove -fno-sanitize=pointer-overflow flag from CI

* Fix NULL pointer offsets added to the stack_map

* Fix an offset add on a potentially NULL ssa->ops

* Fix NULL pointer arithmetic in zend_range_info()

* Address review comments
2024-04-01 13:37:15 +02:00
Niels Dossche
c3f5bbde2a
Simplify always-true check in zend_generator_update_current (#13848)
`old_root` is dereferenced at top, so `old_root` must not be NULL, and
the check doesn't actually do anything.
2024-04-01 13:29:09 +02:00
Niels Dossche
30885f3b5f
Implement request #71571: XSLT processor should provide option to change maxDepth (#13731)
There are two depth limiting parameters for XSLT templates.
1) maxTemplateDepth
   This corresponds to the recursion depth of a template. For very
   complicated templates this can be hit.
2) maxTemplateVars
   This is the total number of live variables. When using recursive
   templates with lots of parameters you can hit this limit.

This patch introduces two new properties to XSLTProcessor that
corresponds to the above variables.
2024-03-31 21:21:23 +02:00
David Carlier
089f51319e Merge branch 'PHP-8.3' 2024-03-31 17:01:27 +01:00
Niels Dossche
2d83b60b6c
Merge branch 'PHP-8.3'
* PHP-8.3:
  Skip test on Windows because of different error output
2024-03-31 16:56:27 +02:00
Niels Dossche
33c2d6b9a4
Remove redundant check in mysqlnd_conn_data::connect (#13849)
`conn` is dereferenced at top so it is always non-NULL.
2024-03-31 16:16:49 +02:00
Niels Dossche
f6447b337e
Remove redundant check in mysqlnd_fetch_stmt_row_cursor (#13850)
result is always non-NULL because it is dereferenced above.
Similarly, result->unbuf and stmt must also be non-NULL.
2024-03-31 16:16:27 +02:00
Niels Dossche
eaaf175bbb
Remove redundant check in pdo_raise_impl_error (#13851)
`dbh` is always non-NULL because it is dereferenced at the start of the
function.
2024-03-31 16:16:17 +02:00
Niels Dossche
f590df442f
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-13833: Applying zero offset to null pointer in zend_hash.c
2024-03-31 14:25:47 +02:00
David Carlier
376061e73b
Merge branch 'PHP-8.3' 2024-03-30 22:22:00 +00:00
Jakub Zelenka
bd3b684e04
Merge branch 'PHP-8.3' 2024-03-30 18:37:51 +00:00
Niels Dossche
0c3b389d2c
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-13836: Renaming a file in a Phar to an already existing filename causes a NULL pointer dereference
2024-03-30 18:04:35 +01:00
Jakub Zelenka
dbe35f6d2a
Merge branch 'PHP-8.3' 2024-03-30 14:38:41 +00:00
Juan Morales
186465b1dd
QA - finfo_open - increase test coverage (#13839) 2024-03-30 15:16:06 +01:00
Jakub Zelenka
4d7e3fcb86
Merge branch 'PHP-8.3' 2024-03-29 19:40:03 +00:00
Peter Kokot
6c2d5e5f1c
Fix linking library for POSIX shared memory functions (#13822)
The POSIX shared memory object operations functions (shm_open,
shm_unlink...) are in:
* C library on most systems (newer Linux, Solaris 11.4, illumos, BSD*,
  macOS, Haiku, etc.)
* real-time (rt) library on older Linux distributions and Solaris <= 10.

Haiku C library (called root library) on Haiku is linked in by default.

Previous check always added additional rt or root library to global LIBS
and rt to OPCACHE_SHARED_LIBADD. Now, the library containing shm_open is
linked as needed to the always shared opcache extension.

This also removes unused HAVE_SHM_OPEN and HAVE_LIBROOT symbols.
2024-03-29 20:16:09 +01:00
Niels Dossche
f2b2b7f257 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-13827: Null pointer access of type 'zval' in phpdbg_frame
2024-03-29 17:55:52 +01:00
Jakub Zelenka
09f5e7921e
Merge branch 'PHP-8.3' 2024-03-29 16:33:44 +00:00
Jakub Zelenka
af41d58d6f
Merge branch 'PHP-8.3' 2024-03-29 16:25:40 +00:00
Jakub Zelenka
894e17c139
Merge branch 'PHP-8.3' 2024-03-29 16:09:48 +00:00
Michael Voříšek
a470110ff4 Add tests for destructors behaviour with GC 2024-03-29 16:41:22 +01:00
Paul Ripke
2d6bd1644d Fixed GH-13581: threaded mod_php fails on NetBSD with No space available for Thread Local Storage.
Close GH-13832
2024-03-29 15:16:51 +00:00
David Carlier
b82024b13c ext/sockets: adding Linux's TCP_SYNCNT constant.
Useful to control how many SYN packets the client will send to the
server before giving up establishing a connection if the server does
not respond (usually 5 or 6 by default).

Close GH-13816
2024-03-29 14:52:53 +00:00
Jakub Zelenka
4bc7ea3437
Merge branch 'PHP-8.3' 2024-03-28 15:46:22 +00:00
Peter Kokot
413f2cd427
Refactor root build directories (#13785)
This adds all root build directories in one call. PEAR directory is
created only when enabled and duplicated Zend directory creation is
removed, because it was intended for the zend_config.h when building
out-of-source or using the config.status manually before the
PHP_ADD_BUILD_DIR was introduced in the build system.
2024-03-27 16:20:03 +01:00
SATŌ Kentarō
f00e05ee9c
Remove setlocale pragma that no longer is significant. (#13814) 2024-03-27 09:06:07 +01:00
Remi Collet
6c5814dade
revert base64_encode change 2024-03-27 08:08:43 +01:00
Dmitry Stogov
9fae55f5db Update IR
IR commit: 87cba9af675afd2ca20cbaab397ad1c83d700475
2024-03-27 00:06:15 +03:00
Niels Dossche
6316eb1b2c Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-13433: Segmentation Fault in zend_class_init_statics when using opcache.preload
2024-03-26 21:29:29 +01:00
Eric Mann
93b49d9b75
Merge branch 'PHP-8.3' 2024-03-26 10:26:31 -07:00
Pierrick Charron
0966f1ffe2
Merge branch 'PHP-8.3'
* PHP-8.3:
  PHP-8.2 is now for PHP 8.2.19-dev
2024-03-26 08:51:08 -04:00
Remi Collet
dd6e738fe4
[ci skip] NEWS for base64_encode 2024-03-26 13:50:31 +01:00
Remi Collet
b5446e42b2
add $padding option to base64_encode 2024-03-26 13:45:32 +01:00
Arnaud Le Blanc
412e32d29d Merge branch 'PHP-8.3'
* PHP-8.3:
  Tests are not repeatable
2024-03-26 12:35:40 +01:00
Arnaud Le Blanc
c7ca3e5c27 Merge branch 'PHP-8.3'
* PHP-8.3:
  [ci skip]
  [ci skip]
  Adjust GC threshold if num_roots is higher than gc_threshold after collection (#13758)
2024-03-25 16:24:48 +01:00
Alexander M. Turek
ef93086765
DOM stubs: Reference interfaces from the global namespace correctly (#13801) 2024-03-25 12:06:18 +01:00
Jorg Adam Sowa
f69d540541
Removed impossible paths from session_decode and session_encode (#13796) 2024-03-24 20:20:42 +01:00
Niels Dossche
ab8e0b7bf8 Merge branch 'PHP-8.3'
* PHP-8.3:
  [ci skip] NEWS
  Fix incorrect check in fpm_shm_free() (#13797)
2024-03-24 13:58:48 +01:00
Niels Dossche
191d0501a5
Cleanup dom_html_document_encoding_write() (#13788) 2024-03-23 22:17:58 +01:00
Niels Dossche
93d3ae28e1
Remove obsolete OpenSSL code in ext/ftp MINIT (#13793)
Follow-up on GH-13498.
These functions inside this #if block are either deprecated
or do nothing anymore on OpenSSL versions >= 1.1.0.
2024-03-23 19:32:44 +01:00
Ayesh Karunaratne
a4534fafac ext/openssl: Remove kerberos support
Co-authored-by: Peter Kokot <peterkokot@gmail.com>
2024-03-23 15:12:06 +00:00
Ayesh Karunaratne
3de3e137bf ext/openssl: Bump minimum required OpenSSL version to 1.1.1
Bumps the minimum required OpenSSL version from 1.0.2 to 1.1.1.

OpenSSL 1.1.1 is an LTS release, but has reached[^1] EOL from upstream. However, Linux distro/OS vendors
continue to ship OpenSSL 1.1.1, so 1.1.1 was picked as the minimum. The current minimum 1.0.2 reached
EOL in 2018.

Bumping the minimum required OpenSSL version makes it possible for ext-openssl to remove a bunch of
conditional code, and assume that TLS 1.3 (shipped with OpenSSL 1.1.1) will be supported everywhere.

 - Debian buster: 1.1.1[^2]
 - Ubuntu 20.04: 1.1.1[^3]
 - CentOS/RHEL 7: 1.0.2
 - RHEL 8/Rocky 8/EL 8: 1.1.1
 - Fedora 38: 3.0.9 (`openssl11` provides OpenSSL 1.1 as well)

RHEL/CentOS 7 reaches EOL mid 2024, so for PHP 8.4 scheduled towards the end of this year, we can safely
bump the minimum OpenSSL version.

[^1]: https://www.openssl.org/blog/blog/2023/03/28/1.1.1-EOL/index.html
[^2]: https://packages.debian.org/buster/libssl-dev
[^3]: https://packages.ubuntu.com/focal/libssl-dev
2024-03-23 15:12:06 +00:00
Adam Saponara
0c07b0d94f
Make --enable-embed libs respect --libdir
And make locatable by via `php-config`. Prior to this, `libphp.*`
would always install to `$prefix/lib`. After this, they will install
to `$libdir`.

In practice, this will make it so that programs embedding libphp can
use `php-config` to determine appropriate compile flags without
guessing.

In `configure.ac`, it seems `$libdir` is mutated in some instances.
Ideally the mutated version would be stored in `$phplibdir` or
something. Instead of tracking down all uses of that variable, I
introduced another variable `$orig_libdir` that holds the original
value passed to the configure script.

This is a no-op for users unless they are compiling with `--libdir`
set to something other than `$prefix/lib`, the default.

Closes GH-12389
2024-03-23 07:46:31 +01:00
Peter Kokot
df017cd0ef
Remove unused variable APXS_BINDIR
Last usage removed via d3bc8beb4f.
2024-03-22 16:27:03 +01:00
Niels Dossche
6615476db9 [ci skip] NEWS 2024-03-22 15:01:40 +01:00
Guillaume Outters
bcd3eec44a Fix bug #65106: PHP fails to compile ext/fileinfo
Make data_file.c's generator output its array initialization
"by list of strings", instead of "by list of chars": that makes the compiler
happier.

Use strtr() with a precomputed map, instead of a loop over ord(),
to generate in 1/100th the time.

Avoids ambiguous 0x tokens (as specified in C standards), by using octal.

Closes GH-10422.
2024-03-22 15:00:15 +01:00
haszi
6150bf5ee4
Fix url_rewriter.hosts not used for output_add_rewrite_var()
If fixes issue where session.trans_sid_hosts used instead of
url_rewriter.hosts for output_add_rewrite_var().

Closes GH-13294
2024-03-22 13:57:43 +00:00
Remi Collet
fd28d31fc6
Merge branch 'PHP-8.3'
* PHP-8.3:
  [ci skip] NEWS
  [ci skip] NEWS
2024-03-22 11:39:55 +01:00
Niels Dossche
b9bb8d62ca Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix incorrect charset length in check_mb_eucjpms()
2024-03-22 11:32:23 +01:00
Remi Collet
ec2ace7f83
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix AX_GCC_FUNC_ATTRIBUTE failure
2024-03-22 11:30:24 +01:00
Peter Kokot
530e0d68eb
Create modules directory in a centralized location (#13411)
Shared objects of extensions during the *nix build are copied to the
`modules` directory. It is a practice established since the early days
of the PHP build system. Other build systems may have similar concept of
"library destination directory". On Windows, they are put into the root
build directory. Such directory simplifies collection of the shared
extensions during testing, or when running the cli executable at the end
of the build process.

This change ensures that the directory is consistently created in a
single location, for both the primary PHP build process and when
utilizing `phpize` within community extensions.

The AC_CONFIG_COMMANDS_PRE is executed at the end of the configuration
phase, before creating the config.status script, where also build
directories and global Makefile are created.

The pwd is executed using the recommended $(...) instead of the obsolete
backticks. Autoconf automatically locates the proper shell and
re-executes the configure script if such case is found that $(...) is
not supported (the initial /bin/sh on Solaris 10, for example).
2024-03-21 17:43:49 +01:00
Peter Kokot
79e4ca1e41
Remove outdated Zend/zend_istdiostream.h file (#13765)
This removes the unused and obsolete Zend/zend_istdiostream.h header and
symbols on Windows:
- HAVE_STDIOSTR_H
- HAVE_CLASS_ISTDIOSTREAM
- istdiostream
2024-03-21 10:37:14 +01:00
Niels Dossche
e1630381b7
Fix GH-13764: xsl cannot build on PHP 8.4 (#13770)
Move some of the DOM APIs from the non-public php_dom.h header to the
public header xml_common.h.
2024-03-20 19:03:09 +01:00
tekimen
4d51bfa270
[RFC] Add mb_ucfirst and mb_lcfirst functions (#13161) 2024-03-20 17:25:19 +01:00
Niels Dossche
5430ecd3db Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix phpdoc for DOMDocument load methods
2024-03-20 17:23:47 +01:00
Ilija Tovilo
8dbc4b61c3
Disable ASLR for benchmark (#13769) 2024-03-20 17:20:29 +01:00
Peter Kokot
4bf64b53ef
Remove unused zend_dump_variables() (#13767) 2024-03-20 14:37:32 +01:00
Peter Kokot
b7e1ec9108
Remove unused zend_shutdown_constants() (#13657)
The zend_shutdown_constants() usage was removed in
21698c12fe (memory leak)
and in b80cb7bd2f (unicode support).
2024-03-20 14:12:45 +01:00
Dmitry Stogov
f87632e7ca Update IR
IR commit: 7586ac611a32d8f4116721b1d96b855c1087eac9
2024-03-20 13:49:21 +03:00
Dmitry Stogov
fa512dc4cb Use new abilities or ir_save() 2024-03-20 13:22:47 +03:00
Dmitry Stogov
eb513503c0 Update IR
IR commit: 0e3608e3c945140d366134034ee8d86edbe6d050
2024-03-20 13:22:11 +03:00
Dmitry Stogov
0bf063dce6 Disabe test for 32-bit build 2024-03-20 13:21:41 +03:00
Ilija Tovilo
bc59e79d21
Merge branch 'PHP-8.3'
* PHP-8.3:
  Restore error handler after running it
2024-03-20 10:53:35 +01:00
Tim Düsterhus
6fb20cd9de
random: Simplify implementation of php_random_generate_fallback_seed() (#13761)
As all the input bits and pieces are mixed with SHA-1, cross-architecture
compatibility is not required and we can just mix in whatever they may look
like in memory, instead of going through the `write_*()` helpers that were
created for a previous in-development version that first filled a buffer that
was then hashed (allowing for easy inspection of the input data, but making it
harder to safely add values without checking for buffer overflows all the
time).

This change should also fix a build error on macOS ZTS: The thread ID is an
opaque type and not guaranteed to be arithmetic as per IEEE Std 1003.1-2017.
And indeed macOS defines it as a pointer to a structure, failing due to the
implicit pointer to integer conversion.
2024-03-20 09:41:01 +01:00
David Carlier
2e7c6e1eb2 freebsd CI reeanable werror 2024-03-19 22:39:32 +00:00
David Carlier
623a980af3 Merge branch 'PHP-8.3' 2024-03-19 22:38:43 +00:00
David Carlier
f2f656c97e CI: update freebsd 13 image.
13.2 is going to be EOL.

close GH-13622
2024-03-19 22:36:33 +00:00
Tim Düsterhus
807524d61c
random: Use CSPRNG for CombinedLCG seeding (#13748)
Now that the CombinedLCG is no longer used within GENERATE_SEED(), we can
safely use the CSPRNG with a php_random_generate_fallback_seed() fallback to
seed the CombinedLCG.
2024-03-19 20:13:44 +01:00
Ilija Tovilo
5b7d45822a
Fix missing llvm deps inside docker 2024-03-19 17:34:18 +01:00
Ilija Tovilo
25a8f155f2
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix ASan build
2024-03-19 17:17:21 +01:00
Arnaud Le Blanc
df7252624f [ci skip] NEWS 2024-03-19 13:06:29 +01:00
Arnaud Le Blanc
1bae61a4d2
Compress interned string table offsets and increase maximum supported buffer size (#13676)
Compress interned string table offsets and increase maximum supported buffer size

The interned string buffer is organized as a header + a hash table + a
zend_string arena. Hash slots point to the arena, but are represented as 32bit
offsets from the buffer, which limits the maximum buffer size to about 4GiB.
However zend_strings are 8-byte aligned in the buffer, so we can compress the
3 lower bits. This allows to increase the maximum supported interned string
buffer size from 4095 MiB to 32767 MiB.
2024-03-19 13:01:30 +01:00
Máté Kocsis
5bb03158b6
Add the last few remaining constants to stubs (#13751)
Basically all constants are now declared via stubs. The rest of the constants are either deprecated (`SID` or `MHASH_*`) or out of interest (`__COMPILER_HALT_OFFSET__` and `PHP_CLI_PROCESS_TITLE`).
2024-03-19 08:20:33 +01:00
David CARLIER
51dafc6054
Fix GH-13745: fix header inclusion in pdo_pgsql.c (#13749)
pdo/php_pdo_int.h is not part of the PDO's headers to install.
2024-03-18 23:07:41 +00:00
Máté Kocsis
5992a29724
Improve BC support of arginfo files fenerated by gen_stub.php (#13705)
- Declared compatibility expectations of stub files are now enforced by a ZEND_STATIC_ASSERT call at the top of arginfo files
- Property registration for PHP 7 is fixed: function zend_declare_property_ex() is used again instead of zend_declare_typed_property(). This has been a regression since I added support for exposing doc comments.
- As a defensive measure, deep cloning is performed before newer features (type declarations, attributes etc.) are discarded before generating legacy arginfo files. Until now, some of the objects were forgotten to be taken care of. These omissions may have resulted in some weird bugs in theory (but probably they didn't have much impact in practice).
- PHP version related conditions inside *non-legacy arginfo files* used to possibly check for the 70000 version iD until now if compatibility with PHP 7.0 was declared in a stub. This was not 100% correct, since non-legacy arginfo files are only for PHP 8.0+. Now, I made sure that at least PHP version ID 80000 is used in the preprocessor conditions. The solution was a bit tricky though...
2024-03-18 22:06:17 +01:00
Bob Weinand
4e934d789e Merge branch 'PHP-8.3' 2024-03-18 20:26:24 +01:00
Dmitry Stogov
968a807d97 Update IR
IR commit: 84df6f8d409c7d06daa68d96a25d0aed81dcbf4a
2024-03-18 21:47:06 +03:00
Bob Weinand
9bed0b5f2f Merge branch 'PHP-8.3' 2024-03-18 19:06:12 +01:00
Niels Dossche
f47b7f1c70
Cleanup name handling in magic methods (#13733)
The copy was introduced in bc59289b7, and later changed in 57527455eb,
to prevent indirect modifications of magic method arguments.
This is no longer necessary because we no longer deal with zvals, but
with string directly that the VM has retrieved either as a constant, or
via zval_try_get_tmp_string().
2024-03-18 17:48:12 +01:00
Marc Bennewitz
805326fe18
An uninitialized DateTime is UNEXPECTED (#13492) 2024-03-18 16:38:30 +00:00
Bob Weinand
d539c4b8f6 Merge branch 'PHP-8.3' 2024-03-18 17:22:48 +01:00
Tim Düsterhus
81744d6cf7
random: Improve the output quality of RANDOM_SEED() (#13730)
* random: Improve the output quality of RANDOM_SEED()

Previously 4 consecutive calls to `RANDOM_SEED()` each for 4 different CLI
requests resulted in:

    $ sapi/cli/php test.php
    2c13e9fde9caa
    2c13e9fd1d6b0
    2c13e9fd4de34
    2c13e9fd1610e
    $ sapi/cli/php test.php
    2c1436764fe07
    2c14367621770
    2c143676c0bf6
    2c143676e02f5
    $ sapi/cli/php test.php
    2c144995a0626
    2c14499590fe2
    2c144995c65db
    2c14499536833
    $ sapi/cli/php test.php
    2c145cb30860b
    2c145cb3ec027
    2c145cb33b4ca
    2c145cb38ff63

Now they result in:

    $ sapi/cli/php test.php
    6796973ace1b5f3d
    1913daf5c158cb4b
    255dbf24237bc8c9
    7c3ba22e60f35196
    $ sapi/cli/php test.php
    afb7cc9ba9819cd2
    3e01a71b91ad020c
    6b718364d3ef108
    bdcd17beeb4b31d2
    $ sapi/cli/php test.php
    53d36eb9b83f8788
    4381c85e816187aa
    2e9b32ee9898e71e
    31d15c946842bddb
    $ sapi/cli/php test.php
    2037a3cba88114b4
    ba0b0d93a9bb43aa
    e13d82d2421269e2
    191de474f3292240

* tree-wide: Replace GENERATE_SEED() by php_random_generate_fallback_seed()

* random: Fix NTS build

* random: Fix Windows build
2024-03-18 16:08:23 +01:00
Peter Kokot
4f7a3d9053
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-12019: ext/gd/config.m4: don't forget GDLIB_CFLAGS in feature tests
2024-03-18 11:59:34 +01:00
David Carlier
952cc2a675 Merge branch 'PHP-8.3' 2024-03-18 06:59:29 +00:00
Máté Kocsis
56cf09f23a
Improve optimizer support for class constants (#13438)
The following optimizations are added:

- Constant folding of final class constants
- Type inference of typed class constants
2024-03-18 07:30:44 +01:00
Peter Kokot
0aadc7e7ff
Fix string concatenation in ZEND_JIT_SRC variable (#13740)
The += operator only works in bash shells and when using /bin/sh, for
example in Alpine Linux, the warning is thrown during configuration step

./configure: line 51396: ZEND_JIT_SRC+= jit/ir/ir_disasm.c: not found
2024-03-18 06:58:30 +01:00
Gina Peter Banyard
a648365fc0
ext/spl: Throw TypeError when overloaded SplObjectStorage::getHash() method does not return a string 2024-03-17 23:08:58 +00:00
Gina Peter Banyard
610c7a07b1
Move SplObjectStorage test to a folder 2024-03-17 23:08:47 +00:00
David Carlier
4c467e6eb8 ext/sockets: adding few constants for NetBSD.
SOCK_CONN_DGRAM (and its alias SOCK_DCCP) for connection orientated
datagram.

Close GH-13728
2024-03-17 21:44:22 +00:00
Nikita Popov
67184f5445
Fix PdoSqlite::loadExtension() test (#13736)
The test contained a syntax error and an incorrect use of loadExtension(), which returns void not bool.

Also install the necessary package in CI, so it gets tested there.
2024-03-17 22:27:09 +01:00
Niels Dossche
47b6eabe37 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-13685: Unexpected null pointer in zend_string.h
2024-03-17 18:38:44 +01:00
Niels Dossche
b955973818 Only register error handling when observable
Closes GH-13702.
2024-03-17 18:24:40 +01:00
Niels Dossche
9fd74cfc9d Use temporary variables to reduce memory stores 2024-03-17 18:21:59 +01:00
Niels Dossche
cbc421e163 Add fast path for ASCII bytes in UTF-8 validation 2024-03-17 18:21:59 +01:00
Bob Weinand
6f49474542 Merge branch 'PHP-8.3' of https://github.com/php/php-src 2024-03-17 03:17:15 +01:00
Arnaud Le Blanc
bf4311325c Skip new_oom.phpt if ZMM is disabled
Test requires ZMM
2024-03-16 15:56:33 +01:00
Máté Kocsis
b06c95b631
Declare the missing true return types (#13709) 2024-03-16 07:26:37 +01:00
Niels Dossche
fcdcfe924a Merge branch 'PHP-8.3'
* PHP-8.3:
  Add missing DOM dependency in config.m4 for ext/xsl
2024-03-15 22:56:49 +01:00
Peter Kokot
c6f4c26e1b
Check major, minor and makedev with Autoconf's AC_HEADER_MAJOR (#13706)
The non-standard major(), minor(), and makedev() can be defined as
macros. These are usually used together with the Autoconf macro
AC_HEADER_MAJOR, which defines the MAJOR_IN_MKDEV if sys/mkdev.h is
available, or MAJOR_IN_SYSMACROS if sys/sysmacros.h is available.

On Solaris/illumos they are in the sys/mkdev.h header (macro defined to
libc implementation) and in sys/sysmacros.h (macro defined with binary
operators and bits shifting). On systems with musl and glibc 2.28 or
later they are defined in sys/sysmacros.h, in glibc 2.27 and earlier
they were in sys/types.h. On BSD-based systems and macOS they are in the
sys/types.h.

Autoconf 2.70 has fixed the AC_HEADER_MAJOR macro, so it detects the
headers properly due to glibc 2.25 throwing deprecation warnings when
using the macros from sys/types.h. With Autoconf 2.69 and earlier the
ac_cv_header_sys_types_h_makedev cache variable can skip the
improper sys/types.h check in the macro.

This change syncs the usage within the ext/fileinfo/libmagic bundled
library and ext/posix.

When sys/mkdev.h header is available, code includes that, otherwise
it conditionally includes the sys/sysmacros.h. The ext/posix has
additional check whether linker sees the makedev, otherwise it checks
if makedev is declared within the given set of headers accoring to the
AC_HEADER_MAJOR logic. Previously the AC_CHECK_FUNCS didn't detect it.
2024-03-15 21:18:05 +01:00
Peter Kokot
e1181a64d4
Remove HAVE_MYSQL (#13719)
The ext/pdo_mysql symbol has been once used together with the removed
ext/mysql extension and isn't defined on Windows neither used in the
code anymore.
2024-03-15 20:33:59 +01:00
Saki Takamachi
54ee85ba88
Merge branch 'PHP-8.3'
* PHP-8.3:
  Changed the test expected value of `mysqli::info` to `%s` (#13723)
2024-03-16 00:15:20 +09:00
Peter Kokot
072e67fd01
Fix unused variable warning in sapi/litespeed (#13718) 2024-03-15 08:56:35 +01:00
Peter Kokot
d2eb3e54ea
Check asm goto support with AC_LINK_IFELSE (#13716)
The '__asm__ goto' support is properly recognized by a simpler linking
check instead of a run check for easier cross-compilation. The
compile only check (AC_COMPILE_IFELSE) might produce false positives
results with certain compiler options.
2024-03-15 06:44:27 +01:00
Peter Kokot
ec394cc26a
Fix implicitly marking parameter as nullable deprecation warning (#13714)
A follow up around the php-src code regarding the RFC:
https://wiki.php.net/rfc/deprecate-implicitly-nullable-types
2024-03-14 21:51:55 +01:00
Niels Dossche
2b77e5bc6b Fix compile warning 2024-03-14 21:22:03 +01:00
Niels Dossche
eaf27400e6 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix potential memory leak in XPath evaluation results
2024-03-14 21:13:14 +01:00
Dmitry Stogov
586153b9ef Update IR
IR commit: 2c5b63d4b89b25a323444f6629e6d7c9e9d17300
2024-03-14 22:23:05 +03:00
David Carlier
250b160886 Merge branch 'PHP-8.3' 2024-03-14 18:59:57 +00:00
Niels Dossche
affd175116
Fix parameter hints in php_xsl.stub.php (#13704)
After the spec compliance PR landed, DOMDocument no longer inherits from
DOM\Document, and so the type hint needs to be updated.
2024-03-14 19:27:44 +01:00
Saki Takamachi
94d18cb1d3
[skip ci] CODEOWNERS 2024-03-14 07:47:53 +09:00
Máté Kocsis
577db99462
Verify stub aliases in CI (#13682)
In the same time, let's not verify implementation aliases since they may now legitimately differ from their aliased function/method counterparts (think about the ext/dom refactoring where e.g. many return type declarations have changed). Additionally, unnecessary `@no-verify` tags are cleaned up.
2024-03-13 23:32:35 +01:00
Niels Dossche
cc0260e014
Change return type of DOM\HTMLDocument::saveHTML() (#13701)
Strict error checking is always true for classes in "new DOM".
This means that we always throw an error when calling
`php_dom_throw_error`, and therefore the false return value is not
actually possible.
Also change the stub to reflect this.
2024-03-13 21:49:40 +01:00
Máté Kocsis
330cc5cdb2
Deprecate implicit nullable parameter types (#12959)
RFC: https://wiki.php.net/rfc/deprecate-implicitly-nullable-types

Co-authored-by: Gina Peter Banyard <girgias@php.net>
2024-03-13 21:40:26 +01:00
David Carlier
b3410360cc ext/gettext: updating apis accepting domain behavior.
to be more in line with the proper usage ; normally domain should not
be empty strings.

Close GH-13691
2024-03-13 20:33:47 +00:00
David Carlier
c2d20f48c5 Merge branch 'PHP-8.3' 2024-03-13 19:35:50 +00:00
Tim Düsterhus
7c63a43deb
Merge branch 'PHP-8.3'
* PHP-8.3:
  random: Initialize the `mode` field when seeding in `php_random_default_status()` (#13690)
2024-03-13 20:16:02 +01:00
Dmitry Stogov
3bf4bcc775 Update IR
IR commit: 1d3df9f7dd82fe49001e714a4c31962387b526f6
2024-03-13 21:22:50 +03:00
Niels Dossche
8793f9938b Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-13680: Segfault with session_decode and compilation error
2024-03-13 17:59:43 +01:00
guangwu
f1a22d0943
fix: typos (#13694)
Signed-off-by: guoguangwu <guoguangwug@gmail.com>
2024-03-13 09:30:33 +01:00
Niels Dossche
7ff78f7b10 Add test case for bug #48339
This now works in spec-compliant DOM.

Test by: greatwhitepine at bigfoot dot com
2024-03-12 22:45:39 +01:00
Ayesh Karunaratne
94a12d5b31
ext/curl: Cleanup config.w32 to remove superfluous checks and outdated comments (#13684)
- Remove a check for an always-true curl version check
- Remove a `TODO` comment for curl_version_info check that should be always available since libcurl 7.10
2024-03-12 17:56:07 +01:00
Peter Kokot
18dffa6b73
Fix defined but not used warnings (#13678)
This fixes two warnings when building litespeed SAPI:

```
.../php-src/sapi/litespeed/lscriu.c:312:14: warning:
'LSCRIU_Error_File_Name' defined but not used
[-Wunused-function]
  312 | static char *LSCRIU_Error_File_Name(char *pchFile, int max_len)
      |              ^~~~~~~~~~~~~~~~~~~~~~
.../php-src/sapi/litespeed/lscriu.c:102:12: warning:
's_criu_debug' defined but not used [-Wunused-variable]
  102 | static int s_criu_debug = 0;
      |            ^~~~~~~~~~~~
```
2024-03-12 17:49:07 +01:00
Ilija Tovilo
980f7bd2c9
Implement INIT_FCALL offset optimization
Closes GH-13634
2024-03-12 14:13:57 +01:00
Claudio Jeker
4bf4c24aa8 Implement fcontext handling for sparc64_sysv_elf.
This was tested on OpenBSD sparc64 and all fiber related tests pass.
On OpenBSD stackghost prevents the modification of the return address
and therefor an extra trampoline is needed in make_fcontext(). This
should not matter on other OS implementing sysv ABI and the trampoline
should work there as well.

Close GH-13382.
2024-03-12 11:06:18 +00:00
Peter Kokot
a04577fb4a
Mark sapi/embed as non experimental (#13668)
The embed SAPI has been around for quite a while now, and many apps
already use it in production. It can be marked as non experimental to
avoid confusion.

[skip ci]
2024-03-11 22:19:27 +01:00
Ayesh Karunaratne
47949101ae
ext/sodium: Add new AEGIS constants to UPGRADING file (#13673)
Follow-up to #12867
[ci skip]
2024-03-11 22:16:22 +01:00
Niels Dossche
3c33430d27
Fix 32-bit DOM characterdata failures (#13663) 2024-03-11 21:16:13 +01:00
Arnaud Le Blanc
ef8dcbda49 Merge branch 'PHP-8.3'
* PHP-8.3:
  [ci skip] NEWS
  [ci skip] NEWS
  Fix GH-13508: JITed QM_ASSIGN may be optimized out when op1 is null (#13610)
2024-03-11 15:15:36 +01:00
Peter Kokot
8595bead87
Use default Autoconf's AC_LANG_PROGRAM (#13565)
This adds default test program prologue and body of
`int main(void) { return 0; }` where possible.
2024-03-11 00:24:57 +01:00
Peter Kokot
586a0dd369
Find SELinux library with pkgconf (#13645)
The SELinux library has had pkg-config/pkgconf integration since ~2009.
To ease this change, the check without pkgconf is executed in case the
libselinux.pc file is not found on the system.

A sanity check also covers cases where the library path is overriden:
  /configure --enable-fpm --with-fpm-selinux \
    SELINUX_CFLAGS=-I/path/to/libselinux \
    SELINUX_LIBS="-L/path/to/libselinux -lselinux"

This also removes the redundant symbol HAVE_SELINUX_SELINUX_H since the
selinux/selinux.h header is considered a required part of the SELinux
library package.
2024-03-10 21:31:56 +01:00
Peter Kokot
d2635b10b4
Remove unused php_std_auto_global_callback() (#13656)
Introduced in 4e55747a2b but not used in
current code. There was previous removal attempt via
afa4e41c2f but looks like it didn't make
it into the master branch at that point.
2024-03-10 18:05:51 +01:00
Shivam Mathur
edbef3e4ac Merge branch 'PHP-8.3'
* PHP-8.3:
Fix brew action (#13659)
We patch brew to ensure it overwrites files while linking the dependencies
2024-03-10 20:23:15 +05:30
Ilija Tovilo
d667e73f46
Merge branch 'PHP-8.3'
* PHP-8.3:
  [skip ci] Mark another openssl test as xfail
2024-03-10 15:15:40 +01:00
Niels Dossche
d0e15c8502
Fix external pcre2 build (#13662)
PCRE2_EXTRA_CASELESS_RESTRICT is only available as of pcre2 10.43.
Note: no check is necessary for pcre2_set_compile_extra_options because
it is available since pcre2 10.30, which is the minimum version PHP
requires.
2024-03-10 13:15:15 +01:00
Niels Dossche
cfdbf7743d Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix nightly failure due to type in file_put_contents_5gb.phpt
2024-03-10 11:28:15 +01:00
Peter Kokot
816f6a53d0
Find AppArmor library with pkgconf (#13644)
The AppArmor library has had pkg-config/pkgconf integration since its
early versions (2012), when it was integrated from the libaalogparse
into the AppArmor project. To ease this change, the check without
pkgconf is executed in case the libapparmor.pc file is not found on the
system.

A sanity check also covers cases where the library path is overriden:
  /configure --enable-fpm --with-fpm-apparmor \
    APPARMOR_CFLAGS=-I/path/to/libapparmor \
    APPARMOR_LIBS="-L/path/to/libapparmor -lapparmor"

This also removes the redundant symbol HAVE_SYS_APPARMOR_H since the
sys/apparmor.h header is considered a required part of the AppArmor
library package.
2024-03-10 11:12:54 +01:00
Niels Dossche
539d8d9259 Use common helper macro for getting the node in property handlers 2024-03-10 11:08:46 +01:00
Niels Dossche
649394d357 Remove redundant namespace define 2024-03-10 11:08:46 +01:00
Niels Dossche
d57e7a920b Use BAD_CAST consistently 2024-03-10 11:08:46 +01:00
Niels Dossche
37791d6f92 Cleanup buffer handling in saveHTML 2024-03-10 11:08:46 +01:00
Niels Dossche
6c55513e33 Use true instead of 1 with php_dom_throw_error 2024-03-10 11:08:46 +01:00
Niels Dossche
751163d18e Change stricterror type to bool 2024-03-10 11:08:46 +01:00
Niels Dossche
63bb04e5bf Simplify DOM_RET_OBJ macro 2024-03-10 11:08:46 +01:00
Niels Dossche
1cb86b6fcb Cleanup php_dom_create_object() 2024-03-10 11:08:46 +01:00
Peter Kokot
a0b821b543
Check library containing socket() with AC_SEARCH_LIBS (#13642)
Solaris/illumos systems have socket() in the socket library, Haiku has
it in network, Windows in ws2_32, and other systems in libc. This also
removes redundant and unused HAVE_SOCKET symbol.
2024-03-10 06:53:39 +01:00
David CARLIER
bb1ef4fe21
ext/gmp: gmp_invert addressing todo. (#13654) 2024-03-09 23:10:12 +00:00
Niels Dossche
3c74f4ab10 Merge branch 'PHP-8.3'
* PHP-8.3:
  Add ZPP checks in DOMNode::{__sleep,__wakeup}
2024-03-09 23:20:29 +01:00
Ilija Tovilo
58a14fbd6f
Merge branch 'PHP-8.3'
* PHP-8.3:
  Remove MAP_JIT flag
2024-03-09 23:09:22 +01:00
Jakub Zelenka
cc953e5ebc
Merge branch 'PHP-8.3' 2024-03-09 19:59:39 +00:00
Peter Kokot
2f6a210755
Use memmove() unconditionally in the code (#13647)
The memmove() function is C99 standard function [1] and check was left for
the PCRE2 bundled library. It can be simplified by passing the compile
option instead of checking always available function on current systems.
External PCRE2 library on the system doesn't need this.

[1]: https://port70.net/~nsz/c/c99/n1256.html#7.21.2.2
2024-03-09 20:30:08 +01:00
Peter Kokot
7b8a571f4a
Update the security.txt changes link (#13646)
[ci skip]
2024-03-09 20:29:05 +01:00
Niels Dossche
a47849deaf
Change return type of hash_update() to true (#13652)
It was already the case that this could only return true, update the
stubs to reflect that.

Closes GH-13614.
2024-03-09 20:02:50 +01:00
Niels Dossche
14b6c981c3
[RFC] Add a way to opt-in ext/dom spec compliance (#13031)
RFC: https://wiki.php.net/rfc/opt_in_dom_spec_compliance
2024-03-09 16:56:00 +01:00
Jakub Zelenka
f438b3bc69
Merge branch 'PHP-8.3' 2024-03-09 09:43:10 +00:00
Niels Dossche
82897fc447
Minor cleanup in dom_node_concatenated_name_helper() (#13639) 2024-03-09 10:12:49 +01:00
Saki Takamachi
f9ddd2b0c8
NEWS 2024-03-09 10:36:07 +09:00
Saki Takamachi
3dc9503a96
Revert "Fixed GH-13167 Fixed the behavior of bindValue and bindParam. (#13384)"
This reverts commit 68f10504de.
2024-03-09 10:34:32 +09:00
Saki Takamachi
00bee30132
Revert "Tidy up UT and add NEWS entry"
This reverts commit 1d45357409.
2024-03-09 10:34:17 +09:00
Peter Kokot
893fdda349 Merge branch 'PHP-8.3'
* PHP-8.3:
  [skip ci] Add CODEOWNERS in PHP-8.2 branch
2024-03-09 01:30:15 +01:00
Saki Takamachi
2e50371a7a
round: Abolished the CPU rounding mode change and modified it to a different logic. (#13435)
* Removed changing CPU round mode and added processing to detect and correct errors.
2024-03-09 08:51:37 +09:00
Saki Takamachi
447e6428d5
Revert "Fixed to avoid incorrect optimization with llvm15.0.0"
This reverts commit 16d0394ef4.
2024-03-09 08:50:38 +09:00
Saki Takamachi
16d0394ef4
Fixed to avoid incorrect optimization with llvm15.0.0 2024-03-09 08:46:33 +09:00
Niels Dossche
700fbca58d
Change getThis() into ZEND_THIS where possible (#13641) 2024-03-08 22:19:06 +01:00
Peter Kokot
1dfba4273f
Simplify FPM ACL check (#13604)
Instead of running the user/group permissions check (unknown when
cross-compiling), check with linking (AC_LINK_IFELSE) can be sufficient
to test if ACL_USER and ACL_GROUP are available (missing on macOS). The
AC_SEARCH_LIBS is used to test the ACL availability in c or acl library.
2024-03-08 20:38:31 +01:00
Peter Kokot
a46438e87f
Remove htonl() Autoconf check (#13627)
The htonl() function is available in libc on current *nix systems. On
Solaris versions around 2.5.1 it was located in the socket library.
Haiku has it in libc and Windows in ws2_32, which is linked as part of
the common libraries. This removes the redundant HAVE_HTONL symbol.
2024-03-08 19:36:30 +01:00
Peter Kokot
7bca3c7f45
Check sys/sdt.h with AC_CHECK_HEADER (#13626)
When using DTrace, sys/sdt.h is included unconditionally, without the
HAVE_SYS_SDT_H symbol.
2024-03-08 19:35:44 +01:00
Peter Kokot
ba8633a9ce
Use fabsf() and floorf() unconditionally in bundled libgd (#13624)
These are available since C99 with math.h also on Windows, without
requiring checking. Upstream libgd uses floorf() unconditionally and
doesn't use fabsf().
2024-03-08 19:28:52 +01:00
Ilija Tovilo
c443c1d7b8
Merge branch 'PHP-8.3'
* PHP-8.3:
  [skip ci] Mark problematic openssl tests as xfail for now
2024-03-08 19:09:33 +01:00
Niels Dossche
d6d3370034
Implement GH-13609: Dump wrapped object in WeakReference class (#13621)
I chose "object" as that's also the argument name in WeakReference::create.
2024-03-08 18:31:24 +01:00
Niels Dossche
e7888a46fa Merge branch 'PHP-8.3'
* PHP-8.3:
  [ci skip] NEWS
  Fix GH-13612: Corrupted memory in destructor with weak references
2024-03-08 18:27:19 +01:00
Kamil Tekiela
6fb1c7a742
Remove unnecessary skip checks (#13637) 2024-03-08 16:59:51 +01:00
Michael Voříšek
c412919c93
Add hosted docs link to docs/README.md
Closes GH-13633
2024-03-08 12:56:19 +01:00
Peter Kokot
540e37fd44 Merge branch 'PHP-8.3'
* PHP-8.3:
  Move CODEOWNERS to .github (#13591)
2024-03-07 22:44:59 +01:00
Niels Dossche
91d18d8120 [ci skip] NEWS 2024-03-07 20:50:30 +01:00
Niels Dossche
3ddd341329 [ci skip] NEWS and UPGRADING
Closes GH-13466.
2024-03-07 20:27:19 +01:00
Niels Dossche
a8c927005e Skip validity and length calls when the byte cannot be part of a multibyte sequence
Almost every character set can be given a number N such that a multibyte
sequence starts with a byte higher than that number N. This allows us to
skip a lot of work. To ensure the correctness of this, a sanity check is
implemented that exhaustively tries every 4-byte sequence for every
character set and checks for consistency issues.

This finally gives:
  Time (mean ± σ):     120.2 ms ±   1.2 ms    [User: 116.9 ms, System: 2.8 ms]
  Range (min … max):   118.0 ms … 122.9 ms    24 runs
2024-03-07 20:27:18 +01:00
Niels Dossche
1571eed08f Replace dead overflow checks with assertions and avoid indirect call overhead
We allocate twice the input length, and every input character results in
either 1 or 2 output bytes, so we cannot overflow.

By using an enum, and a switch table (which will be efficiently compiled
into a jump table), we can avoid the pessimistic code generation of the
indirect calls.

With this I get the following runtime for the test script in GH-13466 on
my i7-4790, which is around 1.25x faster.
  Time (mean ± σ):     250.9 ms ±   1.6 ms    [User: 248.4 ms, System: 2.0 ms]
  Range (min … max):   248.9 ms … 254.4 ms    11 runs
2024-03-07 20:27:18 +01:00
Niels Dossche
37989666ef Avoid copying escaped string, truncate instead 2024-03-07 20:27:18 +01:00
Peter Kokot
713ac3440c
Remove unused config.w32.h.in symbols (#13617)
- CONFIGURATION_FILE_PATH
  Removed via 2cf1b8d345.

- DISCARD_PATH
  Used for the --enable-discard-path CGI configure option and converted
  to INI configuration. Removed via
  06f43b30c1.

- HAVE_ERRMSG_H
  Removed via fd1578c196.

- HAVE_REGCOMP
  Used for regcomp function.

- HAVE_RINT
  Used for rint function.

- NEED_ISBLANK
  Windows ctype.h once didn't have C99 isblank() function. Cannot be
  found on current Windows systems anymore, neither was used in PHP at
  least since PHP 4.0.

- PHP_URL_FOPEN
  Removed via cae27179ce.

- REGEX
  Not used in current code.

- HSREGEX
  Not used in current code.

- USE_CONFIG_FILE
  Symbol was once defined by the --with-config-file-path configure
  option.
2024-03-07 20:27:10 +01:00
Ilija Tovilo
6db06a7c0f
Fix class name in warning of frameless calls (#13619) 2024-03-07 20:11:27 +01:00
Ilija Tovilo
089ef2ac61
Merge branch 'PHP-8.3'
* PHP-8.3:
  [skip ci] Mark problematic openssl tests as xfail for now
2024-03-07 17:54:54 +01:00
Ilija Tovilo
c3add14b43
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  [skip ci] Mark problematic openssl tests as xfail for now
2024-03-07 17:54:46 +01:00
Ilija Tovilo
fb423fd1bc
[skip ci] Mark problematic openssl tests as xfail for now 2024-03-07 17:54:12 +01:00
Dmitry Stogov
34f27e1b1f Update IR
IR commit: cd6fe296e8f39af70d5532d955add261899f2639
2024-03-07 19:38:03 +03:00
Dmitry Stogov
a541b95a5e Update IR
IR commit: cdf6e44c73d393794ad97b0487318f101c77f1bd
2024-03-06 22:11:50 +03:00
Tim Düsterhus
bf0abd1629
random: Initialize the mode field when seeding in php_random_default_status() (#13608)
This is a follow-up fix for GH-13579. The issue was detected in the nightly
MSAN build.
2024-03-06 18:57:17 +01:00
David Carlier
7f8465ab22 Merge branch 'PHP-8.3' 2024-03-06 11:39:48 +00:00
Marc Bennewitz
dbd976a67f
Singular DateTime::[get|set]Microsecond & no tentative return type (#13486)
* Singular DateTime::[get|set]Microsecond & no tentative return type

* Added missing getMicrosecond to DateTimeInterface
2024-03-06 09:18:22 +00:00
Dmitry Stogov
8cc8eac7e9 Update IR
IR commit: c63708b3664568d847b6db07ea380778f5c0313a

Fix recently introduced nightly test failures
ir_cfg.c:2305: ir_schedule_blocks_bottom_up: Assertion `bb->flags & (1<<2)' failed
2024-03-06 11:02:56 +03:00
Peter Kokot
9e001631e0
Refactor systemd library check for FPM (#13595)
This removes the unused HAVE_SYSTEMD_SD_DAEMON_H symbol defined by the
Autoconf AC_CHECK_HEADERS macro.

The systemd/sd-daemon.h sanity check now also works when systemd library
is overriden by pkgconf variables for custom or development places:

./configure --enable-fpm --with-fpm-systemd \
  SYSTEMD_CFLAGS=-I/path/to/systemd/src \
  SYSTEMD_LIBS="-L/path/to/systemd/build -lsystemd"
2024-03-06 06:22:07 +01:00
Dmitry Stogov
ffa3f4f746 Update IR
IR commit: 47c8433b944a408cb9326d4cff76ceda3cdc2e2d
2024-03-06 01:17:19 +03:00
David CARLIER
d9549d2ee2
ext/gettext: reland GH-13555 but only for master. (#13602) 2024-03-05 20:56:17 +00:00
Máté Kocsis
ec285ff669
Support multiple file-level phpdoc blocks in gen_stub.php
This allows writing the following:
/** @generate-class-entries */
/** @generate-legacy-arginfo 80000 */
2024-03-05 21:24:21 +01:00
Niels Dossche
74c887b04e [ci skip] NEWS and UPGRADING 2024-03-05 20:54:56 +01:00
Niels Dossche
5c8cc4f014 [ci skip] Add myself to ext/xmlreader CODEOWNERS 2024-03-05 20:54:28 +01:00
Niels Dossche
75e3f3e0ca
Optimize strpbrk (#13558) 2024-03-05 20:51:12 +01:00
Ayesh Karunaratne
7b23470666
ext/pcre: Add "/r" modifier (#13583)
Adds support for "Caseless restricted" matching added in PCRE2lib
10.43 with the "r" modifier.

This is `PCRE2_EXTRA_CASELESS_RESTRICT` in PCRE2. This is an "extra"
option, which means it is not possible to pass this option as
pcre2_compile() function parameter.

This option is passed in a pcre2_set_compile_extra_options() call.
Previously, these extra options are set at php_pcre_init_pcre2(),
but after this change, it is possible to customize the options
by adding bits to `eoptions` in pcre_get_compiled_regex_cache_ex().

The tests for this change are ported from upstream test suite[^1].

[^1]: c13d54f658 (diff-8c8312e4eb2d35bb16485404b7b5cc0eaef0bca1aa95ff5febf6a1890048305c)
2024-03-05 20:51:04 +01:00
Ayesh Karunaratne
353d4ce075
ext/xmlreader: Add class constant types to stub (#13596)
Declares class constant types for the `XMLReader` class.
2024-03-05 20:50:54 +01:00
Cristian Rodríguez
013978e506
Zend/fibers: Ensure fiber stack is not backed by THP. (#13306)
Ending with fiber stack mapped in hugepages will affect performance
badly.
Until < Linux 6.8-rc2 MAP_STACK was a noop, now it implies no THP, older releases
need madvise.
2024-03-05 20:50:43 +01:00
David Carlier
4d17260938 Merge branch 'PHP-8.3' 2024-03-05 18:42:17 +00:00
Peter Kokot
d03bb953db [skip ci] Sync links to internal docs files
For now, these two are still in the docs folder. See GH-13536.
2024-03-05 13:26:37 +01:00
Arnaud Le Blanc
48274030d3 Merge branch 'PHP-8.3'
* PHP-8.3:
  [ci skip]
  Fix GH-13569: GC buffer unnecessarily grows up to GC_MAX_BUF_SIZE when scanning WeakMaps
2024-03-05 12:20:12 +01:00
Remi Collet
9e132582a1
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-13217 Test failure with zlib-ng
2024-03-05 10:13:57 +01:00
Dmitry Stogov
2066bf1e18 Update IR
IR commit: 2bc594304cb40ebc3930c529a6ade7d121d5e00b
2024-03-05 11:33:02 +03:00
Dmitry Stogov
cab88ddb7d IR Update
IR commit: b9c5fd8d691f576a6a9ae4ad2464ea51e18203a5
2024-03-04 22:56:36 +03:00
David CARLIER
e3b6872b51
zend call stack adjust case for freebsd to calculate the guard size. (#13586)
it was not wrong but there is a sysctl oid storing the number of guard
pages, which is 1 by default but is modifiable at runtime.
2024-03-04 19:06:37 +00:00
Tim Düsterhus
3d4cb1da3e
random: Convert RANDOM_SEED() from a macro to a function (#13575)
* random: Convert `RANDOM_SEED()` from a macro to a function

* random: Fix GENERATE_SEED()'s prototype
2024-03-04 19:51:17 +01:00
Tim Düsterhus
06569bbd04
random: Clean Up the Mt19937 state struct (#13577)
* random: Make Mt19937's `mode` field an enum

* random: Reorder the `php_random_status_state_mt19937` struct

Empirical testing did not show any differences in performance, but it makes
sense to me to put the `count` field (which is accessed for every invocation of
Mt19937) at the beginning of the struct, keeping it near the values from the
state array that are returned first, resulting in only a single cache line load
if only a small amount of numbers are requested.

It naturally follows to also put the `mode` field there and move the
humongous state array to the end.

* random: Remove the `MT_N` constant

`MT_N` is an awfully generic name that bleeds into every file including
`php_random.h`. As it's an implementation detail, remove it entirely to keep
`php_random.h` clean.

To prevent the state struct from diverging from the implementation, the size of
the state vector is statically verified. Furthermore there are phpt tests
verifying the Mt19937 output across a reload, revealing when the state vector
is reloaded too early or too late.
2024-03-04 19:51:01 +01:00
Tim Düsterhus
650a8fb098
random: Embed the Mt19937 and CombinedLCG state within the module globals (#13579)
These are always dynamically allocated in GINIT, thus always take up memory. By
embedding them here we can avoid the dynamic allocation and additional pointer
indirection accessing them.

The test script:

    <?php
    for ($i = 0; $i < 9999999; $i++) mt_rand(1, 100);

Appears to run slightly faster with this change applied: Before this change it
always ran in just over 3 seconds, after this change I was also seeing times
below 3 seconds. Howver results are too close and too jittery to state this
performance improvement as a fact.
2024-03-04 17:51:40 +01:00
Niels Dossche
ad1dfa35f2
Minor PDO conditions cleanup (#13584)
* Get rid of inverted NULL checks

As the dbh pointer is already used in address computation,
the NULL checks is redundant. Looking at the callers
there are no cases where this can be passed as NULL.

* Message can't be NULL here

* Remove null check for return_value

As one of the branches dereferences return_value unconditionally, the
NULL check is dubious. In fact, looking at the callers we see that
return_value can never be NULL. So remove the check and fix the comment.
2024-03-04 17:36:51 +01:00
David Carlier
3f05418e8b Merge branch 'PHP-8.3' 2024-03-04 15:37:24 +00:00
Saki Takamachi
f799d6fdd4
Merge branch 'PHP-8.3'
* PHP-8.3:
  NEWS
  Fixed handshake response charset. (#13470)
  Fixed handshake response charset. (#13470)
  [skip ci] Fixed NEWS
2024-03-04 21:59:40 +09:00
Saki Takamachi
e9c5f0504c
Fixed handshake response charset. (#13470)
The character set ID included in the handshake data at the time of connection
actually only includes the lower 8 bits of the ID, so if  try to use this to specify
a character set, the corresponding character set may not exist.

In case of an invalid character set, the default character set is now used
without an error.

Fixes #13452
Closes #13470
2024-03-04 21:53:52 +09:00
Saki Takamachi
bfacc4146f
Merge branch 'PHP-8.3'
* PHP-8.3:
  Added validation of `\n` in $additional_headers of mail()
2024-03-04 21:30:58 +09:00
Peter Kokot
f91dcad567
Remove duplicate phpdbg _GNU_SOURCE compile definition (#13585)
The _GNU_SOURCE is defined on few other places when compiling phpdbg
(CPPFLAGS and php_config.h) depending on the system.
2024-03-03 23:59:01 +01:00
Peter Kokot
734f686ac4
Simplify UFFDIO_WRITEPROTECT_MODE_WP Autoconf check (#13564)
AC_CHECK_DECL can check whether preprocessor macro is defined in the
given includes.
2024-03-02 22:48:41 +01:00
David Carlier
7f01871915 ext/gettext: bind_textdomain_codeset should not accept empty domains.
the man page specifies that for bind_textdomain_codeset, like
bindtextdomain, the domain should not be an empty string.

close GH-13571
2024-03-02 18:59:18 +00:00
Ayesh Karunaratne
1b380d6ad5
UPGRADING: Minor adjustments moving items to appropriate sections (#13576)
- Moved curl_version()['feature_list'] to New Features
- Moved NumberFormatter::ROUND_HALFODD to New Features
- Removed contributor names (this pattern only used in the `NEWS` file)
- Removed "Fixed setAttribute and getAttribute" as it is covered in another change record
2024-03-02 19:34:03 +01:00
Tim Düsterhus
f6c38fc952 session: Stop using php_combined_lcg()
The CombinedLCG is a terrible RNG with a questionable API and should ideally
not be used anymore. While in the case of ext/session it is only used for
probabilistic garbage collection where the quality of the RNG is not of
particular importance, there are better choices.

Replace the RNG used for garbage collection by an ext/session specific instance
of PcgOneseq128XslRr64. Its 16 Byte state nicely fits into the memory freed up
by the previous reordering of the session globals struct, even allowing to the
storage of the php_random_algo_with_state struct, making using the RNG a little
nicer.

Instead multiplying the float returned by the CombinedLCG by the GC Divisor to
obtain an integer between 0 and the divisor we can just use `php_random_range`
to directly generate an appropriate integer, completely avoiding the floating
point maths, making it easier to verify the code for correctness.
2024-03-02 11:29:15 +00:00
Tim Düsterhus
4df911efcb session: Slightly reorder the members within the module globals
The previous ordering resulted in a needlessly large number of holes and split
several `zval`s across cache line boundaries. Do the bare minimum of reordering
to keep related members grouped, but reducing the struct size by 32 bytes and
keeping `zval`s within a single cache line.

Before:

    struct _php_session_rfc1867_progress {
            size_t                     sname_len;            /*     0     8 */
            zval                       sid;                  /*     8    16 */
            smart_str                  key;                  /*    24    16 */
            zend_long                  update_step;          /*    40     8 */
            zend_long                  next_update;          /*    48     8 */
            double                     next_update_time;     /*    56     8 */
            /* --- cacheline 1 boundary (64 bytes) --- */
            _Bool                      cancel_upload;        /*    64     1 */
            _Bool                      apply_trans_sid;      /*    65     1 */

            /* XXX 6 bytes hole, try to pack */

            size_t                     content_length;       /*    72     8 */
            zval                       data;                 /*    80    16 */
            zval *                     post_bytes_processed; /*    96     8 */
            zval                       files;                /*   104    16 */
            zval                       current_file;         /*   120    16 */
            /* --- cacheline 2 boundary (128 bytes) was 8 bytes ago --- */
            zval *                     current_file_bytes_processed; /*   136     8 */

            /* size: 144, cachelines: 3, members: 14 */
            /* sum members: 138, holes: 1, sum holes: 6 */
            /* last cacheline: 16 bytes */
    };
    struct _php_ps_globals {
            char *                     save_path;            /*     0     8 */
            char *                     session_name;         /*     8     8 */
            zend_string *              id;                   /*    16     8 */
            char *                     extern_referer_chk;   /*    24     8 */
            char *                     cache_limiter;        /*    32     8 */
            zend_long                  cookie_lifetime;      /*    40     8 */
            char *                     cookie_path;          /*    48     8 */
            char *                     cookie_domain;        /*    56     8 */
            /* --- cacheline 1 boundary (64 bytes) --- */
            _Bool                      cookie_secure;        /*    64     1 */
            _Bool                      cookie_httponly;      /*    65     1 */

            /* XXX 6 bytes hole, try to pack */

            char *                     cookie_samesite;      /*    72     8 */
            const ps_module  *         mod;                  /*    80     8 */
            const ps_module  *         default_mod;          /*    88     8 */
            void *                     mod_data;             /*    96     8 */
            php_session_status         session_status;       /*   104     4 */

            /* XXX 4 bytes hole, try to pack */

            zend_string *              session_started_filename; /*   112     8 */
            uint32_t                   session_started_lineno; /*   120     4 */

            /* XXX 4 bytes hole, try to pack */

            /* --- cacheline 2 boundary (128 bytes) --- */
            zend_long                  gc_probability;       /*   128     8 */
            zend_long                  gc_divisor;           /*   136     8 */
            zend_long                  gc_maxlifetime;       /*   144     8 */
            int                        module_number;        /*   152     4 */

            /* XXX 4 bytes hole, try to pack */

            zend_long                  cache_expire;         /*   160     8 */
            struct {
                    zval               ps_open;              /*   168    16 */
                    zval               ps_close;             /*   184    16 */
                    /* --- cacheline 3 boundary (192 bytes) was 8 bytes ago --- */
                    zval               ps_read;              /*   200    16 */
                    zval               ps_write;             /*   216    16 */
                    zval               ps_destroy;           /*   232    16 */
                    zval               ps_gc;                /*   248    16 */
                    /* --- cacheline 4 boundary (256 bytes) was 8 bytes ago --- */
                    zval               ps_create_sid;        /*   264    16 */
                    zval               ps_validate_sid;      /*   280    16 */
                    zval               ps_update_timestamp;  /*   296    16 */
            } mod_user_names;                                /*   168   144 */
            _Bool                      mod_user_implemented; /*   312     1 */
            _Bool                      mod_user_is_open;     /*   313     1 */

            /* XXX 6 bytes hole, try to pack */

            /* --- cacheline 5 boundary (320 bytes) --- */
            zend_string *              mod_user_class_name;  /*   320     8 */
            const struct ps_serializer_struct  * serializer; /*   328     8 */
            zval                       http_session_vars;    /*   336    16 */
            _Bool                      auto_start;           /*   352     1 */
            _Bool                      use_cookies;          /*   353     1 */
            _Bool                      use_only_cookies;     /*   354     1 */
            _Bool                      use_trans_sid;        /*   355     1 */

            /* XXX 4 bytes hole, try to pack */

            zend_long                  sid_length;           /*   360     8 */
            zend_long                  sid_bits_per_character; /*   368     8 */
            _Bool                      send_cookie;          /*   376     1 */
            _Bool                      define_sid;           /*   377     1 */

            /* XXX 6 bytes hole, try to pack */

            /* --- cacheline 6 boundary (384 bytes) --- */
            php_session_rfc1867_progress * rfc1867_progress; /*   384     8 */
            _Bool                      rfc1867_enabled;      /*   392     1 */
            _Bool                      rfc1867_cleanup;      /*   393     1 */

            /* XXX 6 bytes hole, try to pack */

            char *                     rfc1867_prefix;       /*   400     8 */
            char *                     rfc1867_name;         /*   408     8 */
            zend_long                  rfc1867_freq;         /*   416     8 */
            double                     rfc1867_min_freq;     /*   424     8 */
            _Bool                      use_strict_mode;      /*   432     1 */
            _Bool                      lazy_write;           /*   433     1 */
            _Bool                      in_save_handler;      /*   434     1 */
            _Bool                      set_handler;          /*   435     1 */

            /* XXX 4 bytes hole, try to pack */

            zend_string *              session_vars;         /*   440     8 */

            /* size: 448, cachelines: 7, members: 48 */
            /* sum members: 404, holes: 9, sum holes: 44 */
    };

After:

    struct _php_session_rfc1867_progress {
            size_t                     sname_len;            /*     0     8 */
            zval                       sid;                  /*     8    16 */
            smart_str                  key;                  /*    24    16 */
            zend_long                  update_step;          /*    40     8 */
            zend_long                  next_update;          /*    48     8 */
            double                     next_update_time;     /*    56     8 */
            /* --- cacheline 1 boundary (64 bytes) --- */
            _Bool                      cancel_upload;        /*    64     1 */
            _Bool                      apply_trans_sid;      /*    65     1 */

            /* XXX 6 bytes hole, try to pack */

            size_t                     content_length;       /*    72     8 */
            zval                       data;                 /*    80    16 */
            zval                       files;                /*    96    16 */
            zval *                     post_bytes_processed; /*   112     8 */
            zval *                     current_file_bytes_processed; /*   120     8 */
            /* --- cacheline 2 boundary (128 bytes) --- */
            zval                       current_file;         /*   128    16 */

            /* size: 144, cachelines: 3, members: 14 */
            /* sum members: 138, holes: 1, sum holes: 6 */
            /* last cacheline: 16 bytes */
    };
    struct _php_ps_globals {
            char *                     save_path;            /*     0     8 */
            char *                     session_name;         /*     8     8 */
            zend_string *              id;                   /*    16     8 */
            char *                     extern_referer_chk;   /*    24     8 */
            char *                     cache_limiter;        /*    32     8 */
            zend_long                  cookie_lifetime;      /*    40     8 */
            char *                     cookie_path;          /*    48     8 */
            char *                     cookie_domain;        /*    56     8 */
            /* --- cacheline 1 boundary (64 bytes) --- */
            char *                     cookie_samesite;      /*    64     8 */
            _Bool                      cookie_secure;        /*    72     1 */
            _Bool                      cookie_httponly;      /*    73     1 */

            /* XXX 6 bytes hole, try to pack */

            const ps_module  *         mod;                  /*    80     8 */
            const ps_module  *         default_mod;          /*    88     8 */
            void *                     mod_data;             /*    96     8 */
            php_session_status         session_status;       /*   104     4 */

            /* XXX 4 bytes hole, try to pack */

            zend_string *              session_started_filename; /*   112     8 */
            uint32_t                   session_started_lineno; /*   120     4 */
            int                        module_number;        /*   124     4 */
            /* --- cacheline 2 boundary (128 bytes) --- */
            zend_long                  gc_probability;       /*   128     8 */
            zend_long                  gc_divisor;           /*   136     8 */
            zend_long                  gc_maxlifetime;       /*   144     8 */
            zend_long                  cache_expire;         /*   152     8 */
            struct {
                    zval               ps_open;              /*   160    16 */
                    zval               ps_close;             /*   176    16 */
                    /* --- cacheline 3 boundary (192 bytes) --- */
                    zval               ps_read;              /*   192    16 */
                    zval               ps_write;             /*   208    16 */
                    zval               ps_destroy;           /*   224    16 */
                    zval               ps_gc;                /*   240    16 */
                    /* --- cacheline 4 boundary (256 bytes) --- */
                    zval               ps_create_sid;        /*   256    16 */
                    zval               ps_validate_sid;      /*   272    16 */
                    zval               ps_update_timestamp;  /*   288    16 */
            } mod_user_names;                                /*   160   144 */
            zend_string *              mod_user_class_name;  /*   304     8 */
            _Bool                      mod_user_implemented; /*   312     1 */
            _Bool                      mod_user_is_open;     /*   313     1 */
            _Bool                      auto_start;           /*   314     1 */
            _Bool                      use_cookies;          /*   315     1 */
            _Bool                      use_only_cookies;     /*   316     1 */
            _Bool                      use_trans_sid;        /*   317     1 */
            _Bool                      send_cookie;          /*   318     1 */
            _Bool                      define_sid;           /*   319     1 */
            /* --- cacheline 5 boundary (320 bytes) --- */
            const struct ps_serializer_struct  * serializer; /*   320     8 */
            zval                       http_session_vars;    /*   328    16 */
            zend_long                  sid_length;           /*   344     8 */
            zend_long                  sid_bits_per_character; /*   352     8 */
            php_session_rfc1867_progress * rfc1867_progress; /*   360     8 */
            char *                     rfc1867_prefix;       /*   368     8 */
            char *                     rfc1867_name;         /*   376     8 */
            /* --- cacheline 6 boundary (384 bytes) --- */
            zend_long                  rfc1867_freq;         /*   384     8 */
            double                     rfc1867_min_freq;     /*   392     8 */
            _Bool                      rfc1867_enabled;      /*   400     1 */
            _Bool                      rfc1867_cleanup;      /*   401     1 */
            _Bool                      use_strict_mode;      /*   402     1 */
            _Bool                      lazy_write;           /*   403     1 */
            _Bool                      in_save_handler;      /*   404     1 */
            _Bool                      set_handler;          /*   405     1 */

            /* XXX 2 bytes hole, try to pack */

            zend_string *              session_vars;         /*   408     8 */

            /* size: 416, cachelines: 7, members: 48 */
            /* sum members: 404, holes: 3, sum holes: 12 */
            /* last cacheline: 32 bytes */
    };
2024-03-02 11:29:15 +00:00
Peter Kokot
ffc6f192a8
Simplify port_create Autoconf check (#13529)
Similar simplification as e72f0c887b.
2024-03-02 00:16:19 +01:00
Peter Kokot
42a4e50513
Sync logical operators in shell scripting code (#13560)
This updates the obsolescent `-a` and `-o` binary primaries to `&&` and
`||`.

https://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html
2024-03-01 20:40:16 +01:00
Peter Kokot
b5e2f3a4b6
Check FFI_* ABI with Autoconf AC_CHECK_DECL (#13552)
The FFI_* calling conventions are enum constants and AC_CHECK_DECL(S)
can be used to check for their existence in the ffi.h header. This
simplifes the checks and adds a simple AC_CHECK_DECL macro wrapper which
defines the HAVE_FFI_* belonging symbols.
2024-03-01 19:31:55 +01:00
Niels Dossche
3c98b1de3a Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-11808: Live filesystem modified by tests (security)
2024-03-01 18:46:39 +01:00
Peter Kokot
7d0e2d8e4d
Add missing memfd_create Autoconf check for bundled pcre2lib (#13561)
This moves memfd_create (HAVE_MEMFD_CREATE) to configure.ac. Since
ext/pcre is always enabled and check can be done in this case for
ext/pcre and ext/opcache at once.
2024-03-01 17:17:28 +01:00
Peter Kokot
a48ed12ea9
Find and link network library as needed with AC_SEARCH_LIBS (#13553)
This prepends -lnetwork as needed (Haiku) whether linker sees the
setsockopt function and avoids defining redundant symbols, such as
HAVE_LIBNETWORK and HAVE_SETSOCKOPT.
2024-02-29 22:04:13 +01:00
David CARLIER
6b6e33ddbe
adding myself as ext/gettext reviewer. (#13559) 2024-02-29 20:22:50 +00:00
Tim Düsterhus
61d8c77676
Merge branch 'PHP-8.3'
* PHP-8.3:
  [ci skip] Fix version for GH-13544 in NEWS
2024-02-29 18:22:08 +01:00
Tim Düsterhus
54079babf8
Merge branch 'PHP-8.3'
* PHP-8.3:
  random: Fix unknown `mt_srand()` compatibility for unknown modes (#13544)
  Merge branch 'PHP-8.2' into PHP-8.3
  Removed `REPORT_EXIT_STATUS=no` in libmysql tests
  Revert "Fix GH-13519: PGSQL_CONNECT_FORCE_RENEW with persistent connections." (#13546)
2024-02-29 18:15:09 +01:00
Gina Peter Banyard
47a199c8b4
Add http_(get|clear)_last_reponse_headers() functions (#12500)
This is to provide an alternative to the $http_response_header magic variable

RFC: https://wiki.php.net/rfc/http-last-response-headers
2024-02-29 16:41:09 +00:00
Tim Düsterhus
99e7cf074b
random: Clean up seeding API (#13540)
* random: Expose xoshiro256**'s seeding functions

* random: Expose pcgoneseq128xslrr64's seeding functions

* random: Expose Mt19937's seeding functions

* random: Expose CombinedLCG's seeding functions

* random: Call php_random_mt19937_seed32 to seed the global Mt19937

This avoids the function pointer indirection and improves type safety.

* random: NULL the generic seeding function

Different engines work quite differently, it is not useful to attempt to seed
them in a generic way using a 64 bit integer. As an example Mt19937 completely
ignores the upper 32 bits.

* random: Remove the `seed` member from `php_random_algo`

See the explanation in the previous commit for the reasoning. This member is
unused since the previous commit and was not consistently available even before
that (specifically for the Secure engine).

* UPGRADING.INTERNALS

* random: Remove useless cast in `php_mt_srand()`
2024-02-29 08:03:35 +01:00
Saki Takamachi
a31edaa99b
Merge branch 'PHP-8.3'
* PHP-8.3:
    Removed `REPORT_EXIT_STATUS=no` in libmysql tests
2024-02-29 08:49:53 +09:00
Peter Kokot
154517eba9
Simplify openpty Autoconf check (#13494)
This removes redundant symbols HAVE_LIBUTIL and HAVE_LIBBSD.
2024-02-28 20:14:24 +01:00
Peter Kokot
acb677cbcf
Simplify Pgrab and proc library Autoconf check (#13488)
For Solaris/illumos systems, in this case, the check can be done using
AC_SEARCH_LIBS, which avoids defining redundant symbols like HAVE_PGRAB
and HAVE_LIBPROC.
2024-02-28 18:41:51 +01:00
Gina Peter Banyard
0de88dfb81
ext/spl: mark all zend_object_handlers as static (#13547) 2024-02-28 15:31:28 +00:00
Jakub Zelenka
0b7ef9874c
Merge branch 'PHP-8.3' 2024-02-28 11:47:52 +00:00
Jakub Zelenka
4bee528e7a Move back mailinglist-rules.md and release-process.md back to docs
Those are likely link from elsewhere so we could keep them
2024-02-28 11:21:26 +00:00
Peter Kokot
98bd66f99e
Simplify clock_gettime Autoconf check (#13537)
The clock_gettime() is found in libc on modern systems, except on
Solaris <= 10 and possible similar systems, it is in the rt library.

This checks if clock_gettime() exists in the libc, then it checks if rt
library has clock_gettime, prepends it to LIBS and defines the
HAVE_CLOCK_GETTIME symbol with the template from the AC_CHECK_FUNCS.

The ac_cv_func_clock_gettime is a cache variable set by AC_CHECK_FUNCS.
2024-02-28 08:17:37 +01:00
Jakub Zelenka
ba401cf8d9 Remove lefted out test from the revert for GH-13519 2024-02-27 23:27:47 +00:00
Jakub Zelenka
81dc935945
Merge branch 'PHP-8.3' 2024-02-27 23:08:58 +00:00
Niels Dossche
1d20fc5fc5 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-13531: Unable to resize SplfixedArray after being unserialized in PHP 8.2.15
2024-02-27 23:05:34 +01:00
Jakub Zelenka
6f258f0cd0
Merge branch 'PHP-8.3' 2024-02-27 22:04:36 +00:00
Niels Dossche
4799321740 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-13517: Multiple test failures when building with --with-expat
2024-02-27 21:49:47 +01:00
Peter Kokot
2ca38d11bb
Remove PHP_CHECK_GCC_ARG (#13525)
The PHP_CHECK_GCC_ARG has been already removed in PHP 8.0 and this also
removes the error emitting wrapper.

Patches for the solr and vld extensions have been sent upstream.
2024-02-27 18:45:36 +01:00
Gina Peter Banyard
5c7a0abe55
Merge branch 'PHP-8.3'
* PHP-8.3:
  ext/pdo: Fix various PDORow bugs
2024-02-27 15:32:20 +00:00
Sergey Panteleev
0bc05fad65
Merge branch 'PHP-8.3'
* PHP-8.3:
  PHP-8.2 is now for PHP 8.2.18-dev
2024-02-27 17:28:03 +03:00
Marc Bennewitz
9f586f6c69
Fixed int32 underflow on DateTime::createFromTimestamp (#12775)
* Fixed int32 underflow on DateTime::createFromTimestamp
2024-02-27 14:01:49 +00:00
David Carlier
868f1a305e ext/pgsql fix new test 2024-02-27 01:07:10 +00:00
David Carlier
c0ba573c4f Merge branch 'PHP-8.3' 2024-02-27 00:31:54 +00:00
Tim Düsterhus
dce6ed3199
random: Adjust status to state (#13521)
* random: Rename `status` local to `state`

* random: Rename `php_random_algo_with_state`'s `status` member to `state`
2024-02-26 20:38:45 +01:00
Niels Dossche
ddcf5d75b5 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix reference access in dimensions for DOMNodeList and DOMNodeMap
2024-02-26 19:44:52 +01:00
Gina Peter Banyard
dbf0b6aa42
ext/intl: Refactor ResourceBundle get and dimension access (#13503) 2024-02-26 17:03:17 +00:00
Peter Kokot
23844538d1
Use preprocessor to check for AI_V4MAPPED, AI_ALL and AI_IDN (#13513)
The preprocessor macros defined in some header can be checked, using
Autoconf's AC_COMPILE_IFELSE, or with simpler AC_CHECK_DECL(S), or even
better and simpler directly in the C code.
2024-02-26 16:38:00 +01:00
Peter Kokot
718a8b4278 [skip ci] Update PHP inet_aton and symbols removal notes 2024-02-26 14:17:54 +01:00
Florian Engelhardt
14873dd286
Drop zend_mm_set_custom_debug_handlers() (#13457)
Simplifies zend_mm_set_custom_debug_handlers to just use zend_mm_set_custom_handlers(), saving some conditionals when the Zend allocator is not used.
2024-02-26 14:04:33 +01:00
Peter Kokot
ba27fab862 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix detection of image formats in system gd library
2024-02-26 14:01:31 +01:00
Peter Kokot
7d295cbefb Check socket extension functions in a single Autoconf macro 2024-02-26 12:32:43 +01:00
Peter Kokot
7b7f97b518 Remove duplicate Autoconf check for sed
The sed program is always available since it is already discovered in
configure.ac and phpize.m4.
2024-02-26 11:47:59 +01:00
Gina Peter Banyard
295a177760
Zend/tests/offsets: Add tests where the offset is a reference (#13506) 2024-02-26 03:36:35 +00:00
Peter Kokot
0039446fee
Check for struct ucred with AC_CHECK_TYPES (#13510)
The AC_CHECK_TYPES can be used to check for the struct ucred. By
default it defines the symbol HAVE_STRUCT_UCRED instead of
ANC_CREDS_UCRED.
2024-02-25 23:02:17 +01:00
Peter Kokot
c1d6cf37e9
Check for struct cmsgcred with AC_CHECK_TYPES (#13507)
The AC_CHECK_TYPES can be used to check for the struct cmsgcred. By
default it defines the symbol HAVE_STRUCT_CMSGCRED instead of
ANC_CREDS_CMSGCRED.
2024-02-25 22:33:44 +01:00
Niels Dossche
035a5fdf8c
Add LIBXML_RECOVER (#13504)
Setting the recovery option by using a hardcoded value (1) worked
already for SimpleXML. For DOM, a small change is necessary because
otherwise the recover field overwrites the recovery option.

From a quick search on GitHub [1] it looks like this won't clash with
existing PHP code as no one seems to define (or use) a constant with
such a name.

[1] https://github.com/search?q=LIBXML_RECOVER+language%3APHP&type=code&l=PHP
2024-02-25 21:03:37 +01:00
Tim Düsterhus
79133df156
random: Pass algorithm and state together as php_random_algo_with_state (#13350)
* random: Remove `php_random_status`

Since 162e1dce98, the `php_random_status` struct
contains just a single `void*`, resulting in needless indirection when
accessing the engine state and thus decreasing readability because of the
additional non-meaningful `->state` references / the local helper variables.

There is also a small, but measurable performance benefit:

    <?php
    $e = new Random\Engine\Xoshiro256StarStar(0);
    $r = new Random\Randomizer($e);

    for ($i = 0; $i < 15; $i++)
    	var_dump(strlen($r->getBytes(100000000)));

goes from roughly 3.85s down to 3.60s.

The names of the `status` variables have not yet been touched to keep the diff
small. They will be renamed to the more appropriate `state` in a follow-up
cleanup commit.

* Introduce `php_random_algo_with_state`
2024-02-25 20:48:58 +01:00
Peter Kokot
d024dd3abd
Simplify nanosleep Autoconf check (#13490)
The nanosleep() is mostly found in libc, except on systems, such as
Solaris <= 10 or the discontinued OpenSolaris, it is in the rt library.

This checks if nanosleep() exists in the libc, then it checks if rt
library has nanosleep, prepends it to LIBS and defines the
HAVE_NANOSLEEP symbol with the template from the AC_CHECK_FUNCS.
2024-02-25 18:28:33 +01:00
Niels Dossche
6d721b21a1 Use string literal equality helper function in xmlreader_get_method 2024-02-25 16:25:52 +01:00
Niels Dossche
da1a9402f8 Set xmlreader property handler hash size to a precalculated value 2024-02-25 16:25:52 +01:00
Niels Dossche
7f080d3584 Don't put xmlreader prop handler data on the heap 2024-02-25 16:25:52 +01:00
Niels Dossche
06a89a9159 Make readonly error message consistent 2024-02-25 16:25:52 +01:00
Niels Dossche
b68b55be8f Remove unused write_func in php_xmlreader.c 2024-02-25 16:25:52 +01:00
Niels Dossche
586adf964f Remove unimplemented, unreferenced function from php_xmlreader.c 2024-02-25 16:25:52 +01:00
Gina Peter Banyard
1256d745c6
Zend/tests/offsets: add tests for taking references (#13496) 2024-02-25 15:22:59 +00:00
Máté Kocsis
e84acc0e43
Escape function names in optimizer function info 2024-02-25 16:09:50 +01:00
Máté Kocsis
7266e4fc6d
Add forgotten UPGRADING note for doc comment handling related changes
[skip-ci]
2024-02-25 16:02:09 +01:00
Máté Kocsis
f2e199e878
Implement "support doc comments for internal classes and functions" (#13266)
Fixes #13130
2024-02-25 08:41:31 +01:00
Máté Kocsis
4b405d8520
Display class constant and property doc comments via reflection (#13499) 2024-02-25 08:39:41 +01:00
Peter Kokot
db6a567607 Remove duplicate libtool --silent option
The libtool --silent option for PHP build invocation is already set in
the configure.ac.
2024-02-25 07:24:36 +01:00
Niels Dossche
a74da53fc4 Remove useless write to LIBXML(stream_context)
The value will always be overwritten.
2024-02-25 00:28:30 +01:00
Niels Dossche
30621b2ab4 Add test for overwriting an existing stream context using libxml_set_streams_context
This was previously untested and the branch was not covered according to
codecov.
2024-02-25 00:28:30 +01:00
Niels Dossche
ad29afd4e8 Document xsl:keys handling better in ext/xsl 2024-02-24 21:31:01 +01:00
Peter Kokot
ec778c0dd7 Use default HAVE_SIGSETJMP symbol description
When AC_DEFINE is called after some macro that has already defined the
symbol with description (help text), it can be called with two arguments
to make things easier.

[ci skip]
2024-02-24 20:46:34 +01:00
Peter Kokot
92dffb7efd Check posix_spawn_file_actions_addchdir_np with AC_CHECK_FUNCS
This simplifies the check and defines the symbol with description.
2024-02-24 19:13:59 +01:00
Ayesh Karunaratne
75ef03e742
CI: Remove ext/imap dependencies (#13484)
Now that ext/imap is unbundled, `libc-client-dev*` packages are no longer necessary.
2024-02-24 13:24:01 +01:00
Niels Dossche
25dbe5374a Add test with quoting multibyte GBK vs utf8mb4 in PDO 2024-02-23 23:52:24 +01:00
Jorg Sowa
9c4beac8d3 Remove inet_aton
This removes the deprecated inet_aton and its Windows implementation.
The inet_aton can be replaced with platform agnostic inet_pton.

Closes GH-13479
2024-02-23 23:16:43 +01:00
Peter Kokot
1feeadd0e2
Simplify times Autoconf check (#13464)
Similar simplification as e72f0c887b.
2024-02-23 21:27:18 +01:00
Peter Kokot
bd365149f2
Find and link math library as needed with AC_SEARCH_LIBS (#13481)
On some systems (Haiku) the math library is part of the C library and it
doesn't need to be explicitly prepended to LIBS. The redundant HAVE_LIBM
symbol defined by the AC_CHECK_LIB has been removed.
2024-02-23 20:48:10 +01:00
Peter Kokot
e9f8defd34
Find and link dl library as needed with AC_SEARCH_LIBS (#13482)
AC_SEARCH_LIBS can be used to check for dlopen and if dl library needs
to be prepended to LIBS. The dlsym is available with the same scope as
dlopen (if dlopen is present, also dlsym is). The redundant HAVE_DLOPEN
and HAVE_DLSYM symbols have been removed.
2024-02-23 20:44:06 +01:00
Niels Dossche
657167f17b Destroy xpath callbacks at the time when the reconstruction happens 2024-02-23 19:35:38 +01:00
Niels Dossche
01f1c60008 Cleanup xpath.c by merging some declarations and assignments 2024-02-23 19:35:38 +01:00
Niels Dossche
85217a044a Mark DOMXPath as uncloneable
This never resulted in a working XPath object anyway, as trying to query
or evaluate anything resulted in an "Invalid XPath context" error.
Supporting this is more trouble than it's worth, so just block the clone
operation.
2024-02-23 19:35:38 +01:00
Niels Dossche
9c2c0c3d02 Remove always-true check 2024-02-23 19:35:38 +01:00
Peter Kokot
171e3986b0
Remove nsl library check in sapi/fpm (#13478)
In sapi/fpm the inet_ntop is used instead of the deprecated inet_addr
and the required library, if needed, is linked from the configure.ac.
2024-02-22 23:50:03 +01:00
Niels Dossche
205c8b642c [ci skip] NEWS and UPGRADING for DOMXPath::quote()
See commit 2f9320c00f.
2024-02-22 20:32:33 +01:00
divinity76
2f9320c00f
DOMXPath::quote(string $str): string (#13456)
Method to quote strings in XPath, similar to PDO::quote() / mysqli::real_escape_string.

Sample usage: $xp->query("//span[contains(text()," . $xp->quote($string) . ")]")

The algorithm is derived from Robert Rossney's research into XPath quoting published at https://stackoverflow.com/a/1352556/1067003
But using an improved implementation I wrote myself, originally for https://github.com/chrome-php/chrome/pull/575
2024-02-22 20:30:21 +01:00
Peter Kokot
9603199547
Remove HAVE_SYSCONF check (#13474)
The sysconf can be assumed to be present on current systems, when
checking for the _SC_CLK_TCK symbol.
2024-02-22 18:09:50 +01:00
Saki Takamachi
d29951891a
NEWS / UPGRADING 2024-02-23 01:12:34 +09:00
Saki Takamachi
703ead5a26
Extend the maximum precision round can handle by one digit
Closes #12222
2024-02-23 01:12:25 +09:00
Peter Kokot
3693ad2d93
Refactor union semun in ext/sysvsem (#13473)
The union semun is always defined in php-src code. Current systems
require user to define it manually as done in the ext/sysvsem/sysvsem.c.
The conditional checks for HAVE_SEMUN were unused. The PHP 3.0.12 AIX
bug bugs.php.net/2149 was fixed by the removal of __GNU_LIBRARY__ check,
so this now further simplifies the code. The Autoconf AC_CHECK_TYPES
checks if system by any chance has the union semun, and by default
defines the HAVE_UNION_SEMUN.
2024-02-22 15:48:12 +01:00
Peter Kokot
f75143cc0a
Remove unused symbol ZEND_FIBER_ASM (#13467)
The symbol ZEND_FIBER_ASM is not defined on Windows and not used around
the ecosystem.
2024-02-22 13:44:04 +01:00
David CARLIER
9a3a4b5ba2
ext/intl: IntlDateFormatter class removing redundant error message info. (#13465)
Also correcting new IntlChar class constants typos.
2024-02-21 23:23:09 +00:00
Dmitry Stogov
b2b5b0101e Update IR
IR commit: 1164842ac28ba141c604c6fae8ec960f9aec369b
2024-02-22 00:24:20 +03:00
Dmitry Stogov
793ddc7c8a Update IR
IR commit: 0b557c0e4578cbfdbf8017f4adac335d795156dc
2024-02-21 23:36:52 +03:00
Peter Kokot
7b2c67ca98
Simplify setpflags Autoconf check (#13458)
Similar simplification as e72f0c887b.
2024-02-21 21:01:47 +01:00
Ayesh Karunaratne
ec9ae1ec1b
CI: Fix labeler.yml file to support actions/labeler@v5 (#13459) 2024-02-21 18:53:14 +01:00
Arnaud Le Blanc
5b501f28e5 Cleanup temp file 2024-02-21 17:58:48 +01:00
David Carlier
75c4a6fe33 [ci skip] NEWS typo 2024-02-21 16:32:27 +00:00
David Carlier
8bc34dd1bf [ci skip] NEWS/UPGRADING 2024-02-21 16:24:27 +00:00
David Carlier
037855fcd3 ext/intl: level up c++ runtime std for icu 74 and onwards.
to align with what is required to build icu 74 itself.

Close GH-13422.
2024-02-21 16:11:47 +00:00
David Carlier
211dc60044 ext/intl: adding new UCHAR_IDS_UNARY_OPERATOR/UCHAR_ID_COMPAT_MATH_START/UCHAR_ID_COMPAT_MATH_CONTINUE.
Close GH-13420.
2024-02-21 16:11:09 +00:00
David Carlier
22a3866f0c ext/intl: Timezone::getIanaID method addition.
returns the primary IANA zone ID from the provided timezone ID.
Most of the time, timezone ID==IANA ID.
available from icu >= 74.

Close GH-13419.
2024-02-21 16:09:22 +00:00
Appla
ef61ed10c2
Remove redundant getpid function call (#13454) 2024-02-21 15:33:15 +01:00
Ilija Tovilo
1bef861527
Add vscode chapter to docs
Closes GH-13441
2024-02-21 14:42:08 +01:00
Ayesh Karunaratne
7ed26c01f5
GitHub Actions: Update action versions to avoid node:16 warnings (#13453)
Note 16 is now EOL, so old GitHub Actions that use node 16 now triggers a warning.

This updates all existing workflows except `dwieeb/needs-reply` to their latest versions.
2024-02-21 13:16:25 +01:00
Peter Kokot
e72f0c887b
Simplify prctl and procctl Autoconf checks (#13450)
The AC_CHECK_FUNCS checks whether the linker sees the function in the
usual libraries, in this case libc. This is a simple trick to also check
existence of belonging headers, since the code uses HAVE_PRCTL and
HAVE_PROCCTL to include headers and call functions.
2024-02-21 09:04:37 +01:00
Ayesh Karunaratne
ba0f9fb501
ext/curl: Add feature_info assoc array to curl_version() (#13439)
The `phpinfo()` section of the Curl extension lists individual features
supported by the particular ext-Curl + libcurl build. However, the
`curl_version()` function return values do not indicate the same level of
details.

`curl_version()` has a `protocols` key that returns an array of all protocols
supported by the build. But the `features` key is a bitmask of all the features.
Checking the availability of certain feature requires knowing the corresponding
`CURL_VERSION` constant, and checking the availability of the constant and a
bitmask check for it in the `features` value.

For example, to determine HTTP2 support, it requires evaluating:

```php
defined('CURL_VERSION_HTTP2') && (curl_version()['features'] & CURL_VERSION_HTTP2 === CURL_VERSION_HTTP2)
```

To make feature availability checks more intuitive, this adds a new
`feature_list` key to `curl_version()` output array.

With it, checking for individual features availability is easier, and does
not require inspecting the availability of the `CURL_VERSION` constant and
the `features` key.

```php
!empty(curl_version()['feature_list']['HTTP2']);
```
2024-02-21 00:46:22 +00:00
Jorg Adam Sowa
e630aacf79
Remove HAVE_INET_PTON (#13410) 2024-02-21 00:43:56 +00:00
Dmitry Stogov
f5efaa39fa Update IR
IR commit: 873f13dd933acc38ba4cfe2a4aa8558867992a7e
2024-02-21 01:48:38 +03:00
Dmitry Stogov
23aac16d13 Update IR
IR commit: 67477a78251aafe35515eb7a339e309a0e0d4919
2024-02-21 01:13:31 +03:00
Niels Dossche
6c735739f1 Merge branch 'PHP-8.3'
* PHP-8.3:
  Workaround ZTS persistent resource crashes (PHP 8.3 and lower)
2024-02-20 21:26:39 +01:00
Peter Kokot
847c7459eb
Remove Autoconf check for C99 header stdint.h (#13444)
This removes the redundant check that defines the HAVE_STDINT_H symbol,
which is used in the ext/date/lib and ext/fileinfo/libmagic but on both
places patches and other header files take care of this so it is always
included unconditionally in php-src.

Autoconf by default still automatically checks for stdint.h internally
in current versions, so for now the HAVE_STDINT_H symbol is still
defined in php_config.h and will be made redundant along the way.
2024-02-20 20:19:28 +01:00
Peter Kokot
b41a5023f9
Remove malloc.h (#13436)
This removes the deprecated malloc.h header Autoconf check on *nix
systems and its HAVE_MALLOC_H symbol. It can be replaced mostly with the
stdlib.h. The libgd usptream also doesn't include it anymore.

On Windows, it is still used for some memory allocation functions, but
can be replaced with stdlib.h in the future.
2024-02-20 18:02:54 +01:00
Peter Kokot
056c43f848 [skip ci] Sync file permissions in Git repository
Git can track executable (0755) and non-executable (0644) file modes.
This is a minor file permissions sync across the php-src Git repository.

- build/config.guess (0755 as done upstream)
- build/config.sub (0755 as done upstream)
- ext/*/?*.stub.php (0644)
- ext/mbstring/libmbfl/mbfl/mk_eaw_tbl.awk (0755 due to shebang usage)
2024-02-20 17:58:47 +01:00
Arnaud Le Blanc
3baa606f58 Specify what is expected in zend_call_stack.base 2024-02-20 15:34:44 +01:00
Peter Kokot
03f15534a1 Fix Autoconf configure new lines
The `dnl` (delete to next line) directive in this combination of `m4_if`
macros and arguments isn't properly replaced and a literal dnl string is
appended in the configure script. The `[]dnl` works ok.
2024-02-19 21:30:29 +01:00
Matteo Beccati
291a8bdc26 Merge branch 'PHP-8.3' 2024-02-19 15:19:26 +01:00
Peter Kokot
0ddc3a23fa [skip ci] Fix Intel CET check in ext/pcre
This adds test program body `int main(void) { return 0; }` and fixes the
configure step with cache enabled (`configure -C`).
2024-02-19 14:25:40 +01:00
Gina Peter Banyard
a45048b983
Zend/tests/offsets: Add test for fetching reference of an object container 2024-02-19 12:26:44 +00:00
Dmitry Stogov
e3683ea479 Merge branch 'PHP-8.3'
* PHP-8.3:
  Prevent recording traces started from usupported VM instruction
2024-02-19 13:23:14 +03:00
Ilija Tovilo
fd47cd8b69
[skip ci] Fix ldap skipif 2024-02-19 10:16:13 +01:00
Peter Kokot
51050427f4
Remove obsolescent AC_C_INLINE Autoconf macro (#13429)
This macro defines the inline keyword to be `__inline__`, `__inline`,
or empty, based on the compiler inline support. Since PHP requires C99,
which has the inline keyword definition and all current compilers
support it, this check is redundant and not needed anymore.
2024-02-18 23:55:50 +00:00
Ilija Tovilo
f332e53082
[skip ci] Fix docs glob pattern
* does not refer to nested files.
2024-02-18 20:39:00 +01:00
Ilija Tovilo
1beb778b3a
Merge branch 'PHP-8.3'
* PHP-8.3:
  [skip ci] Fix paths-ignore glob pattern
2024-02-18 20:38:26 +01:00
Ilija Tovilo
a4dfa35f93
Fix docs typo 2024-02-18 20:31:54 +01:00
Peter Kokot
187f6857df
[skip ci] Update tidy.php excludes (#13425)
- ext/bcmath/libbcmath removed, because it is forked and maintained in
  php-srx. There doesn't seem to be any maintained upstream libbcmath.
- Added bundled ext/dom/lexbor.
- Updated JIT bundled files for ext/opcache/jit/ir.
2024-02-18 18:44:49 +01:00
Peter Kokot
711e452037
Rename HAVE_PHP_SOAP symbol on Windows ext/soap (#13426)
This syncs the symbol name with the *nix build, where HAVE_SOAP is
defined.
2024-02-18 18:01:12 +01:00
David CARLIER
cc934d048c
sapi/fpm: little simplification for the kqueue backend. (#13423) 2024-02-18 15:01:41 +00:00
Niels Dossche
60518e9695
Update error handling when node cannot be added (#13421)
This can only fail on OOM, so be consistent with the other locations and
throw an INVALID_STATE_ERR.
2024-02-18 15:35:41 +01:00
Máté Kocsis
f1d2de7b43
Fix links to "old" documentation and mention the new one in the README
[skip-ci]
2024-02-18 14:37:20 +01:00
Kamil Tekiela
50598a7097
Tidy up pdo_mysql_attr_max_buffer_size.phpt 2024-02-18 13:09:19 +01:00
Saki Takamachi
d433035319
Fixed tests for libmysql (#13424) 2024-02-18 13:08:31 +01:00
Kamil Tekiela
1d45357409
Tidy up UT and add NEWS entry 2024-02-18 12:47:30 +01:00
Ilija Tovilo
19d2b84788
Create book for docs
Closes GH-13338
2024-02-18 12:16:31 +01:00
Saki Takamachi
68f10504de
Fixed GH-13167 Fixed the behavior of bindValue and bindParam. (#13384)
Fixed to generate an error when a non-scalar value is passed in
`PDO_PARAM_EVT_EXEC_PRE` of `pdo_mysql_stmt_param_hook` unless
it is a `Stringable` object.
2024-02-18 12:10:21 +01:00
Máté Kocsis
10957e498c
Do not generate frameless info items when func info generation is disabled
While here, I fixed newlines around arginfo and function entry generation. Previously, newlines were repeated.
2024-02-18 11:39:00 +01:00
Máté Kocsis
90bf429bae
Remove unused register_html_constants() function 2024-02-18 09:17:04 +01:00
Ilija Tovilo
ec9b68cb6a
[skip ci] Skip JIT tests for Apple Silicon + ZTS
JIT will be disabled for Apple Silicon + ZTS anyway. See:

6db95512b4
2024-02-18 00:19:47 +01:00
Ilija Tovilo
9f1b43f508
Merge branch 'PHP-8.3'
* PHP-8.3:
  Disable JIT on Apple Silicon + ZTS
2024-02-18 00:08:52 +01:00
Peter Kokot
76b7c5cc78 [skip ci] Make tidy.php executable 2024-02-17 18:30:04 +01:00
Saki Takamachi
ed1c9d8954
ext/standard: Add more tests to round() (#13399) 2024-02-17 13:44:55 +00:00
Niels Dossche
ae5beff61b
Upgrade bundled pcre2lib to 10.43 (#13413) 2024-02-17 14:15:04 +01:00
David CARLIER
09415077f9
ext/ldap: few new unit tests (tls13 protocol). (#13409) 2024-02-16 18:26:08 +00:00
Jorg Adam Sowa
492b9e09e9
Add entry on return type of long2ip to NEWS (#13408)
[skip ci] add entry on return type of long2ip to NEWS and to UPGRADING.
2024-02-16 17:31:21 +00:00
Jorg Adam Sowa
e7b1f2a95b
Change long2ip return type (#13395) 2024-02-16 17:11:18 +01:00
David CARLIER
eaaffae555
zend_call_stack sort of GH-13358 follow-up. (#13368)
for threaded context, it solely uses a new api only available on
illumos.
Here using a common older api to get the stack info for the current
thread.
while at it, completing stack_limit_010 test for these platforms.
2024-02-16 14:01:03 +00:00
Peter Kokot
b5c3cbf94b
Check sockaddr_storage.ss_family with AC_CHECK_MEMBERS (#13407)
This simplifies the check. On AIX 6 and newer, the ss_family is
available, if compiled without defining COMPAT_43 (BSD 4.3
compatibility).
2024-02-16 14:24:55 +01:00
Peter Kokot
25923987b5
Refactor PHP_SOCKADDR_CHECKS (#13406)
Instead of the project macro, the sockaddr_storage and sockaddr.sa_len
can be checked with the AC_CHECK_TYPES and AC_CHECK_MEMBERS by including
the sys/socket.h. Some systems (~1988) didn't include the sys/types.h in
the socket.h (obsolete on current systems).

These macros by default define the HAVE_STRUCT_SOCKADDR_STORAGE and
HAVE_STRUCT_SOCKADDR_SA_LEN.
2024-02-16 13:29:20 +01:00
Arnaud Le Blanc
babe818168 [ci skip] Merge branch 'PHP-8.3'
* PHP-8.3:
  [ci skip] Adding myself as reviewer
  [ci skip] Adding myself as reviewer
2024-02-16 13:03:29 +01:00
Arnaud Le Blanc
2065829074 [ci skip] NEWS 2024-02-16 12:50:10 +01:00
Kévin Dunglas
f84d0468ed
add support for Zend Max Exeuction Timers on FreeBSD (#13393) 2024-02-16 12:45:15 +01:00
Dmitry Stogov
1f7cba2fec Update IR
IR commit: 89989794a25ac43778398545b32d030dddc0e8b1
2024-02-16 01:00:46 +03:00
Steve Wall
f6016c702f ext/ldap: Add LDAP_OPT_X_TLS_PROTOCOL_MAX and LDAP_OPT_X_TLS_PROTOCOL_TLS1_3
close GH-13405.
2024-02-15 21:43:46 +00:00
Niels Dossche
87abd500e3
Fix 32-bit fileinfo (#13404)
libmagic 5.45 has a regression on 32-bit that is fixed in current HEAD,
but that's not released yet. Pull in the upstream fix [1].

[1] 218fdf813f
2024-02-15 20:47:49 +01:00
Peter Kokot
9588796294
Use AC_CHECK_TYPES for checking struct flock (#13397)
The struct flock is defined in fcntl.h, if system has it. This removes
redundant PHP_STRUCT_FLOCK M4 macro in favor of the AC_CHECK_TYPES,
which by default defines symbol HAVE_STRUCT_FLOCK.
2024-02-15 19:17:01 +01:00
Dmitry Stogov
ce96aa9188 Update IR
IR commit: f7c0ddb1b4630e1287b0239f85d64a6965dfea29
2024-02-14 23:57:22 +03:00
Peter Kokot
1e770d12c2
Use Autoconf AC_CHECK_TYPE for checking siginfo_t (#13389)
The siginfo_t is defined by including the signal.h. Some systems include
the siginfo.h in the signal.h. Including it separately is obsolete on
current systems.
2024-02-14 13:56:24 +01:00
Peter Kokot
b222c020bf
Fix linking ext/curl against OpenSSL (#13262)
Following 68f6ab7113, the ext/curl doesn't
need to be linked against OpenSSL anymore, if curl_version_info_data
ssl_version is OpenSSL/1.1 or later.

With OpenSSL 3 and later the check for old SSL crypto locking callbacks
was detected here.

This also uses a common PHP_SETUP_OPENSSL macro for checking OpenSSL and
syncs the minimum OpenSSL version (currently 1.0.2 or later) across the
PHP build system.
2024-02-14 13:52:01 +01:00
David CARLIER
aa1eaacc41
zend_ssa minor struct changes. (#13387)
_zend_ssa_pid::has_range_constraint being the only bool, the bitfield would not bring
any benefit.
2024-02-14 07:41:52 +00:00
Máté Kocsis
844c1ac962
Add missing --EXTENSIONS-- section from frameless function inference test 2024-02-13 22:54:21 +01:00
haszi
e957e25c1c
Move constants from dir.c to stub file (#13312) 2024-02-13 22:07:15 +01:00
Niels Dossche
5941cdaaad
Fix ZTS crashes with persistent resources in modules (#13381)
On shutdown in ZTS the following happens:
- https://github.com/php/php-src/blob/master/Zend/zend.c#L1124-L1125
  gets executed. This destroys global persistent resources and destroys
  the modules. Furthermore, the modules are unloaded too.
- Further down, `ts_free_id(executor_globals_id)` gets executed, which
  calls `executor_globals_dtor`. This function destroys persistent
  resources for each thread.

Notice that in the last step, the modules that the persistent resource
belong to may already have been destroyed. This means that accessing
globals will cause a crash (I previously fixed this with ifdef magic),
or when the module is dynamically loaded we'll try jumping to a
destructor that is no longer loaded in memory. These scenarios cause
crashes.

It's not possible to move the `ts_free_id` call upwards, because that
may break assumptions of callers, and furthermore this would deallocate
the executor globals structure, which means that any access to those
will cause a segfault.

This patch adds a new API to the TSRM that allows running a callback on
a certain resource type. We use this API to destroy the persistent
resources in all threads prior to the module destruction, and keep the
rest of the resource dtor intact.

I verified this fix on Apache with postgres, both dynamically and
statically.

Fixes GH-12974.
2024-02-13 21:43:03 +01:00
Niels Dossche
be34b96975 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-13344: finfo::buffer(): Failed identify data 0:(null)
2024-02-13 21:21:07 +01:00
Niels Dossche
b7c5813c98
Update libmagic to 5.45 (#13369)
* Update libmagic to 5.45

This also cleans up magicdata.patch: changes that are already in upstream file
were removed from that patch file.

There are five (expected) test output changes.
All these were also checked with the file command.

  - bug77961.phpt changes because there's now an early error-return in the
    `if (ts == FILE_BADSIZE) {` branch.
  - cve-2014-1943.phpt and cve-2014-1943-mb.phpt change because now the crafted
    data is recognised as a simh file.
  - bug71434.phpt now properly recognises it as a Python file.
  - ext/fileinfo/tests/finfo_file_basic.phpt more specific mime type.

* Adjust memory requirement for s390x fileinfo run

The larger database causes a higher memory usage.
Similar to 962c082a5b.

* [ci skip] NEWS
2024-02-13 21:11:57 +01:00
Peter Kokot
686916652e
Remove obsolete PHP_WITH_SHARED M4 macro (#13380)
This macro is obsolete in favor of the PHP_ARG_WITH macro. It was once
used in combination with the AC_ARG_WITH macro to determine, whether the
extension has been configured as shared.
2024-02-13 19:37:16 +01:00
Máté Kocsis
115c60e0bb
Validate constructor property promotion in stubs 2024-02-12 22:43:34 +01:00
haszi
20c49f8524
Move PASSWORD constants to stubs (#13349) 2024-02-12 22:37:32 +01:00
Niels Dossche
c1609976a9 [ci skip] Update UPGRADING.INTERNALS for "%S" modifier 2024-02-12 22:11:01 +01:00
Michael Voříšek
87edeed3b9
Remove UNEXPECTED from typed prop checks
Closes GH-13143
2024-02-12 11:35:43 +01:00
Dmitry Stogov
2289af889c Update IR
IR commit: ab6ebce1cc25f7d2c634bd13af043f76d6ef524e
2024-02-12 12:24:48 +03:00
Dmitry Stogov
a3620cd6e7 Update IR
IR commit: d2ab283e3c3bb4b5ba21701a4d18f14fd9b3d798
2024-02-12 09:36:33 +03:00
Dmitry Stogov
71cccc0bcc Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix TLS access in JIT with MUSL (#13329)
2024-02-12 08:16:46 +03:00
Peter Kokot
eb76a83008
Remove PHP atomic includes and PHP_DEFINE M4 macro (#13372)
PHP_DEFINE was introduced with the PHP 5 build system
9d9d39a0de and then refactored via
350de12bc2.

This was once used to put defined constants into a single file to have
more fine-graned dependencies (atomic includes). Since no known PHP
extension is using this and it makes very little sense to use this, this
M4 macro can be removed in favor of the Autoconf native way using
AC_DEFINE and the usual included files php_config.h and config.h.

- Generated unused include directory removed
- Remove include dir from DEFS
- Remove also include dir from PDO checks
2024-02-11 22:14:46 +01:00
Peter Kokot
250547c7ab
Remove unused symbol HAVE_BSD_ICONV (#13373) 2024-02-11 19:41:45 +01:00
Peter Kokot
1139851a8a
Add missing --ini-path and --ini-dir php-config options to man page (#13261) 2024-02-11 11:55:43 +01:00
Ayesh Karunaratne
f6f1f7c109
ext/standard: Minor improvements to phpinfo() output (#13371)
- Change `http://` links to `https://` for php.net and zend.com
 - Remove `<img border=0` attributes as they are no longer in the HTML standard
 - Replace `<font>` tags with `<span>` tags (used for highlight.* INI color value display previews)
2024-02-11 11:05:07 +01:00
Peter Kokot
d2266efe5e
Remove redundant libbcmath include definition (#13364)
The libbcmath headers are included relatively.
2024-02-10 20:04:47 +00:00
Peter Kokot
5b9044d81b
Remove PHP 4 PDO headers installation (#13367)
This was once used before the PHP_INSTALL_HEADERS macro became available
in PHP 5.1.
2024-02-10 17:37:42 +01:00
Peter Kokot
801787d51d
Simplify strcasestr check in fileinfo (#13365)
The strcasestr is not present on Windows and on Solaris 10 until Solaris
11 implementation in string.h.

At this point strcasestr is not used in the bundled libmagic (file)
library due to patch removing the strcasestr usage in file.c, however
future libmagic version bump might need it again. This simplifies the
strcasestr check if available on the system without running the test
code and avoiding the unknown issue when cross-compiling. If found, the
HAVE_STRCASESTR is defined, otherwise the strcasestr.c is added to the
build sources.
2024-02-10 15:11:48 +01:00
Niels Dossche
5e7783e200 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fixed not to set CR_MALFORMED_PACKET to error if CR_SERVER_GONE_ERROR is already set
2024-02-10 14:05:26 +01:00
Niels Dossche
9fc7be8c53 Use bools 2024-02-10 14:01:42 +01:00
Niels Dossche
79e31c2392 Don't use heap allocations for registering DOM property handlers 2024-02-10 14:01:42 +01:00
Niels Dossche
f537ed9dfb Cleanup useless stuff in php_dom.c 2024-02-10 14:01:42 +01:00
Peter Kokot
b558a18c15
Remove unused <extension>_SHARED_LIBADD variables (#13361)
These are used to store libraries needed to link when extension is
shared and needs libraries linked to it. Since other similar types of
extensions don't have these variables substituted in Makefile, these can
be also removed. The filter and mysqli don't need any libraries for
linking here.
2024-02-09 22:20:32 +01:00
Peter Kokot
41e3044f48
Remove obsolete check for missing fclose declaration (#13360)
SunOS 4.1.4 from 1994 didn't have fclose declared in standard header
stdio.h. This doesn't need to be checked anymore, as fclose is part of
the C89+ standard and declaration is present on Solaris 10 (SunOS 5.10)
and later.
2024-02-09 18:11:49 +00:00
Ilija Tovilo
59211a51b7
[skip ci] Move RFC1867 tests as requested by Jakub 2024-02-09 16:01:14 +01:00
Saki Takamachi
f62f6a6d4b
Follow-up to remove IMAP ext (#13248)
Fixed and optimized tests that depend on imap in standard ext tests.

Also, the location of the setup script for hmailserver has changed.
2024-02-09 21:32:07 +09:00
haszi
3ce7bf2a77
Clear handler status flag in handler init
Closes GH-13087
2024-02-09 12:00:56 +00:00
Jorg Adam Sowa
6647d5f609
ext/bcmath: Remove debug.c file (#13359) 2024-02-09 11:29:57 +00:00
Peter Kokot
968f048b4c
Fix undefined symbol pthread_attr_get_np on Solaris (#13358)
Solaris doesn't have pthread_attr_get_np().

Checked on Oracle Solaris 11.4.
2024-02-09 00:46:07 +01:00
David Carlier
c5fbcfa7be GH-13355 fix new pgsql test 2024-02-08 22:44:03 +00:00
David Carlier
aa2e921ef7 Merge branch 'PHP-8.3' 2024-02-08 22:42:55 +00:00
Peter Kokot
3e237ecfb3
Remove remainings of recent oci extensions removal (#13352)
Following a4d64b2605
2024-02-08 18:04:00 +01:00
Ilija Tovilo
cd66fcc68b
Add request_parse_body() function
RFC: https://wiki.php.net/rfc/rfc1867-non-post

This function allows populating the $_POST and $_FILES globals for non-post
requests. This avoids manual parsing of RFC1867 requests.

Fixes #55815
Closes GH-11472
2024-02-08 12:08:07 +01:00
Ilija Tovilo
2f894389b6
Revert "Use __attribute__((assume())) in ZEND_ASSUME when available"
This reverts commit bf4ec8bd9d.

Partial revert, keep the phpdbg changes.
2024-02-08 11:59:36 +01:00
Peter Kokot
5752bbdad5 [skip ci] Add oci extensions notes to upgrading docs 2024-02-07 22:47:56 +01:00
Peter Kokot
e76f9e2b50
Remove DARWIN symbol (#13346)
When targeting Darwin systems (macOS, etc.), the compiler defines the
__APPLE__ symbol, which should be sufficient and a more established
detection method practice in these cases.
2024-02-07 21:07:48 +01:00
Niels Dossche
aed6528b00 Use a local variable such that a register is used for the column before writing it to memory 2024-02-07 18:02:42 +01:00
Niels Dossche
2f1fe3209c Use a direct statically-known call for decoding in the fast path 2024-02-07 18:02:42 +01:00
Ilija Tovilo
82665fd3a4
[skip ci] Fix oudated credits_ext.h file 2024-02-07 17:19:59 +01:00
Derick Rethans
af80cba8a3 Per his request, make Calvin code owner for ODBC 2024-02-07 15:39:07 +00:00
Derick Rethans
a4d64b2605
Removed ext/oci8 and ext/pdo_oci (#13327)
* Removed ext/oci8 and ext/pdo_oci

They now live in their own repositories:

https://github.com/php/pecl-database-oci8
https://github.com/php/pecl-database-pdo_oci

As per: https://wiki.php.net/rfc/unbundle_imap_pspell_oci8
2024-02-07 15:34:39 +00:00
Ilija Tovilo
c149b4f56f
Fix missing syntax error message in cli-server router script
Fixes GH-13113
Closes GH-13275
2024-02-07 16:13:08 +01:00
Ilija Tovilo
18cdfd3f51
Skip frameless functions with zend_execute_internal
zend_execute_internal is used to intercept function calls. We must use the
DO_FCALL opcode in this instance.
2024-02-07 16:05:15 +01:00
Ilija Tovilo
49ebfb04ef
Fix JMP_FRAMELESS with ZEND_USE_ABS_JMP_ADDR
which is used on 32-bit machines.
2024-02-07 15:50:38 +01:00
Ilija Tovilo
294c9ec36c
[skip ci] Skip push to forks
Creating PRs against forks requries having up-to-date target branches. Pushing
to these currently triggers CI, which is useless as this commit was already
tested upstream. Contributions are tested via pull request.
2024-02-07 13:17:40 +01:00
Ilija Tovilo
97e6c54336
Fix RC inference narrowing for ASSIGN_OBJ
Fixes oss-fuzz #66519
Closes GH-13345
2024-02-07 13:03:14 +01:00
Peter Kokot
f9cfd40fa2
Refactor utsname.domainname struct member Autoconf check (#13336)
* Refactor utsname.domainname struct member Autoconf check

Autoconf's AC_CHECK_MEMBERS macro (available since Autoconf 2.50) can be
used instead of the compile check. This was originally implemented for
IRIX compatibility, when Autoconf 2.13 didn't have the struct members
checking macro yet.

Macro by default here defines the HAVE_STRUCT_UTSNAME_DOMAINNAME symbol.

* Remove also redundant DARWIN symbol check

Checking in the configuration step also correctly detects missing struct
member on Darwin systems (macos...).
2024-02-06 23:21:42 +01:00
Ilija Tovilo
0b1ab42ab8
Fix refactoring mistake
Odd, I rebuilt the project but somehow missed this.
2024-02-06 17:50:53 +01:00
Ilija Tovilo
631bc81607
Implement stackless internal function calls
Co-authored-by: Dmitry Stogov <dmitry@zend.com>

Closes GH-12461
2024-02-06 17:42:28 +01:00
Derick Rethans
7aa2b6294b Moving this to php/policies 2024-02-06 11:39:12 +00:00
Niels Dossche
13e7c086a7 Merge branch 'PHP-8.3'
* PHP-8.3:
  [ci skip] Fix NEWS date again
2024-02-05 22:56:00 +01:00
Niels Dossche
9bd2abe6e1 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix unlikely memory leak in case of namespace removal with extremely deep trees
2024-02-05 22:49:55 +01:00
David Carlier
b320aabc5e 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.

close GH-13319
2024-02-05 19:32:29 +00:00
Tim Düsterhus
ce2d26363f
random: Reuse the seed128/seed256 helpers when seeding using the CSPRNG (#13311)
Instead of writing to the engine's state struct directly, use the helpers for
consistency.
2024-02-05 17:00:33 +01:00
Ilija Tovilo
f8c9928e6f
Fix tests with explicit opcache.log_verbosity_level setting 2024-02-05 15:00:32 +01:00
Marc Bennewitz
0016b3085c
Added DateTime[Immutable]::[get|set]Microseconds (#12557)
* Added DateTime[Immutable]::[get|set]Microseconds
2024-02-05 12:14:18 +00:00
Ilija Tovilo
f91833d297
Fix RC inference for DECLARE_LAMBDA_FUNCTION
It doesn't seem like the VM can return RCn. However, the JIT fails without it.
I'll need to look into this more closely.
2024-02-05 12:19:18 +01:00
Ilija Tovilo
79e8f20e56
Add type inference for various missing opcodes
Closes GH-13304
2024-02-05 11:48:48 +01:00
Niels Dossche
caaf9d041d [ci skip] NEWS 2024-02-05 08:31:24 +01:00
Niels Dossche
05874d4c23 [ci skip] Make UPGRADING bullet points consistent 2024-02-04 23:02:58 +01:00
Niels Dossche
3b5986db69 Implement GH-12908: Show attribute name/class in ReflectionAttribute dump
This is consistent with how many other Reflection classes have a name
field, and it makes debugging easier.

Closes GH-12908.
Closes GH-12917.
2024-02-04 23:02:02 +01:00
K
47b05def96
remove dead code and sillyness (#13322) 2024-02-04 22:25:59 +01:00
David Carlier
5a76b4f470 Merge branch 'PHP-8.3' 2024-02-04 19:44:13 +00:00
David CARLIER
b8f10decb3
ZEND_ELEMENT_COUNT usage reduction. (#13324)
clang 18 is going to be released and in the meantime the counted_by
attribute usage had been constrained to true flexible arrays,
typical cases such as type name[1] ZEND_ELEMENT_COUNT(size) no longer
build.
2024-02-04 19:09:15 +00:00
Peter Kokot
9628ca7bd2
Fix zend_test extension name (#13321)
The zend_test extension was renamed from zend-test to zend_test in
dbe5725ff3. This only syncs few minor
remainings.
2024-02-04 19:27:58 +01:00
David Carlier
f9a83a4bd4 fiber fix wrong asm directives on (default) solaris build mode.
Illumos/Solaris while being 64 bits produces by default 32 bits build.
In this case building the i386 assembly.

Close GH-13320
2024-02-04 17:39:24 +00:00
Jakub Zelenka
da6a4e799a
Merge branch 'PHP-8.3' 2024-02-04 12:01:09 +00:00
Peter Kokot
1cc0a16752 [skip ci] Add note about ext/imap removal in upgrading docs
The imap extension has been moved to PECL. Adding a note about configure
options changes also in the UPGRADING.INTERNALS for easier build scripts
adjustments.
2024-02-04 12:13:27 +01:00
Máté Kocsis
47789969ec
Revert "Declare the missing ReflectionMethod::$name property"
This reverts commit b0e83aabec.
The property is inherited from ReflectionFunctionAbstract.
2024-02-04 07:36:19 +01:00
Máté Kocsis
b0e83aabec
Declare the missing ReflectionMethod::$name property 2024-02-03 23:29:28 +01:00
Peter Kokot
e8c65d7efd
Remove superfluous ext/hash/murmur include on Windows (#13314)
The murmur headers are included relatively in ext/hash sources.
2024-02-03 22:01:31 +01:00
David Carlier
fa02793bee Merge branch 'PHP-8.3' 2024-02-03 13:44:22 +00:00
David Carlier
1680d4fda3 Merge branch 'PHP-8.3' 2024-02-03 13:42:24 +00:00
David Carlier
79cafc8beb Merge branch 'PHP-8.2' into PHP-8.3 2024-02-03 13:39:13 +00:00
David Carlier
45b99f6b2f Forgotten piece of GH-13309/GH-13310 previous PR 2024-02-03 13:24:15 +00:00
Saki Takamachi
78970ef6b2
Fix GH-12143: Optimize round
Fixed an error in the result due to "pre-rounding" of the round function.

"Pre-rounding" has been abolished and the method of comparing numbers has
been changed.

Closes GH-12268.
2024-02-03 22:23:02 +09:00
David Carlier
0e93f03e65 Merge branch 'PHP-8.3' 2024-02-03 13:08:32 +00:00
Tim Düsterhus
7ed21e66fa
random: Do not hardcode the target type when invoking the CSPRNG (#13308)
Instead derive the number of bytes to retrieve from the variable that is being
filled.
2024-02-02 20:10:19 +01:00
Cristian Rodríguez
eb238577f1
cgi: tidy up fastcgi_cleanup signal handler (#13026)
* signal handlers can only touch global volatile sig_atomic_t variables.
* fastcgi_cleanup is static
* structs sigaction are static
* A signal handler cannot call exit() because it is not async signal safe,
  call _exit instead.
2024-02-02 18:10:34 +01:00
Derick Rethans
f359c0b115 Updated to version 2024.1 (2024a) 2024-02-02 10:23:36 +00:00
Derick Rethans
8ac0de00b6 Empty merge 2024-02-02 10:23:36 +00:00
Shivam Mathur
d8aa6e457f
Add macos-14 to the push and nightly workflows (#13299)
* Add macos-14 to the push workflow

* Remove hardcoded brew path in configure-macos action

* Include architecture in macos job name

* Add os to ccache-action in macos job

* Add libsodium in brew action

Since we build with the configuration option --with-sodium, adding libsodium to make sure it is installed

* Add fail-fast to macos matrix

* Add macos-14 to the nightly workflow

* Fix adding bison to PATH in workflows

* Fix architecture

* Use version to compare in nightly_matrix.php

* Make sure test-macos artifacts have unique name

* Update .github/nightly_matrix.php

Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com>

---------

Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com>
2024-02-02 14:02:57 +05:30
Dmitry Stogov
cea64f7aa3 Update IR
IR commit: dfa54b88f929606908502f70b23964a7b388b1ab
2024-02-02 09:15:57 +03:00
Tim Düsterhus
97b3b4552d
random: Move CSPRNG API into php_random_csprng.h (#13290)
This allows consumers of just the CSPRNG to include a much smaller header. It
also allows to verify at a glance whether a source file might use non-secure
randomness.

This commit includes the new header wherever the CSPRNG is used, possibly
replacing the inclusion of php_random.h if nothing else is used, but also
includes it in the main php_random.h header for compatibility.

Somewhat related to 45f8cfaf10,
2b30f18708, and
b14dd85dca.
2024-02-01 19:09:35 +01:00
Ilija Tovilo
77bc863e50
Improve ZEND_FETCH_CLASS_STATIC static inference for final classes
Same as 95f7335.
2024-02-01 15:56:39 +01:00
Peter Kokot
649fafb56d
Remove HAVE_JSON symbol (#13277)
The json extension is always available as of php 8.0. HAVE_JSON was also
never defined for Windows builds.
2024-02-01 14:41:30 +01:00
Ilija Tovilo
95f7335251
Improve static inference in final class (#13298)
static may be treated like self if the class is final.
2024-02-01 11:49:08 +01:00
Dmitry Stogov
2bf9f7eb19 Fix compilation warning 2024-02-01 12:45:41 +03:00
Tim Düsterhus
c8c9fc3f69
Merge branch 'PHP-8.3'
* PHP-8.3:
  ci: update caddy job to use GitHub Releases
2024-02-01 00:12:36 +01:00
Tim Düsterhus
bba24f04a7
Update GitHub Action workflows to actions/upload-artifact@v4 (master)
This applies the upgrade for workflows that have been added in the master
branch.
2024-01-31 23:36:07 +01:00
Tim Düsterhus
91fde8b34b
Merge branch 'PHP-8.3'
* PHP-8.3:
  Update GitHub Action workflows to `actions/upload-artifact@v4` (#13297)
2024-01-31 23:35:10 +01:00
Ilija Tovilo
668edf2cae
Improve ASSIGN_OBJ RC inference
ASSIGN_OBJ may only modify RC if it implements __set.

Closes GH-13237
2024-01-31 23:24:12 +01:00
Dmitry Stogov
cc5a39458c Update IR
IR commit: 553af9c2263c873ac1d01aa49925a4713122e8b4
2024-02-01 00:14:24 +03:00
Niels Dossche
2b629f0e0b Merge branch 'PHP-8.3'
* PHP-8.3:
  ext/curl: Fix failing tests due to string changes in libcurl 8.6.0
2024-01-31 21:59:06 +01:00
Dmitry Stogov
c50255c626 Update IR
IR commit: 682cc0ca6761164dbcd791e5f56283f8e88537d2

Fixes GH-13286
2024-01-31 22:20:10 +03:00
Ilija Tovilo
a135517376
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix instable array during in-place modification in uksort
2024-01-31 19:25:59 +01:00
Ayesh Karunaratne
edb9f65f16
ext/curl: Bump minimum Curl version to >= 7.61.0 (#13259)
Bumps the minimum required libcurl version to 7.61.0.

Please also see #4917, which bumped minimum libcurl version to the current >= 7.29.0.
This bumps the minimum requirement to Curl 7.61.0 (released 2018 Sept).

Ubuntu, Debian, RHEL, and RHEL derivatives have major and LTS version bumps this year. Following are the
libcurl-dev/libcurl-devel versions available in the oldest supported (LTS or otherwise) in major OSs.

 - Debian buster: [7.64](https://packages.debian.org/buster/libcurl4-openssl-dev)
 - Ubuntu 20.04: [7.68](https://packages.ubuntu.com/focal/libcurl-dev)
 - CentOS/RHEL 7: 7.29
 - RHEL 8/Rocky 8/EL 8: 7.61
 - Fedora 38: 7.87

RHEL/CentOS 7 reaches EOL mid 2024, so for PHP 8.4 scheduled towards the end of this year, we can safely
bump the minimum libcurl version.

7.61.0 was selected as the new minimum because RHEL and derivatives have libcurl-devel version 7.61. RHEL 8 is
a current and supported RHEL version.
2024-01-31 13:48:17 +00:00
Ayesh Karunaratne
e30c11f599
ext/curl: Update sync_constants.php const matching to uncover more constants (#13282)
The `sync_constants.php` file uncovers constants present in libcurl source, but\
not present in PHP ext/curl source. There is a regular expression to match
Curl constants, but to it did not previously include `CURLE_*` and `CURLINFO_*`
constants, which PHP should expose as constants.

This updates the `sync_constants.php` file's constant filter regex to expose those
constants patterns as well. The new missing constants will be added in a later PR.
2024-01-31 13:36:23 +00:00
Jakub Zelenka
01e39c0ea9
Merge branch 'PHP-8.3' 2024-01-31 10:56:47 +00:00
Peter Kokot
085da2725f Merge branch 'PHP-8.3'
* PHP-8.3:
  Use EXTENSIONS instead of SKIPIF sections in *.phpt
2024-01-31 11:20:56 +01:00
Tim Düsterhus
f39357b07b random: Call int-seeding functions directly
As the `__construct()` implementation is engine-specific anyway, we know what
engine were dealing with and can just call the seeding function directly
instead of going through a function pointer.

This likely improves construction performance a little, but I did not measure.
2024-01-31 08:49:17 +01:00
Tim Düsterhus
304c9c3db1 random: Add explicitly named seed64() helper for xoshiro256** 2024-01-31 08:49:17 +01:00
Tim Düsterhus
79f648ace2 random: Narrow the parameter types of seed128/seed256
These internal-only functions accepted a `php_random_status`, just to extract
the internal state from the `state` pointer. Make them take the state struct
directly to improve type safety.
2024-01-31 08:49:17 +01:00
David CARLIER
453f5ab053
ext/sockets: enabling multicast group for ipv4 on freebsd. (#13240)
bug#75721 patch from jonathan@tangential.ca.

MCAST_JOIN_GROUP/MCAST_LEAVE_GROUP socket option for the RFC 3678
support does not work on freebsd, using IP_ADD_MEMBERSHIP instead.
2024-01-31 06:58:27 +00:00
Eric Mann
4a08f41bb6
Merge branch 'PHP-8.3' 2024-01-30 12:58:19 -08:00
Pierrick Charron
4567556176
Merge branch 'PHP-8.3'
* PHP-8.3:
  PHP-8.2 is now for PHP 8.2.17-dev
2024-01-30 12:48:11 -05:00
Derick Rethans
b612269720 Merge branch 'PHP-8.3' 2024-01-30 17:32:02 +00:00
Ilija Tovilo
b06311cb3d
Improve ZEND_NEW RC inference
ZEND_NEW returns RC1 if the instanciated class has no constructor.

Closes GH-13239
2024-01-30 16:31:29 +01:00
Ilija Tovilo
8d082958fe
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix create_object checks
2024-01-30 16:14:08 +01:00
Peter Kokot
b3bdc23656 Remove unused Makefile variables FIBER_ASSEMBLER and FIBER_ASM_ARCH
In Windows build system these were replaced with common PHP_ASSEMBLER
and FIBER_ASM_ABI when adjusting for the arm64.

Closes GH-13263
2024-01-30 09:50:22 +01:00
Dmitry Stogov
373237edb2 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-13193: Significant performance degradation in 'foreach' starting from PHP 8.2.13 (caused by garbage collection) (#13265)
2024-01-30 06:40:56 +03:00
Ilija Tovilo
34e2dc5697
Improve is_instanceof inference (#13238)
When a class is final, it may be treated as !is_instanceof.
2024-01-29 12:48:55 +01:00
Peter Kokot
52dba99d47 Sync headers installation
This syncs the installed sapi and extension headers on *nix and Windows
systems by installing only what is intended outside of php-src.

- ext/gd: without gd_arginfo.h and gd_compat.h
- ext/hash: php_hash_joaat.h and php_hash_fnv.h added also on Windows
  installation; xxhash/xxhash.h added on both installations as it is
  included in php_hash_xxhash.h; Include path for xxhash.h changed to
  relative so the php_hash_xxhash.h can be included outside of php-src;
  Redundant include flags removed
- ext/iconv: without iconv_arginfo.h
- ext/mysqli: mysqli_mysqlnd.h was missing on Windows
- ext/phar: php_phar.h was missing on Windows
- ext/sodium: php_libsodium.h was missing on *nix
- ext/xml: without xml_arginfo.h
- sapi/cli: cli.h was missing on Windows

Closes GH-13210
Closes GH-13213
2024-01-28 19:50:55 +01:00
Alex Dowad
c1c106e5a2 Merge branch 'PHP-8.3'
* PHP-8.3:
  Retroactively add NEWS entry for ec348a12
2024-01-28 20:40:32 +02:00
Niels Dossche
b06fedb41d Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-10614: imagerotate will turn the picture all black, when rotated 90
2024-01-26 18:16:29 +01:00
Dmitry Stogov
765382eeea Update IR
IR commit: 2ea3215ebd15a1fa332b8b6118df2bc51a60d81c

Fixes two recently introduced bugs caught by PHP nightly workwlow
2088438753
2024-01-26 07:32:34 +03:00
Dmitry Stogov
90bab1e732 Update IR
IR commit: 87bf12844ea0e36151b3a172dce28b55b5ae1503

Fixes ext/opcache/tests/jit/bug81225_2.phpt failure
2024-01-25 23:31:55 +03:00
Dmitry Stogov
136a972ccb Update IR
IR commit: 0108cdf808d1e7dd6b702738949e095151f49040
2024-01-25 22:50:30 +03:00
Niels Dossche
b8ff8c04f8 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-10344: imagettfbbox(): Could not find/open font UNC path
  Fix GH-13037: PharData incorrectly extracts zip file
2024-01-25 20:07:52 +01:00
Gina Peter Banyard
a479ed7cc5
Zend: Add tests for offsets and containers (#12723)
Add various tests showcasing the behavioural variations of different offset types used on various container types in all possible operations:
 - Read
 - Write
 - Read Write
 - Appending
 - Unsetting
 - Existence checks with isset()/empty/null coalesce operator
 - Behaviour of nesting dimensions (e.g. $container[$offset1][$offset2])

Add a test to ensure compile time and runtime behaviour is identical for offsets.

Add an internal class that overloads the dimension object handlers to zend_test
2024-01-25 15:06:59 +00:00
Niels Dossche
8128d17cc2 Fix build warning in ext/mbstring 2024-01-24 19:44:17 +01:00
Niels Dossche
e2c3c48307 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-13232: Segmentation fault will be reported when JIT is off but JIT_debug is still on
2024-01-24 17:49:05 +01:00
Alex Dowad
bcd4138185 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix segfault caused by use of 'pass' encoding when mbstring converts multipart form POST data
2024-01-24 18:41:36 +02:00
Jorg Adam Sowa
ea3c541640
GH-13142: add missing test cases (#13235)
* Added missing global cases to test

* Update gh13142
2024-01-24 12:02:32 +01:00
Ilija Tovilo
6f6289caca
Avoid new SSA var for ASSIGN_OBJ_REF without RC inference
Previously, this variable was necessary because of auto-vivification on
UNDEF/null/false. It's now only used for RC inference, as auto-vivification has
been removed.

This implicitly solves an inference problem for $obj->bar &= $obj; where we get
a new variable for both literal references to $obj, with the first one getting
the RCn flag, and the second one getting the MAY_BE_REFERENCE flag. Thus, the
first variable will be missing the reference type, causing a false-positive type
inference warning.

If we want to verify RC inference at some point we'll need a better solution.

Closes GH-13233
2024-01-24 11:30:49 +01:00
Ilija Tovilo
7040e8ee03
[skip ci] Use _exit for type inference verification
Otherwise we get useless leak warnings when building with asan.
2024-01-23 18:15:30 +01:00
Jorg Adam Sowa
0a162394c8
Enable xdebug extension again on nightly (#13192) 2024-01-23 17:36:45 +01:00
Ilija Tovilo
c6a2f2a8ce
[skip ci] Disable pecl redis build 2024-01-23 17:36:07 +01:00
Ilija Tovilo
fb4878e5a7
Merge branch 'PHP-8.3'
* PHP-8.3:
  [skip ci] Fix 64-bit only test
2024-01-23 17:33:34 +01:00
tekimen
5da8335145
Fix "warning: conflicting types for ‘zend_multibyte_set_script_encoding’ due to enum/integer mismatch;" (#13227) 2024-01-23 12:31:00 +00:00
Ilija Tovilo
d0d565511a
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix dumping of zend_string.val in gdb
2024-01-23 12:55:55 +01:00
Niels Dossche
2c4534a5b9 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-12504: Corrupted session written when there's a fatal error in autoloader
2024-01-22 22:04:20 +01:00
ju1ius
513224cf31 prevents using resource as a zend_type
Closes #13102
2024-01-22 21:56:36 +01:00
Kamil Tekiela
a96cc80be2
Fix PDO unit test description 2024-01-22 17:29:17 +01:00
Dmitry Stogov
19b9764724 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-12481: PHP crash with JIT enabled
2024-01-22 15:58:11 +03:00
Derick Rethans
987417e2e0
Remove ext/imap — it has been moved to PECL (#13190)
* Remove ext/imap — it has been moved to PECL

https://pecl.php.net/package/imap

* Remove files related to IMAP

* Remove IMAP CI files and set up

* Also disable IMAP on Circle CI

* Update CREDITS file

* Remove IMAP entry from CODEOWNERS

* Revert "Remove files related to IMAP"

This reverts commit a05ffd6c97.

* Mark IMAP is being removed

* Revert "Remove IMAP CI files and set up"

This reverts commit 82e5ba9910.

* Revert "Also disable IMAP on Circle CI"

This reverts commit e83827b0b2.

* Don't try to build imap extension with CI

* Restore test setup files

* Remove mention of imap in labeler, EXTENSIONS, and sample php.ini files
2024-01-22 12:56:05 +00:00
Remi Collet
8ce4d240f7
Merge branch 'PHP-8.3'
* PHP-8.3:
  NEWS
  NEWS
  Fix GH-13215 GCC 14 build
2024-01-22 10:59:48 +01:00
Dmitry Stogov
f83cdce0df Merge branch 'PHP-8.3'
* PHP-8.3:
  Wrap cleanup function call with zend_try.
2024-01-22 10:33:18 +03:00
Ilija Tovilo
d653646841
Fix iterator position resetting
Previously, when an array was converted from packed to hashed, iterators would
not be correctly reset to 0. Similarly, removing the last element from an array
would decrease nNumUsed but not actually fix the iterator position, causing the
element to be skipped in the next iteration.

Some code was also removed that skips over IS_UNDEF elements for
nInternalPointer and iterator positions. This is unnecessary, as this already
happens during iteration.

Closes GH-13178
Closes GH-13188
2024-01-21 23:24:00 +01:00
Alex Dowad
6fa4286ba4 Merge branch 'PHP-8.3'
* PHP-8.3:
  Do not allow zend.script_encoding to be set to 'pass'
2024-01-21 15:14:29 +02:00
Ayesh Karunaratne
ec0044129a ext/curl: Fix sync-constants script
The Curl doc page that was used to check the constants was changed from `<pre></pre>` tags to an HTML page.
This updates the regexps to account for the changes, the Cthulu way.

 - New: https://curl.se/libcurl/c/symbols-in-versions.html
 - Old: https://web.archive.org/web/20231201000000*/https://curl.se/libcurl/c/symbols-in-versions.html
 - Change in curl-www: 2baba5ed45
2024-01-21 08:23:03 +01:00
David Carlier
5517cb01c2 Merge branch 'PHP-8.3' 2024-01-21 00:02:19 +00:00
Niels Dossche
fe064d7f12 Fix GH-13142: Undefined variable name is shortened when contains \0
Uses the new %S formatter and introduces the necessary changes and
helpers.
2024-01-20 23:49:13 +01:00
Peter Kokot
a651ae86aa
Sync Zend/Optimizer headers installation (#13201)
On *nix installation there is zend_dfg.h installed as part of the bug
fix #81136, but it wasn't synced with Windows yet. This now syncs Zend
headers on both builds.
2024-01-20 15:05:06 +01:00
Máté Kocsis
117b8dee64
Add ifdef for NumberFormatter::ROUND_HALFODD
According to the docs, UNUM_ROUND_HALF_ODD is only available since ICU 69.0. The build on Travis currently fails probably because it uses a lower version.
2024-01-20 10:15:02 +01:00
Niels Dossche
31092c235d Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-13177: PHP 8.3.2: final private constructor not allowed when used in trait
  Fix GH-12107: When running a stored procedure (that returns a result set) twice, PHP crashes
2024-01-19 23:41:01 +01:00
Ilija Tovilo
ffc250d245
Add runtime type inference verification
Co-authored-by: Dmitry Stogov <dmitry@zend.com>

Closes GH-12930
2024-01-19 09:29:14 +01:00
Ilija Tovilo
bf4ec8bd9d
Use __attribute__((assume())) in ZEND_ASSUME when available
Closes GH-13171
2024-01-19 09:25:55 +01:00
Vincent JARDIN
98e2948ca7 ext/openssl: Add X509 purpose constants.
- X509_PURPOSE_OCSP_HELPER.
- X509_PURPOSE_TIMESTAMP_SIGN.
- Also X509_PURPOSE_ANY is ok since 1.0.1+

Close GH-13149
2024-01-19 07:06:51 +00:00
Niels Dossche
4bd63568fb
Fix argument type of simplexml_import_dom (#13170)
It needs to be "object".
This is because first- and third-party extension can register custom
node types using `php_libxml_register_export`. So we don't know upfront
what types can be expected.

This also changes the error to a TypeError everywhere.
2024-01-18 20:28:01 +01:00
Ayesh Karunaratne
8cc472d5d0 ext/intl: Add NumberFormatter::ROUND_HALFODD
The NumberFormatter::ROUND_HALFEVEN constant exists in PHP already, but its counterpart ROUND_HALFODD was missing.
This adds it, using `UNUM_ROUND_HALF_ODD`

Close GH-13191
2024-01-18 18:12:44 +00:00
Niels Dossche
43b62b7007 Remove dead code in php_xsl.c 2024-01-17 22:21:16 +01:00
Niels Dossche
76a3eddfd7
Field cleanups in xsl_object (#13182) 2024-01-17 21:29:48 +01:00
Peter Kokot
569da8a064
Remove unused internal_functions file (#13175)
On Windows internal_functions.c file is created from the same template
internal_functions.c.in as in Autotools build system. This was once used
with Microsoft Developer Studio files (1995).
2024-01-17 20:40:58 +01:00
Niels Dossche
043daeeec1 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix crashes with entity references and predefined entities
2024-01-17 19:41:32 +01:00
Niels Dossche
dcd2a0dde6
Make return type of trigger_error() and user_error() true (#13169) 2024-01-17 17:15:55 +01:00
Tim Düsterhus
45f8cfaf10
random: Split the uint128 implementation into its own header (#13132)
The implementation of `php_random_uint128_*` exists specifically for
pcgoneseq128xslrr66 and takes up a third of php_random.h. Split it into its own
header to keep php_random.h focused on the functionality directly related to
randomness.
2024-01-17 16:07:45 +01:00
Ilija Tovilo
07d2fcc9fc
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix range inference since "proper-range-semantics" RFC
2024-01-17 15:42:40 +01:00
Peter Kokot
d5dae8bdf1
[skip ci] Update upgrading docs for build related changes (#13176)
This updates the UPGRADING documents with current build system changes
done since the PHP-8.3 release.
2024-01-17 11:21:08 +00:00
Dmitry Stogov
2bacd4e110 Update IR
IR commit: 34aeda97a5febe81fb53a679800f8c6cd802c847
2024-01-17 13:51:59 +03:00
divinity76
822769f412
missing SKIP_ONLINE_TESTS (#13155)
* missing SKIP_ONLINE_TESTS

gethostbynamel may contact DNS servers, so it should be skipped if SKIP_ONLINE_TESTS , and on a AMD Ryzen 9 7950x WSL Ubuntu this test took ~2 seconds (some DNS timeout i guess?) so it should also have SKIP_SLOW_TESTS

* error message nitpick
2024-01-17 11:11:21 +01:00
divinity76
50c51d098a
missing SKIP_SLOW_TESTS (#13156)
* missing SKIP_SLOW_TESTS

this test took 2 seconds to execute on a 5GHz AMD Ryzen 9 7950x (one of AMD's fastest single-thread-performance CPUs), it should have SKIP_SLOW_TESTS

* skip message nitpick
2024-01-17 11:10:24 +01:00
Peter Kokot
e3f118e351 Fix typo in FFI 77706 test title
This test is for the bug 77706 (Improve error messages in FFI for
incompatible arguments).

[skip ci]
2024-01-17 08:11:23 +01:00
Jorg Adam Sowa
dd141f9e3e
add missing keywords to parser fuzzer dict from PHP 7.4 to 8.3 (#13160)
* Added missing keywords to parser fuzzer dict from PHP 7.4 to 8.3

* Added null return type
2024-01-17 01:51:42 +01:00
divinity76
6d0a3e86f0
[skip ci] accidentally used print() instead of die() (#13158) 2024-01-17 01:40:04 +01:00
Niels Dossche
23b94cb5a7 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-13071: Copying large files using mmap-able source streams may exhaust available memory and fail
2024-01-16 23:53:12 +01:00
Niels Dossche
8d5c3e6781
Introduce %S modifier and use it (#13168) 2024-01-16 22:51:02 +01:00
Dmitry Stogov
055c8861cc Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix zend_may_throw() for FETCH_DIM_IS and ISSET_ISEMPTY_DIM_OBJ
2024-01-17 00:32:31 +03:00
Niels Dossche
4091d2407b Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-13097: Anonymous class reference in trigger_error / thrown Exception
2024-01-16 21:06:29 +01:00
Niels Dossche
92d53c8ba0 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix missing error check in curl_multi_init()
2024-01-16 19:36:09 +01:00
Saki Takamachi
c334de8a0a
[skip ci] Fixed NEWS 2024-01-17 01:58:47 +09:00
Saki Takamachi
bdd7711ba7
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-13119 (#13125)
2024-01-17 01:49:41 +09:00
Peter Kokot
36b1695dc7 Fix redundant double dash in mbstring test output 2024-01-15 22:42:05 +01:00
Niels Dossche
c39a8631b7 Merge branch 'PHP-8.3'
* PHP-8.3:
  Use getenv to prevent undefined key warning
2024-01-15 20:15:29 +01:00
Gina Peter Banyard
f7b498b02e
Use true as return types for SplHeap (#13147) 2024-01-15 10:09:38 +00:00
Peter Kokot
474edd6eb5
Remove unused symbols in ext/mbstring/libmbfl/config.h.w32 (#13152)
HAVE_WIN32_NATIVE_THREAD, USE_WIN32_NATIVE_THREAD and ENABLE_THREADS
were once part of the libmbfl build https://github.com/moriyoshi/libmbfl
but are not used anymore.
2024-01-15 10:27:21 +01:00
Daniil Gentili
c16ad918ba
Change default method of disabling JIT
https://wiki.php.net/rfc/jit_config_defaults
Closes GH-12678
2024-01-15 09:39:13 +01:00
Ilija Tovilo
e0737d9376
[skip ci] Mark new firebird tests with xleak 2024-01-15 09:28:18 +01:00
Peter Kokot
880ff82fc4
Fix the SO_LISTENQLEN check in FPM (#13089)
This now defines the HAVE_LQ_SO_LISTENQ as the fallback check when all
previous have failed in case of FPM LQ. This seemed to be a typo in the
build system.
2024-01-15 08:10:38 +01:00
David Carlier
ad9ec2607a Merge branch 'PHP-8.3' 2024-01-14 18:25:08 +00:00
Ilija Tovilo
cbd201192d
Merge branch 'PHP-8.3'
* PHP-8.3:
  strtok is not comptime()
2024-01-14 19:13:25 +01:00
Máté Kocsis
9c7b3914e7
DeclarePdoMysql:: ATTR_SSL_VERIFY_SERVER_CERT only for Mysqlnd 2024-01-14 16:29:13 +01:00
Máté Kocsis
d84ed03a68 Improve error messages related to void/never return types of methods 2024-01-14 16:04:23 +01:00
Máté Kocsis
b5a23d88f5
Explicitly initialize object variables passed to Z_PARAM_OBJ_OF_CLASS_OR_LONG_OR_NULL (#13146)
In order to avoid possible miscompilations like #13082
2024-01-14 16:02:59 +01:00
Tim Düsterhus
0b7587feae
Merge branch 'PHP-8.3'
* PHP-8.3:
  random/standard: Adjust #13138 for PHP 8.3
  random/standard: Correctly handle broken engines in php_array_pick_keys (#13138)
2024-01-14 13:07:18 +01:00
Niels Dossche
d463d215e1
Minor sqlite3 cleanups (#13141)
* Remove always-true stmt_obj->db_obj condition

This is always true because SQLITE3_CHECK_INITIALIZED checks this.

* Remove always-true param_number check

This is always true because we return early when the value < 1.
2024-01-13 20:47:04 +01:00
Niels Dossche
a3a318682a Merge branch 'PHP-8.3'
* PHP-8.3:
  Follow-up fix for GH-13082
2024-01-13 18:02:43 +01:00
Niels Dossche
89ea24f63e
Give anonymous dom structs a name (#13135) 2024-01-13 11:34:40 +01:00
Niels Dossche
90785dd865
[RFC] Improve callbacks in ext/dom and ext/xsl (#12627) 2024-01-13 00:00:26 +01:00
Tim Düsterhus
2b30f18708
Remove unused includes of php_random.h (#13131)
Before this change php_random.h was listed in 146 different *.dep files for a

    env CC=clang ./configure --without-sqlite3 --without-pdo-sqlite

build, after this change it's only listed in 110 of them, preventing uselessly
recompiling those files when working on ext/random, mostly caused by the include
in ext/standard/basic_functions.h.
2024-01-12 18:35:18 +01:00
Tim Düsterhus
e31bf3ad4d
UPGRADING: Add new PHP_ROUND_* to global constants section
see 94ddc74c9a
see #12056
2024-01-12 17:53:03 +01:00
Niels Dossche
488528d274 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix phar/tests/bug77432.phpt
2024-01-12 17:24:22 +01:00
Tim Düsterhus
b1f5ca59d1
Remove ext/random backwards-compatibility headers (#13108)
When ext/random was initially added in PHP 8.2, these headers started
“forwarding” to the new ext/random/php_random.h to reduce the impact on
existing extensions.

As master already contains some breaking changes of the internal API of
ext/random and as the last PHP version without ext/random will be EOL once
master is released, it appears appropriate to drop these headers now.
2024-01-12 15:18:42 +01:00
Máté Kocsis
2ae2af5e2e
Fix missing periods in the NEWS file
[skip-ci]
2024-01-12 14:15:30 +01:00
Max Semenik
a2b2830f9b
ext/standard: make debug_zval_dump() output whether the array is packed (#12641) 2024-01-12 00:33:14 +00:00
Máté Kocsis
d6a0b3af68
Implement PDO driver-specific subclasses
RFC: https://wiki.php.net/rfc/pdo_driver_specific_subclasses
Closes GH-12804

Co-Authored-By: Danack <Danack@basereality.com>
2024-01-11 23:22:41 +01:00
David Carlier
b985a31b0a sapi/fpm: setting backlog default to -1 for DragonFlyBSD.
like most of BSD, when negative the syscall sets it internally to
SOMAXCONN.

close GH-13077
2024-01-11 20:39:41 +00:00
Jakub Zelenka
08b9e8ae9c
Merge branch 'PHP-8.3' 2024-01-11 16:48:38 +00:00
Máté Kocsis
d54e2f9df2
Fix CODEOWNERS rule order
I stopped getting notifications a while ago even though they used to appear from time to time. After reading https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners, it looks like the other rules shadow mine. Therefore I'm putting my rule to the end.
2024-01-11 17:00:00 +01:00
Peter Kokot
c774a8d401
Add bison -Wall flag to Windows build (#13098)
Following the d7d3a1c66e, this adds bison
flag -Wall also to Windows build system.

Flag has been added via 2127a37b83.
2024-01-11 11:05:00 +01:00
Peter Kokot
ad9250183f
Remove obsolete _XPG_IV preprocessor directive (#13035)
This was once used on SINIX UNIX variant and MIPS processors with the
last release in 1995 to have working gettimeofday().
2024-01-11 10:54:13 +01:00
Tim Düsterhus
db68565d03 random: Dynamically calculate the state size when seeding with CSPRNG
Instead of hardcoding struct names, or even sizes, we can just determine the
actual size of the target structure using sizeof().
2024-01-11 08:54:18 +01:00
Tim Düsterhus
62aa8fa375 random: Reduce variable scope in Random\Engine\PcgOneseq128XslRr64::__construct()
This is for consistency with xoshiro256**'s constructor.
2024-01-11 08:54:18 +01:00
Peter Kokot
8d7364f0bb Align configure check message results together 2024-01-11 00:02:28 +01:00
David CARLIER
9726721560
general signatures discrepencies fixes (#13122) 2024-01-10 22:19:23 +00:00
hanshenrik
fc16285538 ext/curl: deprecate CURLOPT_BINARYTRANSFER
This is long overdue, CURLOPT_BINARYTRANSFER has been a no-op since PHP5.1.2 in 2004 (ref https://bugs.php.net/bug.php?id=55635 )

Close GH-13114.
2024-01-10 18:16:52 +00:00
Dmitry Stogov
52cc17c665 New test 2024-01-10 17:39:34 +03:00
Dmitry Stogov
d9dfad8ea9 Update IR
IR commit: a6cfbffb0da4e11c45537dd83159c36eece6efa9
2024-01-10 17:38:48 +03:00
divinity76
16c1c49f1b
Update re2c and bison version error message "or newer" (#13112)
* nitpick re2c "or newer"
* nitpick bison "or newer"
2024-01-10 12:28:05 +01:00
Peter Kokot
64751a0df0 Merge branch 'PHP-8.3'
* PHP-8.3:
  Set libtool tag per command instead of global one
2024-01-10 09:17:48 +01:00
Peter Kokot
fd7342f62f Fix _GNU_SOURCE redefined warnings in config.log
_GNU_SOURCE is already defined when doing these checks and warnings are
emitted otherwise in the configuration step.
2024-01-10 08:39:29 +01:00
David Carlier
b667616fe0 Merge branch 'PHP-8.3' 2024-01-09 22:01:37 +00:00
haszi
fed9cf6868 Mark ob_start callback parameter nullable 2024-01-09 22:55:49 +01:00
Niels Dossche
5e34bb8916 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-13094: range(9.9, '0') causes segmentation fault
2024-01-09 22:12:35 +01:00
Tim Düsterhus
4cda181c11
[skip ci] Update ext/random year for myself in EXTENSIONS 2024-01-09 20:53:28 +01:00
Tim Düsterhus
162e1dce98
random: Optimize data flow for the generate function of native engines (#13043)
Instead of returning the generated `uint64_t` and providing the size (i.e. the
number of bytes of the generated value) out-of-band via the
`last_generated_size` member of the `php_random_status` struct, the `generate`
function is now expected to return a new `php_random_result` struct containing
both the `size` and the `result`.

This has two benefits, one for the developer:

It's no longer possible to forget setting `last_generated_size` to the correct
value, because it now happens at the time of returning from the function.

and the other benefit is for performance:

The `php_random_result` struct will be returned as a register pair, thus the
`size` will be directly available without reloading it from main memory.

Checking a simplified version of `php_random_range64()` on Compiler Explorer
(“Godbolt”) with clang 17 shows a single change in the resulting assembly
showcasing the improvement (https://godbolt.org/z/G4WjdYxqx):

    - add     rbp, qword ptr [r14]
    + add     rbp, rdx

Empirical testing confirms a measurable performance increase for the
`Randomizer::getBytes()` method:

    <?php
    $e = new Random\Engine\Xoshiro256StarStar(0);
    $r = new Random\Randomizer($e);

    var_dump(strlen($r->getBytes(100000000)));

goes from 250ms (before the change) to 220ms (after the change). While
generating 100 MB of random data certainly is not the most common use case, it
confirms the theoretical improvement in practice.
2024-01-09 19:04:29 +01:00
Dmitry Stogov
d778c24aa2 Merge branch 'PHP-8.3'
* PHP-8.3:
  Disable inlining and inter-procedure-analyses for zend_string_equal_val() function that may be overriden for valgrind (#13099)
2024-01-09 20:06:15 +03:00
Ilija Tovilo
d7d0d19d32
Support index.php fallback for files in built-in server
If no router script is used, the built-in webserver will now look for a fallback
index file recursively in all cases, including URLs with a period.

Fixes GH-12604
Closes GH-12992
2024-01-09 16:13:39 +01:00
Ilija Tovilo
8876639d11
Add X-Powered-By header to builtin 404 page (#13092)
As requested by 30929c9a88 (r1434156785).
2024-01-09 16:10:39 +01:00
Ilija Tovilo
59c38969de
[skip ci] Remove PHP 8.0 references from CI 2024-01-09 10:39:20 +01:00
Gabriel Caruso
811c5ff2f4 [ci skip] PHP 8.0 is EOL
Following php/web-php#840, 670052c42 and php/web-qa#c7b24521eb1
2024-01-09 01:46:59 +01:00
Peter Kokot
3b73db612b
Remove unused symbol HAVE_ODBC2 (#13088) 2024-01-08 23:32:46 +01:00
Peter Kokot
6aad7a07bb
Fix DragonFly build (#13085)
On DragonFly by default the BSD make is used with the CSH shell and the
first prerequisite variable `$<` in Makefile doesn't work there. So, we
can simplify this by simply repeating the filename here.
2024-01-08 23:32:30 +01:00
Máté Kocsis
8e38226abf
Merge branch 'PHP-8.3'
* PHP-8.3:
  Backport upgrading PHP-Parser to PHP-8.3
2024-01-08 16:18:26 +01:00
Ilija Tovilo
d8df700e45
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix run-tests.php differ calculateCommonSubsequence for EXPECTF
2024-01-08 13:36:51 +01:00
Máté Kocsis
281555d02d
Migrate to the final version of PHP-Parser 5.0.0 2024-01-08 00:14:13 +01:00
Jorg Adam Sowa
73722df439
Improve preg_* functions warnings for NUL byte (#13068)
* Improve error messages for preg_ functions
* Adjusted tests and fixed formatting
* Removed unnecessary strings from preg_* tests
* Removed ZPP tests
2024-01-07 13:40:54 +00:00
haszi
90800b62bb
Change PHP_ZTS and PHP_DEBUG to bool to match their ZEND equivalents (#13079)
Co-authored-by: haszi <haszika80@gmail.com>
2024-01-07 13:38:26 +00:00
Peter Kokot
6f3888fe9a
Remove root library check for dlopen() and dlsym() (#13086)
The root library was added here for the Haiku system, to check dlopen()
and dlsym(). However, the root library is already explicitly linked in
the system, and it does not need to be checked neither linked anymore,
since at least ~2013.
2024-01-07 10:07:17 +01:00
Peter Kokot
2fec3e7f41
Remove unused phpdbg build variables (#13078)
- PHP_PHPDBG_CFLAGS and PHP_PHPDBG_FILES were once used in the generated
  Makefile.
- BUILD_PHPDBG check was used together with unused and obsolete phpdbg
  webhelper configuration.
2024-01-06 18:52:55 +01:00
Arnaud Le Blanc
44a246ed6d Merge branch 'PHP-8.3'
* PHP-8.3:
  [ci skip] NEWS
  [ci skip] NEWS
  Fix timer leak (#13027)
2024-01-05 19:47:58 +01:00
Peter Kokot
22ec2585a1
Omit HAVE_INET_NTOP definition with AC_CHECK_FUNC (#13073)
Following the bb1109d9f1 this now doesn't
define the unused symbol HAVE_INET_NTOP also in Autotools build system.
2024-01-05 19:41:54 +01:00
Niels Dossche
67eb196f1e Remove unused Lexbor file 2024-01-05 17:21:22 +01:00
Niels Dossche
dced97c02f Update Lexbor 2024-01-05 17:21:08 +01:00
Jakub Zelenka
1612a716a0
[ci-skip] Add missing credit for openssl_csr_sign serial_hex to Florian 2024-01-05 14:43:29 +00:00
Jakub Zelenka
e0679f3d5e
Introduce new serial_hex parameter to openssl_csr_sign
Co-authored-by: Florian Sowade <f.sowade@suora.com>

Closes GH-13023
Closes GH-9851
2024-01-05 14:40:22 +00:00
Peter Kokot
bb1109d9f1 Remove unused HAVE_INET_NTOP
The inet_ntop() is always required and present via
931a8b0739.
2024-01-04 20:48:17 +01:00
Peter Kokot
b632528eb3 Merge branch 'PHP-8.3'
* PHP-8.3:
  Update year to 2024
2024-01-04 19:30:19 +01:00
Peter Kokot
2caa2fe00d
Remove libbind from build system (#12991)
Linking with -lbind is no longer relevant. The libbind was once part of
the ISC project bind9. In 2013, maintenance was moved to NetBSD which
integrated it into netresolv.

[1]: https://www.isc.org/othersoftware/#libbind
[2]: https://wiki.netbsd.org/individual-software-releases/netresolv/
2024-01-04 19:23:46 +01:00
Máté Kocsis
0b7cd1423a
Add upgrading note about PHP_OUTPUT_HANDLER_PROCESSED
[skip-ci]
2024-01-04 16:05:49 +01:00
haszi
c1a8cc59cc Add PHP_OUTPUT_HANDLER_PROCESSED constant to stubs 2024-01-04 15:57:12 +01:00
Niels Dossche
14bdb01f8c
Fix failing 32-bit mbstring tests (#13069) 2024-01-04 08:30:17 +01:00
Niels Dossche
ddbc74c419 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix #71465: PHAR doesn't know about litespeed
2024-01-03 21:35:09 +01:00
Niels Dossche
03547f6832
Remove properties field from php_libxml_node_object (#13062)
This shrinks the struct from 80 bytes to 72 bytes.
This was unused internally, I did not find users externally via GitHub
search.
The intention for this was that it could be used for attaching extra
data as a 3rd party to a node. However, there are better mechanisms for
that like using actual objects.
2024-01-03 20:03:56 +01:00
Peter Kokot
96ee0787cf
Remove unused php.sym files (#13065)
These were used with the --enable-versioning option and are no longer
used like this.

Removed via b0ef04af84

At this time, sapi/cgi, sapi/cli, and sapi/fpm create and use php.sym
file at the build phase in the php-src project root directory only on
AIX platform.
2024-01-03 19:31:58 +01:00
David Carlier
ba9cf25298 Merge branch 'PHP-8.3' 2024-01-03 17:35:44 +00:00
Jakub Zelenka
2fe05c8980
Merge branch 'PHP-8.3' 2024-01-02 15:52:00 +00:00
Peter Kokot
3164a9effb
Remove unused in_addr_t type alias (#12994)
The fastcgi code was refactored in
18cf4e0a8a and in_addr_t is no longer
used. The PHP_CHECK_IN_ADDR_T is also obsolete and not recommended way
to discover availability of the type. If needed in the future, the
AC_CHECK_TYPES can be used instead.
2024-01-02 16:41:33 +01:00
Sergey Panteleev
85ffdefcd5
Merge branch 'PHP-8.3'
* PHP-8.3:
  PHP-8.2 is now for PHP 8.2.16-dev
2024-01-02 16:43:52 +03:00
Derick Rethans
cba4c409b1 Merge branch 'PHP-8.3' 2024-01-02 11:07:36 +00:00
Derick Rethans
3e6520ac0f Updated to version 2023.4 (2023d) 2024-01-02 10:21:29 +00:00
Derick Rethans
c551dbdcb1 Empty merge 2024-01-02 10:21:29 +00:00
Jorg Adam Sowa
60abd94bf2
Changed value passed to show_start to $start_timestamp (#13064) 2024-01-02 10:36:52 +01:00
Peter Kokot
5b268fa929
Use AC_CHECK_MEMBERS instead of AC_EGREP_HEADER (#13048)
AC_EGREP_* macros are not recommended due to their unreliability in
certain cases, checking for struct member can be done here using the
usual AC_CHECK_MEMBERS instead.

AC_CHECK_MEMBERS macro by default defines constant
HAVE_STRUCT_SOCKADDR_UN_SUN_LEN.
2024-01-02 04:46:28 +01:00
Niels Dossche
ea6110f52e Merge branch 'PHP-8.3'
* PHP-8.3:
  Skip on Windows
2024-01-01 15:59:01 +01:00
Niels Dossche
7213e448de Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix test not emitting warning because of Windows paths
2024-01-01 15:27:48 +01:00
Niels Dossche
f391a26895 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix test on Windows
2024-01-01 14:57:04 +01:00
Niels Dossche
c35fc1c4d4 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix #77432: Segmentation fault on including phar file
2024-01-01 13:46:58 +01:00
Peter Kokot
da60d89590
Remove obsolete UNIX System V 4.0 (#13049)
UNIX System V is operating system from 1988 and was incoporated later on
into various other UNIX systems with different uname outputs so this
check can be now safely removed.
2023-12-31 21:18:31 +01:00
Michael Orlitzky
7f8adf8a82 ext/gd/tests: imagerotate() is always available
Following 59ec80c5, the imagerotate() function is always available. We
may therefore remove its function_exists() checks without harm.
2023-12-31 17:11:25 +00:00
Michael Orlitzky
0b8466f268 ext/gd/tests: add SKIPIF stanzas for missing PNG support
The bundled libgd always has PNG support, but an external one may not.
2023-12-31 17:11:25 +00:00
Michael Orlitzky
49247de018 ext/gd/tests: fix three misleading die() messages
Three of our gd tests could be skipped with a message about requiring
bundled GD, but those tests don't actually require bundled GD. We
update the messages to mention the specific functions that are
required.
2023-12-31 17:11:25 +00:00
Ilija Tovilo
37d5bee1dc
Fix \e escape character on Windows
\e is not part of the C standard.

Closes GH-13058
2023-12-31 14:27:12 +01:00
Ilija Tovilo
c68f4f616c
[skip ci] Fix macos nightly version for older branches 2023-12-31 13:46:32 +01:00
Niels Dossche
da6766d778 Use more optimal perfect hash table 2023-12-30 18:29:47 +02:00
Niels Dossche
0ea4f39a5c Add script to aid generation of perfect hash table 2023-12-30 18:29:47 +02:00
Alex Dowad
5fdb27246c Add mbstring support for GB18030-2022 text encoding
The previous version of the GB-18030 standard was published in 2005.
This commit adds support for the updated (2022) version of this text
encoding. The existing GB18030 implementation has been left unchanged
for backwards compatibility; users who want to use the new standard
must explicitly indicate the desired text encoding is 'GB18030-2022'.

The document which defines GB18030-2022, published by the government
of the People's Republic of China, defines three levels of standards
compliance. This implementation is intended to achieve Implementation
Level 3, which is the highest level of compliance.

Experts in the GB18030 standard are requested to assess this
implementation and report any deviation from the standard.
2023-12-30 18:29:47 +02:00
Alex Dowad
febe05198d Align hex dumps in mbstring unit test failure message for easy comparison
When developing mbstring, and a unit test fails, this will make it
easier and quicker to identify the cause of the test failure.
2023-12-30 18:29:47 +02:00
Peter Kokot
84022db846
Remove unused SIZEOF_SHORT (#13034) 2023-12-30 00:58:47 +01:00
Peter Kokot
d657d5592e
Check host_alias on one place (#13042) 2023-12-29 22:44:39 +01:00
Jorg Adam Sowa
948b2bc211
Add miliseconds do the test time output (#12729)
Also replaced microtime() with hrtime()
2023-12-29 16:03:30 +00:00
haszi
703ef91edb
Improve ob_get_status() tests (#13018)
* Update basic ob_get_status() test

* Update ob test with class method, anonymous function, and invokable object as output handler

---------

Co-authored-by: haszi <haszika80@gmail.com>
2023-12-29 15:24:06 +00:00
Dmitry Stogov
df42f7f128 Update IR
IR commit: 730763fb25d096099af22c75190fbf7e748ac5af
2023-12-29 15:34:24 +03:00
Dmitry Stogov
0a8c97d1c3 Update IR
IR commit: 831f3810e07917ef2ffc4f531e7144944cc8d1c1
2023-12-28 20:25:07 +03:00
David Carlier
b02f95adae ext/sockets: adding windows SO_EXCLUSIVEADDRUSE constant.
Close GH-13030
2023-12-28 15:38:58 +00:00
Niels Dossche
1d641f6c6d Merge branch 'PHP-8.3'
* PHP-8.3:
  [ci skip] Fixes in NEWS
2023-12-27 23:26:55 +01:00
Niels Dossche
20a15ee70b Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-12974: Apache crashes on shutdown when using pg_pconnect()
2023-12-27 20:16:44 +01:00
Michael Orlitzky
85e5635a8e Fix detection of image formats in system gd library
- Use gdFontCacheShutdown() to detect freetype
  Currently we look for gdImageStringFT() to determine whether or not gd
  has freetype support... but that function always exists. This leads
  PHP to believe that gd has freetype support when it does not, and can
  lead to build failures.

  The gdFontCacheShutdown() function, on the other hand, is only present
  when gd was built with freetype support. Let's use that instead.

- Fix GD image format detection
  We currently check for, say, AVIF support by attempting to link a
  program that calls libgd's gdImageCreateFromAvif() function. But
  perversely, that function always exists in libgd; moreover when AVIF
  support is missing it emits a warning and returns normally. Thus
  our straightforward link test becomes not so straightforward.

  This commit adds a new macro PHP_GD_CHECK_FORMAT that compiles, links,
  and runs a test program instead. The test program overrides that "emit
  a warning" handler so that the program actually fails if the format
  we're looking for is not supported. This fixes detection of AVIF and
  the other formats we check for in an external libgd.

- ext/gd/tests/bug77391.phpt: skip if gd lacks BMP support
  I don't actually know how to remove BMP support from libgd, but PHP
  has a ./configure test for it, so we should probably treat it as
  optional.

Closes GH-12019
2023-12-27 14:12:32 +01:00
Niels Dossche
2e12e80ac4 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-13012: DOMNode::isEqualNode() is incorrect when attribute order is different
2023-12-27 02:22:50 +01:00
Jorg Adam Sowa
f5f44bb22d
Refactor tests for pow() function (#13005) 2023-12-26 23:43:52 +00:00
Dmitry Stogov
2ab1c3d5ad Update IR
IR commit: 76dea0e897bff7e67f560f9768672519bd9783d4
2023-12-26 18:18:13 +03:00
Dmitry Stogov
6aa8687461 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix assertion
2023-12-25 13:22:47 +03:00
Jakub Zelenka
3f82da0a4e Add test for openssl_csr_new multi dn entry 2023-12-24 13:53:13 +00:00
Máté Kocsis
012ec21def
Remove unused parameter from zend_compile_typename()
The force_allow_null parameter is always false, therefore it is not needed. This simplification paves the road for deprecating implicitly nullable parameter types.
2023-12-24 14:14:35 +01:00
Jorg Adam Sowa
f1f33ee3a1
Added missing case 0.0 to the test runtime_compile_time_binary_operands.phpt (#13010) 2023-12-24 01:06:32 +01:00
Ilija Tovilo
40908f32a0
Test JIT on clang/asan build (#13006)
Clang enables the pointer-overflow check which is incompatble with the tracing
JIT. We can still test the JIT by disabling this check.
2023-12-23 19:18:04 +01:00
David Carlier
70091492d5 Merge branch 'PHP-8.3' 2023-12-23 17:16:04 +00:00
Niels Dossche
76f24d3531 Merge branch 'PHP-8.3'
* PHP-8.3:
  Revert "Fix crashes with entity references and predefined entities"
2023-12-23 17:31:28 +01:00
Niels Dossche
c293de792f Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix libxml2 build for 2.12.0-2.12.2
2023-12-23 17:21:34 +01:00
David Carlier
20c72e1a43 Revert "Merge branch 'PHP-8.3'"
This reverts commit 5455c3fc01, reversing
changes made to ec8e86b96f.
2023-12-23 16:04:46 +00:00
Niels Dossche
f420ea84aa Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix crashes with entity references and predefined entities
  Fix crash in adoptNode with attribute references
2023-12-23 17:01:28 +01:00
Niels Dossche
20dfc41053 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix crash when toggleAttribute() is used without a document
2023-12-22 21:13:12 +01:00
David Carlier
5455c3fc01 Merge branch 'PHP-8.3' 2023-12-22 17:28:29 +00:00
Niels Dossche
ec8e86b96f Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-12980: tidynode.props.attribute is missing "Boolean Attributes" and empty attributes
2023-12-22 17:38:24 +01:00
Peter Kokot
08b11e8e71 [skip ci] Update NEWS so it includes only PHP-8.4 relevant changes 2023-12-22 17:11:11 +01:00
Peter Kokot
907b07822c Merge branch 'PHP-8.3'
* PHP-8.3:
  Add cross-compiling 3rd argument to AC_RUN_IFELSE
2023-12-22 16:35:40 +01:00
David CARLIER
952ffbfe50
macOs CI update. (#12998)
macOs CI update.

since sonoma (14) had been released since few months, we could afford to
upgrade to its previous release.
2023-12-22 15:24:53 +00:00
Niels Dossche
702fbc8b18 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-12969: Fixed PDO::getAttribute() to get PDO::ATTR_STRINGIFY_FETCHES
2023-12-22 15:08:42 +01:00
David Carlier
4ffa6e313b Merge branch 'PHP-8.3' 2023-12-22 14:01:05 +00:00
Jakub Zelenka
48ebe588cd
Implement request #48520: openssl_csr_new should allow multiple values/fields in dn
Closes GH-12984
2023-12-21 16:56:59 +00:00
Jakub Zelenka
e8fde6bd92
Fix bug #80269: OpenSSL sets Subject wrong with extraattribs parameter
Closes GH-12979
2023-12-21 16:51:13 +00:00
Jakub Zelenka
6c0d55934f
Merge branch 'PHP-8.3' 2023-12-21 16:44:19 +00:00
Jorg Adam Sowa
94ddc74c9a
RFC: Add 4 new rounding modes to round() function (#12056)
https://wiki.php.net/rfc/new_rounding_modes_to_round_function

Co-authored-by: Tim Düsterhus <tim@bastelstu.be>
2023-12-21 13:28:05 +01:00
Dmitry Stogov
9267ebccfc Update IR
IR commit: 415f673be5116d121b934c0bdaf2a83f4d3a95fb
2023-12-21 13:45:23 +03:00
Alex Dowad
bb6ceec230 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix bug in mb_get_substr_slow (sometimes outputs wrong number of characters)
2023-12-21 09:35:01 +02:00
Saki Takamachi
5dfb2d95ea
[pdo_firebird] Added pdo_firebird_check_liveness handler (#12757) 2023-12-20 15:37:39 +00:00
Cristian Rodríguez
927adfb1a6
Use a single version of mempcpy(3) (#12257)
While __php_mempcpy is only used by ext/standard/crypt_sha*, the
mempcpy "pattern" is used everywhere.

This commit removes __php_mempcpy, adds zend_mempcpy and transforms
open-coded parts into function calls.
2023-12-20 15:16:32 +00:00
Niels Dossche
1fc85a30b3 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-12905: FFI::new interacts badly with observers
2023-12-19 15:59:43 +01:00
Dmitry Stogov
b6a0e3d472 Manually optimize DIV to SHR 2023-12-19 14:10:43 +03:00
Alex Dowad
cffdeb81d5 Add specialized implementation of mb_strcut for GB18030
For GB18030, it is not generally possible to identify character
boundaries without scanning through the entire string. Therefore,
implement mb_strcut using a similar strategy as the mblen_table based
implementation in mbstring.c. The difference is that for GB18030, we
need to look at two leading bytes to determine the byte length of a
multi-byte character.

The new implementation is 4-5x faster for short strings, and more than
10x faster for long strings. (Part of the reason why this new code has
such a great performance advantage is because it is replacing code
based on the older text conversion filters provided by libmbfl, which
were quite slow.)

The behavior is the same as before for valid GB18030 strings; for
some invalid strings, mb_strcut will choose different 'cut' points
as compared to before. (Clang's libFuzzer was used to compare the
old and new implementations, searching for test cases where they had
different behavior; no such cases were found.)
2023-12-18 17:01:20 +02:00
Niels Dossche
dd0f2abc80 Use param->len instead of strlen 2023-12-18 13:53:57 +00:00
Niels Dossche
e6e0231a98 Use asprintf return value for the size 2023-12-18 13:53:57 +00:00
Niels Dossche
b198d0cc0c Use precomputed length for phpdbg_try_file_init() 2023-12-18 13:53:57 +00:00
Niels Dossche
6991518685 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-12953: SSA integrity verification failed when loading composer classmaps with more than 11k elements
2023-12-18 13:15:44 +01:00
Dmitry Stogov
d2e16a2199 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fixed type inference
2023-12-18 12:28:36 +03:00
Dmitry Stogov
45119549f0 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fixed incorrect elimination of refcounted check in JIT for BIND_GLOBAL
2023-12-18 11:31:45 +03:00
Dmitry Stogov
41a72655ae Update IR
IR commit: 1b50e33690406928a3f50491214b66460e82bb2c
2023-12-18 10:24:33 +03:00
Gina Peter Banyard
6da8b93ed5
ext/mbstring: Refactor mb_get_info() 2023-12-18 00:31:29 +00:00
Gina Peter Banyard
a6775c30c0
ext/mbstring: Refactor mb_trim_width() to take size_t arguments 2023-12-18 00:31:29 +00:00
Gina Peter Banyard
284b66be46
Merge branch 'PHP-8.3'
* PHP-8.3:
  add PDO::ATTR_AUTOCOMMIT to getAttribute
  Fix GH-12767: Fixed to be able to change autocommit mode using setAttribute
2023-12-18 00:28:14 +00:00
Marc Bennewitz
5d85378893 [ci skip] Added UPGRADING entry for GH-12413
Closes GH-12964.
2023-12-17 11:56:29 +01:00
Niels Dossche
61b7370b6d Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-12929: SimpleXMLElement with stream_wrapper_register can segfault
  Fix getting the address of an uninitialized property of a SimpleXMLElement resulting in a crash
  Fix GH-12962: Double free of init_file in phpdbg_prompt.c
2023-12-17 11:52:48 +01:00
Niels Dossche
d8268f1aba
Change return type of registerNodeClass to true (#12960) 2023-12-16 19:06:56 +01:00
Niels Dossche
0870da3364
Use strcspn() to optimize dom_html5_escape_string() (#12948)
* Use strcspn() to optimize dom_html5_escape_string()

This routine implemented by libc uses a faster algorithm than the old
naive byte-per-byte approach here. It also is often optimized using
SIMD.

* Calculate mask outside of loop
2023-12-16 13:47:57 +01:00
Niels Dossche
82baeeb196
Some more DOM testing and code style updates (#12933) 2023-12-16 13:46:08 +01:00
Jakub Zelenka
d6299206dd
Merge branch 'PHP-8.3' 2023-12-15 14:14:15 +00:00
Niels Dossche
ab5edb6a8e Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix 32-bit ext/hash build
2023-12-13 19:33:29 +01:00
Ilija Tovilo
b10e357461
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix clean for higher branches
2023-12-13 15:22:15 +01:00
Ilija Tovilo
e2972e4c15
Merge branch 'PHP-8.3'
* PHP-8.3:
  Disambiguate fileVar8 test folder
2023-12-13 14:32:01 +01:00
Ilija Tovilo
c00b0c7477
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix SELinux mprotect execheap error due to mem adjacent to heap
2023-12-13 11:26:36 +01:00
Ilija Tovilo
be46545ee0
Fix pcre out-of-bounds when using closing symbols as opening delimiter (#12946)
Apparently we support using closing symbols )]}> as opening and closing
delimiters.

Fixes oss-fuzz #65021
2023-12-12 21:58:34 +01:00
Niels Dossche
0917a3636e Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-12936: hash() function hangs endlessly if using sha512 on strings >= 4GiB
2023-12-12 19:58:21 +01:00
Niels Dossche
34ec4b3568
More testing of mime_sniff and fix off-by-one causing trailing whitespace to not be always stripped (#12935) 2023-12-12 17:44:36 +01:00
Niels Dossche
e78966386b Remove always-false condition from substr_replace()
l < 0 is checked before and set to a different value.
2023-12-12 16:43:43 +00:00
Niels Dossche
ea5521c68c Remove always-false condition from stream_is_local()
php_stream_from_zval returns if the value is NULL.
2023-12-12 16:43:43 +00:00
Niels Dossche
54be2656f4 Remove always-true condition in process_numeric_entity() 2023-12-12 16:43:43 +00:00
Niels Dossche
ddedd15eae Remove always-true condition in php_conv_open() 2023-12-12 16:43:43 +00:00
Niels Dossche
5e02bca537 Remove always-true condition from php_copy_file_ctx()
srcstream is always checked before.
2023-12-12 16:43:43 +00:00
Dmitry Stogov
a146487739 Update IR
IR commit: 8065a69830820e600e19e6d41fb184541535546d
2023-12-12 02:12:51 +03:00
Niels Dossche
642e11140c
Minor pcre optimizations (#12923)
* Update signature of pcre API

This changes the variables that are bools to actually be bools instead
of ints, which allows some additional optimization by the compiler (e.g.
removing some ternaries and move extensions).

It also gets rid of the use_flags argument because that's just the same
as flags == 0. This reduces the call frame.

* Use zend_string_release_ex where possible

* Remove duplicate symbols from strchr

* Avoid useless value conversions

* Use a raw HashTable* instead of a zval

* Move condition

* Make for loop cheaper by reusing a recently used value as start iteration index

* Remove useless condition

This can't be true if the second condition is true because it would
require the string to occupy the entire address space.

* Upgrading + remark
2023-12-11 19:43:26 +01:00
Ilija Tovilo
185627f0c6
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix zend_jit_undefined_long_key overwriting dim when dim == result
2023-12-11 15:07:52 +01:00
Dmitry Stogov
a8eecec9b6 Fixed AAech64 build 2023-12-11 15:11:59 +03:00
Dmitry Stogov
9fa7763d32 Update IR
IR commit: eeed93083e73396985d8ade7d90006021b517315
2023-12-11 15:11:34 +03:00
Thomas Hurst
b90c9ca7db Enable ifunc checks on FreeBSD 12+
This was disabled in 2019 due to problems reported in FreeBSD 11. The original
report (PHP bug 77284) includes a comment that FreeBSD 12 worked - which also
happens to be the first version ifunc use appeared in libc.

Close GH-12288
2023-12-11 09:07:28 +00:00
Peter Kokot
07a4f89c49
Sync ODBC version (#12922)
When passing `--without-odbcver` or `--with-odbcver=no` to configure,
the ODBC version has been designed to be highest supported version
(0x0350). This syncs the behavior with the Windows build system.
2023-12-11 09:55:30 +01:00
Peter Kokot
82349769b0
Remove obsolete SVN files excluding when packaging phar (#12920)
This was used in pecl.php.net/phar packaging when using the obsolete SVN
PHP repository.
2023-12-11 09:55:13 +01:00
Dmitry Stogov
7714f1fcf2 Support for IR API changes 2023-12-11 10:29:25 +03:00
Dmitry Stogov
f6376f5b12 Update IR
IR commit: dab739f3d2ea4eb547d0c61629473c10197444d5
2023-12-11 10:28:41 +03:00
Dmitry Stogov
52d53c30b3 Merge branch 'PHP-8.3'
* PHP-8.3:
  JIT: Fix .debug_abbrev section in GDB JIT API.
2023-12-11 10:11:13 +03:00
Kamil Tekiela
550fd8a25e
Update comment regarding MySQL user max length
The username can be up to 32 chars long as of MySQL 5.7.8
2023-12-10 17:30:08 +01:00
Alex Dowad
fea895bb49 Merge branch 'PHP-8.3'
* PHP-8.3:
  Character indices used by mb_strpos and mb_substr have same meaning, even on invalid strings
2023-12-10 15:04:14 +02:00
Arnaud Le Blanc
3c3aba11be Merge branch 'PHP-8.3'
* PHP-8.3:
  WS
  Clarify the stack limit exception message
  Fix GH-12643: Stack limit tests failing on ppc64le
2023-12-10 13:27:13 +01:00
Marc Bennewitz
b3f259d623
number_format: cast large floats within range of int to int
This prevents loosing precision for numbers above 2^52.

Closes GH-12333
2023-12-09 19:07:37 +00:00
David Carlier
19eb727b6a [ci skip] zend_call_stack NEWS update 2023-12-09 16:12:48 +00:00
David CARLIER
09838f17cb
zend_call_stack support proposal for solaris/illumos. (#12862) 2023-12-09 14:19:07 +00:00
Jakub Zelenka
2ffd040ffd
Merge branch 'PHP-8.3' 2023-12-09 13:26:29 +00:00
Niels Dossche
a9064816db
Optimizations for HTML 5 loading (#12896)
* Fix inverted NULL and add dictionary

* Avoid useless error processing if no reporting is set

* Avoid double work while processing attributes and use fast text instantiation
2023-12-08 18:45:01 +01:00
Niels Dossche
90eb5679d2
Cleanup libxml_get_external_entity_loader() (#12893)
We can directly put the value into return_value instead of copying
things around.
2023-12-08 18:44:46 +01:00
George Peter Banyard
90d41cccfd ext/mbstring: move another test case that only works on 64 bits 2023-12-08 17:17:28 +00:00
Niels Dossche
b34b4d54c3 Fix #44383: PHP DateTime not converted to xsd:datetime
Closes GH-12437.
Closes GH-11725.
2023-12-08 17:26:52 +01:00
Niels Dossche
2318a81725 Merge branch 'PHP-8.3'
* PHP-8.3:
  [ci skip] NEWS
2023-12-08 17:19:28 +01:00
Ilija Tovilo
c5c189da34
Merge branch 'PHP-8.3'
* PHP-8.3:
  [skip ci] Skip intermittently failing curl test on macOS
2023-12-08 13:38:54 +01:00
Niels Dossche
ec79fc9d9c Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-12870: Creating an xmlns attribute results in a DOMException
2023-12-07 22:51:02 +01:00
Gina Peter Banyard
7684a3d138
ext/mbstring: move unsigned 32 bit integer tests to a new test (#12891)
And only run it on 64 bit architectures as those are floats on 32 bit.
2023-12-07 20:19:11 +00:00
Alex Dowad
b0f7df1a67 Use optimized implementation of mb_strcut for Japanese mobile vendor UTF-8 variants
To facilitate sharing of mb_cut_utf8, I combined mbfilter_utf8.c and
mbfilter_utf8_mobile.c into a single source file.
2023-12-07 20:37:15 +02:00
Saki Takamachi
834cb64403
Feature: ext/pdo_firebird: Add transaction isolation level and mode settings (#12815)
* Added transaction isolation level and access mode

* Raise a ValueError if an invalid value is passed to PDO::FB_TRANSACTION_ISOLATION_LEVEL.
2023-12-07 17:34:55 +00:00
Ilija Tovilo
d6d838a21a
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix asan shadow memory and shared_alloc_mmap clash
2023-12-07 18:29:23 +01:00
Gina Peter Banyard
88ba9dc61b
ext/mbstring: Always throw ValueErrors for invalid mb_http_input() type 2023-12-07 17:23:01 +00:00
Ilija Tovilo
5f3b4c5d6c
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix max_execution_time with cli-server router script
2023-12-07 16:13:27 +01:00
Dmitry Stogov
b2483a180a Fix GH-12879: Function name is missing in error message on MacOS with function JIT 2023-12-07 10:35:22 +03:00
Dmitry Stogov
215c5cfef4 Update IR
IR commit: 8b2a536d746cd31f2bf6a6cb5f5e5172969457c5
2023-12-07 10:34:20 +03:00
Kamil Tekiela
36a5f4ffaf
Improve code quality in run-tests.php (#12889) 2023-12-07 02:24:31 +01:00
Frank Denis
1816403d84
[sodium] Add AEGIS-128L and AEGIS-256 (#12867)
Also don't prevent usage of AES-GCM on aarch64, it's been supported since libsodium 1.0.18.

Fixes #12312
2023-12-07 01:31:42 +01:00
Gina Peter Banyard
e74bf42c81
ext/mbstring: Check conversion map only has integers 2023-12-06 23:47:00 +00:00
Gina Peter Banyard
193b22fa2b
ext/mbstring: pass true conversion map size around 2023-12-06 23:46:52 +00:00
Niels Dossche
6f460fd272 Use diagnostic macros for the warning 2023-12-07 00:05:36 +01:00
Niels Dossche
f8d50647ea Merge branch 'PHP-8.3'
* PHP-8.3:
  Silence deprecations in zend-test
2023-12-06 23:49:34 +01:00
Niels Dossche
0d90b6c9d0 Merge branch 'PHP-8.3'
* PHP-8.3:
  Backport deprecation warning ignores to unbreak CI
2023-12-06 22:22:08 +01:00
Alex Dowad
a2ea45211c Return early from mb_get_substr if 'len' parameter is zero
This internal function is used to implement mb_strstr, mb_stristr,
mb_strrchr, mb_strrichr, mb_substr, mb_strimwidth, mb_trim, and
mb_str_pad. All of these functions will be faster if we return
early when requested for a zero-length "substring".
2023-12-06 22:12:38 +02:00
Alex Dowad
56077b03d5 Return early from mb_strcut if 'len' parameter is zero 2023-12-06 22:12:29 +02:00
Remi Collet
6f569b42fa
Merge branch 'PHP-8.3'
* PHP-8.3:
  fix function declaration isn't a prototype [-Wstrict-prototypes]
2023-12-06 14:52:04 +01:00
David CARLIER
8b1cfd55c5
adding devnexen for ext/intl. (#12881) 2023-12-06 14:13:17 +01:00
David Carlier
683e787860 Fix GH-12727: NumberFormatter constructor throws an exception on invalid locale.
Also re-establishing exception throwing on IntlDateFormatter constructor
overwritten by accident most likely so postponing it for next major
release.

Close GH-12868
2023-12-06 06:00:11 +00:00
Niels Dossche
d751e61504
Struct-pack stream-related data in ftpbuf (#12877) 2023-12-06 04:39:00 +00:00
Niels Dossche
bfb678a266 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-12854: 8.3 - as final trait-used method does not correctly report visibility in Reflection
2023-12-05 21:49:42 +01:00
Pierrick Charron
94c37b6ef3
Merge branch 'PHP-8.3'
* PHP-8.3:
  PHP-8.2 is now for PHP 8.2.15-dev
  PHP-8.3 is now for PHP 8.3.2-dev
2023-12-05 15:02:35 -05:00
Patrick Allaert
44df59dc94
Merge branch 'PHP-8.3' 2023-12-05 15:06:22 +01:00
Ilija Tovilo
016c3861d7
Fix asan false positive for mmap
For some reason, mmap regions which are repeatedly munmapped are not correctly
unpoisoned. See https://github.com/google/sanitizers/issues/1705.

Fixes GH-12756
Closes GH-12848
2023-12-05 12:18:09 +01:00
Ilija Tovilo
289073b452
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix compilation of ftp without openssl
2023-12-05 11:59:04 +01:00
Dmitry Stogov
8cc6b3576e
Fixed GH-12596: Segmentation fault on AArch64 release build with opcache.jit=1112 (#12813) 2023-12-05 12:04:00 +03:00
Michael Voříšek
8d98f7202a
Use ZSTR_IS_VALID_UTF8 macro where possible (#12869) 2023-12-05 05:24:11 +00:00
Gina Peter Banyard
b532b9a294
ext/mbstring: use unsigned char for variable with max value of 255 2023-12-05 05:15:53 +00:00
Gina Peter Banyard
840d800d15
ext/mbstring: Move variable declaration to inner scope 2023-12-05 05:15:41 +00:00
Gina Peter Banyard
ce82c48c08
ext/mbstring: Use bool where more appropriate instead of int 2023-12-05 05:15:32 +00:00
Gina Peter Banyard
3f64a7c008
ext/mbstring: Use unsigned int where more appropriate instead of int 2023-12-05 05:15:22 +00:00
Gina Peter Banyard
7c1ec84ead
ext/mbstring: Use size_t where more appropriate instead of int 2023-12-05 05:15:14 +00:00
Gina Peter Banyard
298f848513
ext/mbstring: use zend_result return type where appropriate 2023-12-05 05:15:06 +00:00
Niels Dossche
9c306470fb
Handle libxml2 OOM more consistently (#11927)
This is a continuation of commit c2a58ab07d, in which several OOM error
handling was converted to throwing an INVALID_STATE_ERR DOMException.
Some places were missed and they still returned false without an
exception, or threw a PHP_ERR DOMException.
Convert all of these to INVALID_STATE_ERR DOMExceptions. This also
reduces confusion of users going through documentation [1].

Unfortunately, not all node creations are checked for a NULL pointer.
Some places therefore will not do anything if an OOM occurs (well,
except crash).
On the one hand it's nice to handle these OOM cases.
On the other hand, this adds some complexity and it's very unlikely to
happen in the real world. But then again, "unlikely" situations have
caused trouble before. Ideally all cases should be checked.

[1] https://github.com/php/doc-en/issues/1741
2023-12-04 23:49:25 +01:00
Máté Kocsis
2cd8f3e625
Retain a RETURN_THROWS() in ext/sqlite3 2023-12-04 22:52:20 +01:00
Máté Kocsis
2d057757c4 Deprecate calling stream_context_set_option() with 2 arguments 2023-12-04 22:35:30 +01:00
Máté Kocsis
b36eac94d2 Deprecate calling session_set_save_handler() with more than 2 arguments 2023-12-04 22:35:30 +01:00
Máté Kocsis
688c6f373c Deprecate calling ReflectionMethod::__construct() with 1 argument 2023-12-04 22:27:59 +01:00
Máté Kocsis
beaf1e814a Deprecate calling pg_fetch_result(), pg_field_prtlen(), and pg_field_is_null() with 2 arguments 2023-12-04 22:27:59 +01:00
Máté Kocsis
682c2366be Deprecate calling ldap_exop() with more than 4 arguments 2023-12-04 22:27:59 +01:00
Máté Kocsis
1d41eb3014 Deprecate calling ldap_connect() with more than 2 arguments 2023-12-04 22:27:59 +01:00
Máté Kocsis
811245d2e0 Calling IntlGregorianCalendar::__construct() with more than 2 arguments and intlgregcal_create_instance() 2023-12-04 22:27:59 +01:00
Máté Kocsis
f4df37af3d Deprecate calling IntlCalendar::set() with more than 2 arguments and intlcal_set() 2023-12-04 22:27:59 +01:00
Máté Kocsis
adc26424aa Deprecate calling DatePeriod::__construct() with less than 3 arguments 2023-12-04 22:27:59 +01:00
Saki Takamachi
866aa12bcd
ext/pdo: Fixed PDO::setAttribute() and PDO::getAttribute() (#12793) 2023-12-04 16:05:30 +00:00
Dmitry Stogov
e502aaf0c5 Prevent starting JIT on x86_64 with buffuer size above 2G 2023-12-04 13:29:47 +03:00
Alex Dowad
c1a37c4ad4 Optimize mb_strcut for text encodings with mblen_table
For legacy text encodings where mb_strcut is implemented using an
mblen_table (such as the various SJIS variants), mb_strcut is now
~30% faster on small strings (about 10 bytes). This is because we
are now avoiding an extra, unnecessary copy operation on the
output string.

When used on large strings, the difference in performance is
negligible, as almost the entire runtime is spent stepping through
the string to find the starting and ending cut points.
2023-12-04 07:48:02 +02:00
Niels Dossche
775fb31d01 [ci skip] Add missing patch files 2023-12-03 22:48:03 +01:00
Máté Kocsis
7d5b754fd3
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix the default value of fetchMode in PDO::pgsqlGetNotify()
2023-12-03 09:17:22 +01:00
Niels Dossche
f3cddbb831 Remove redundant assignments to ftp->data
ftp_getdata() already does this.

Closes GH-12849.
2023-12-03 00:59:17 +01:00
Niels Dossche
35cf7abec7 Cleanup internal data_close API
This always returns NULL. Also passing in data is not necessary as it is
always equal to ftp->data.
2023-12-03 00:58:50 +01:00
Niels Dossche
f601963d4f Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-9348: FTP & SSL session reuse
2023-12-03 00:52:15 +01:00
Alex Dowad
5f1477d144 Optimize mb_strcut for fixed-byte-length text encodings
On microbenchmarks run on my dev machine, mb_strcut is now ~50% faster
for fixed-byte-length text encodings like ASCII. (This is because the
previous code did an extra, unnecessary copy operation on the
resulting output string.)
2023-12-02 14:10:54 +02:00
Niels Dossche
58fc521713 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix libxml2 2.12 build due to API breaks
2023-12-01 18:07:58 +01:00
Niels Dossche
6edbbc1c3e Implement GH-12385: flush headers without body when calling flush()
Closes GH-12785.
2023-12-01 17:15:57 +01:00
Niels Dossche
2af22ab786 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-12826: Weird pointers issue in nested loops
  Fix GH-12838: [SOAP] Temporary WSDL cache files not being deleted
2023-12-01 17:12:33 +01:00
Ilija Tovilo
30acbba2ca
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix leak of call->extra_named_params on internal __call
2023-12-01 16:50:56 +01:00
Jakub Zelenka
2d8f7df3b4
Merge branch 'PHP-8.3' 2023-12-01 14:49:22 +00:00
Dmitry Stogov
77781f0cbc Merge branch 'PHP-8.3'
* PHP-8.3:
  Fixed type inference
2023-12-01 17:09:53 +03:00
Jakub Zelenka
0c29d5edb7
Update release-process docs with info about first version release (#12765)
This is some additional info that might help to future RM's - those are the bits that are stumbled and felt they need to be clarified when releasing PHP-8.3.0
2023-12-01 11:58:52 +00:00
Peter Kokot
dc1fbe4027
Remove duplicated socket check (#12839)
Check is already done in configure.ac.
2023-12-01 11:57:38 +00:00
Peter Kokot
63ae7635c4
Remove ODBCRouter artifacts (#12846)
ODBCRouter flavor in odbc extension(s) was removed in PHP 7.3 via
398be731e6.
2023-12-01 10:26:33 +00:00
Peter Kokot
359f78492e
Remove outdated link to PHP introduction in PHP FPM (#12842) 2023-12-01 10:26:18 +00:00
Vinicius Dias
f1af7223f8
Fixing incorrect error message when passing null to join/implode's array parameter (#12683)
Closes GH-12682
2023-12-01 09:55:20 +00:00
Dmitry Stogov
c779bdc953 Fix Windoes build 2023-12-01 12:41:42 +03:00
Dmitry Stogov
bf6b66febe Restored support for CPU cache demotion 2023-12-01 11:56:02 +03:00
Dmitry Stogov
9c0ca381d7 Update IR
IR commit: ed4fd9e5efeb676e88b29c40893d7e8154cab44b
2023-12-01 11:54:51 +03:00
Niels Dossche
f283f50f1a Merge branch 'PHP-8.3'
* PHP-8.3:
  Add missing NULL checks for spl autoload table
  Add missing NULL pointer checks related to the previous call frame
2023-12-01 09:11:32 +01:00
Dmitry Stogov
4d51d588b9 JIT: Specify fastcall calling convenrion through dummy function prototype 2023-11-30 21:35:32 +03:00
Dmitry Stogov
4630f77ee4 Update IR
IR commit: a746ceb6506b21705bd35473144c60194ae3191d
2023-11-30 21:34:26 +03:00
Niels Dossche
f3ece813ff
Optimize size of ext/dom (#12830)
* Remove unused upper case tag static data

* Shrink size of static binary search tree

This also makes it more efficient on the data cache.

* Update patches
2023-11-29 22:27:00 +01:00
Niels Dossche
37a1e191dd Merge branch 'PHP-8.3'
* PHP-8.3:
  Test fixes for libxml2 2.12.0
2023-11-29 20:53:21 +01:00
Niels Dossche
ae83d6ab07
Fix issues related to libxml2 2.12.0 (#12802)
* Avoid passing NULL to xmlSwitchToEncoding

This otherwise switches to UTF-8 on libxml2 2.12.0

* Split tests for different error reporting behaviour in libxml2 2.12.0

* Avoid deprecation warnings for libxml2 2.12.0

We can't fully get rid of the parser globals as there are still APIs
that implicitly use them.

* Temporarily disable part of test for libxml 2.12.0 regression

See https://gitlab.gnome.org/GNOME/libxml2/-/issues/634

* Review fixes

* [ci skip] Update test description
2023-11-29 20:46:35 +01:00
Ilija Tovilo
e3de478f66
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix travis_wait
2023-11-29 10:36:15 +01:00
Dmitry Stogov
29a70828b9 Update IR
IR commit: 81047af575864c5dfd5fda62394ada46cc9cae27
2023-11-29 12:27:05 +03:00
yang yuhan
566100d7fe
Enhance moving PHP code pages into huge pages (#12806)
The former implementation of huge pages for PHP code segments may
fail to map in certain scenarios. For instance, if the initial
'r-x-' segment is not PHP, it will result in a failure to map into
huge pages. Consequently, the optimization for huge pages with PHP
code will no longer be effective.

This patch improves the implementation by accurately matching all
'r-x-' segments until it locates the PHP code segment. Subsequently,
it performs the necessary huge page mapping.


Reviewed-by: chen-hu-97 <hu1.chen@intel.com>

Signed-off-by: PeterYang12 <yuhan.yang@intel.com>
2023-11-29 10:49:23 +03:00
Ilija Tovilo
407fba9a64
Merge branch 'PHP-8.3'
* PHP-8.3:
  [skip ci] Skip resource intensive tidy test on GA
2023-11-29 00:27:54 +01:00
Dmitry Stogov
8495522963 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fixed GH-8251: Narrowing occurred during type inference of ZEND_FETCH_DIM_W
2023-11-28 23:34:45 +03:00
Alex Dowad
175b438abe Fix spurious failures of php-fuzz-mbstring 2023-11-28 21:04:17 +02:00
Niels Dossche
f1bc43b418
Use size_t for string lengths in ext/xml compat layer (#12808)
This is _not_ exploitable right now because libxml guarantees right now
a maximum string length of 1M bytes. But if that limit were to ever
change this could overflow in the future leading to exploits.
Again, not exploitable right now, but just making it more future-proof.
2023-11-28 19:51:25 +01:00
Niels Dossche
803cd824e5
Optimizations for mb_trim (#12803)
* Fast path for when there is nothing to trim in mb_trim

* Make mb_trim decide between linear search vs hash table lookup

Using empirical experiments I noticed that on my i7-4790 the hash table
approach becomes faster once we have more than 4 code points in the trim
characters, when evaluated on the worst case.

This patch changes the logic so that a hash table is used for a large
number of trim characters, and linear search when the number of trim
characters is <= 4.
2023-11-28 19:49:36 +01:00
Dmitry Stogov
fc1b467d0b Merge branch 'PHP-8.3'
* PHP-8.3:
  Fixed GH-12812: Integer string in variable used as offset produces wrong undefined array key warning (#12817)
2023-11-28 21:46:37 +03:00
Dmitry Stogov
d41ee53aaf Fixed GH-12809: Segmentation fault in exception handler with CALL VM on AArch64 2023-11-28 12:57:00 +03:00
Niels Dossche
6bd680b824 [ci skip] NEWS
For acbdfd24ec.
2023-11-28 08:19:46 +01:00
Ilija Tovilo
bea567674c
Merge branch 'PHP-8.3'
* PHP-8.3:
  Reduce parallelism on frequently crashing jobs
2023-11-28 00:31:51 +01:00
Ilija Tovilo
1ade8ef7d3
[skip ci] Skip failing date test on 32-bit 2023-11-28 00:26:30 +01:00
Daniil Gentili
fde41bc713
Report fatal error if JIT cannot be enabled
Closes GH-12403
2023-11-28 00:21:26 +01:00
Dmitry Stogov
e2e433a514 Fix test 2023-11-28 02:00:47 +03:00
Dmitry Stogov
701f8cbef2 Fixed broken test 2023-11-28 01:21:36 +03:00
Dmitry Stogov
25de668621 Merge branch 'PHP-8.3'
* PHP-8.3:
  Align error messages between normal VM and JIT for RW when using object as array (#12799)
2023-11-28 00:40:57 +03:00
Máté Kocsis
02bca09bc1
Add class aliases into the classmap of gen_stub.php
Now that we have class aliases (DOMNode -> DOM\Node), it has become important to add them to the class map so that it will be possible to generate class synopses for them.
2023-11-27 22:13:35 +01:00
Máté Kocsis
164995effe
Fix ext/dom object hierarchy
gen_stub.php references classes inside namespaces relatively
2023-11-27 22:09:31 +01:00
Dmitry Stogov
8f5156fcba Fixed trace type inference 2023-11-27 22:52:12 +03:00
Alex Dowad
26b4130f4a Merge branch 'PHP-8.3'
* PHP-8.3:
  Return value of mb_get_info can be NULL
2023-11-27 21:20:38 +02:00
David Carlier
2ef4785dac Merge branch 'PHP-8.3' 2023-11-27 18:20:38 +00:00
Dmitry Stogov
e30d78f332 Fixed incorrect guard elimination
Fixes oss-fuzz #64414
2023-11-27 21:12:04 +03:00
Gina Peter Banyard
298bba5319
Merge branch 'PHP-8.3'
* PHP-8.3:
  jit: fixed JIT "Attempt to assign property of non-object" warning emitted at the same time as Error is being thrown
2023-11-27 16:21:01 +00:00
Gina Peter Banyard
bd2c970e7e
Merge branch 'PHP-8.3'
* PHP-8.3:
  jit: fixed "Uninitialized string offset" warning being emitted at the same time as invalid offset Error
2023-11-27 16:07:53 +00:00
Jakub Zelenka
2fc4376960
[skip ci] Remove accidentally added NEWS-RC file 2023-11-27 15:46:38 +00:00
Niels Dossche
fc8393b5f9 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-12791: Possible dereference of NULL in MySQLnd debug code
2023-11-27 14:02:30 +01:00
Saki Takamachi
4bb75d569e
ext/pdo_mysql: Optimize tests (#12751) 2023-11-27 13:01:24 +00:00
Niels Dossche
acbdfd24ec Fix DOMElement->prefix with empty string creates bogus prefix
Closes GH-12770.
2023-11-27 13:27:07 +01:00
Remi Collet
cc5a1bac6c
Merge branch 'PHP-8.3'
* PHP-8.3:
  zip: use index to avoid search by name
2023-11-27 08:34:12 +01:00
Saki Takamachi
dfaf7986de
[pdo_firebird] Transaction management optimization (#12741)
take2 of #12657

## About Firebird transaction

Firebird is a full transactional database, so the DB itself does not support autocommit mode. (Strictly, there is an autocommit mode, but it is a different concept from the "autocommit" that we are used to with MySQL and others.)

Therefore, a transaction must have started before any operation is performed, and autocommit mode had to be emulated in PHP.

I made sure that a transaction always exists when in autocommit mode. Since the `in_transacntion` function does not work as expected, I have introduced `H->in_manually_txn` to determine whether a transaction is being manually manipulated.

## There are two types of commit/rollback

(I'm not talking about two-phase commit. This change does not take into account two-phase commit.)

There are `isc_commit_retaining` which starts a transaction again in the same context immediately after committing, and `isc_commit_transaction` which closes the transaction as is.

Similarly, there are two types of rollback.

-----------

Due to the default value of the transaction isolation level, autocommit mode may obtain unintended results.
Regarding this, it would be too large to include support for transaction isolation levels in this PR, so I will leave it as is for now.
2023-11-27 03:38:48 +00:00
Peter Kokot
40d1442cec
Remove unused gcov artifacts (#12786) 2023-11-27 02:07:05 +00:00
Niels Dossche
1e7c64bd4d Merge branch 'PHP-8.3'
* PHP-8.3:
  Avoid using uninitialised struct
2023-11-25 20:08:34 +01:00
Bob Weinand
ed431065fd Merge branch 'PHP-8.3' 2023-11-25 18:49:40 +01:00
Bob Weinand
78364ef97e Merge branch 'PHP-8.3' 2023-11-25 01:02:52 +01:00
Ilija Tovilo
f6efd126a5
Fix date createFromTimestamp test (#12766)
Unfortuantely, PHP_INT_MIN cannot be expressed as a literal in PHP, because -NUM
is parsed as (-)(NUM). NUM is restricted to PHP_INT_MAX.
2023-11-24 14:24:32 +01:00
Niels Dossche
fd3a8656ed [ci skip] UPGRADING 2023-11-24 13:37:08 +01:00
Niels Dossche
d3c2673754 [ci skip] NEWS and UPGRADING for mb_*trim 2023-11-24 11:47:32 +01:00
Yuya Hamada
a80b6d7b99 Add mb_trim function
Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
Co-authored-by: Gina Peter Banyard <girgias@php.net>
2023-11-24 08:04:51 +02:00
Peter Kokot
3665e90061
Remove unused PHP_COMPILE and CXX_PHP_COMPILE variables (#12760)
These were part of the old build system and are no longer used.
2023-11-24 01:35:24 +00:00
Peter Kokot
3c7fe92b7c
Remove unused aspell library installation (#12761)
Related to b035cb6c8e.
2023-11-24 01:35:01 +00:00
Derick Rethans
a4e80b09cb Merge branch 'PHP-8.3' 2023-11-23 16:18:50 +00:00
Ben Ramsey
a92c2da16f
Merge branch 'PHP-8.3' 2023-11-22 21:36:20 -06:00
Peter Kokot
d7d3a1c66e
Sync YFLAGS in scripts/dev/genfiles with PHP_PROG_BISON macro defaults (#12709)
- Adds -Wall YFLAGS when using the scripts/dev/genfiles to have similar
  output there in case things need to be fixed.
- Syncs @ suppression operators across the bison calls.
2023-11-22 22:54:09 +01:00
Niels Dossche
ec8f880921
[ci skip] Ignore bundled pcre2lib in code coverage (#12752) 2023-11-22 20:11:06 +01:00
Niels Dossche
4d32e2bb87 Remove more pspell remnants 2023-11-22 19:52:07 +01:00
Niels Dossche
126950fd2c Remove pspell from configure flags
This may fix CI.
2023-11-22 19:45:24 +01:00
Dmitry Stogov
889dadd636 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fixed regression introduced by https://github.com/php/php-src/pull/9601
2023-11-22 21:25:45 +03:00
Peter Kokot
5140889c92
Remove unused build variables (#12746)
- LFLAGS
- PHP_LIBS
- SHARED_LIBTOOL
- EXT_LIBS

These were part of the build system in the past and are no longer used
in current code.
2023-11-22 19:15:30 +01:00
SakiTakamachi
04f8c1bda8 Optimized error handling 2023-11-22 17:11:49 +00:00
SakiTakamachi
54b12bcdb4 Unified function naming conventions 2023-11-22 17:11:49 +00:00
Derick Rethans
b035cb6c8e PSpell has been moved to PECL
- https://github.com/php/pecl-text-pspell
- https://pecl.php.net/package/pspell
2023-11-22 16:51:07 +00:00
Derick Rethans
bfb9922892 Merged pull request #12413 2023-11-22 15:25:06 +00:00
Derick Rethans
8577d88014 Add NEWS entry 2023-11-22 15:25:01 +00:00
Marc Bennewitz
88f2dc6268 Added DateTime[Immutable]::createFromTimestamp / date_create_[immutable]_from_timestamp 2023-11-22 15:24:13 +00:00
Derick Rethans
b67c232d6d Merged pull request #11241 2023-11-22 14:46:06 +00:00
Derick Rethans
0dfac0e33b Fixed whitespace and formatting 2023-11-22 14:45:58 +00:00
jorgsowa
e7e5f1f2d4 Extended tests with date constants 2023-11-22 14:41:48 +00:00
Dmitry Stogov
e9e6eb714e Merge branch 'PHP-8.3'
* PHP-8.3:
  Fixed GH-12748: Function JIT emits "could not convert to int" warning at the same time as invalid offset Error
2023-11-22 13:26:25 +03:00
Dmitry Stogov
b50aa63a08 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fixed GH-12747: Function JIT returns invalid error message for coalesce operator on invalid offset
2023-11-22 13:02:18 +03:00
Dmitry Stogov
d20c8496e9 Update according to IR changes 2023-11-22 12:13:29 +03:00
Dmitry Stogov
acda3af045 Update IR
IR commit: 18a3192604d9475cee833c6f94079d31015a9754
2023-11-22 12:12:42 +03:00
Gina Peter Banyard
4c6e08dd09
Merge branch 'PHP-8.3'
* PHP-8.3:
  Mention correct bug number
2023-11-22 04:15:07 +00:00
Gina Peter Banyard
e5b3e37684
Merge branch 'PHP-8.3'
* PHP-8.3:
  ext/standard: Fix GH-9316
2023-11-22 04:10:39 +00:00
Levi Morrison
7843ef7ad5
Merge branch 'PHP-8.3' 2023-11-21 18:33:14 -07:00
David Carlier
65b06e36b7 Merge branch 'PHP-8.3' 2023-11-21 21:02:59 +00:00
Jakub Zelenka
98b207ed8a
Merge branch 'PHP-8.3' 2023-11-21 14:55:57 +00:00
Jakub Zelenka
6c8d489cd9
Merge branch 'PHP-8.3' 2023-11-21 14:01:57 +00:00
Peter Kokot
5c523edffe
Remove obsolete IRIX checks (#12737)
IRIX is a discontinued and closed-source OS with last release in 2006.
2023-11-21 02:56:53 +00:00
Peter Kokot
7d52f39954
Remove redundant PHP_SUBST_OLD(INCLUDE_PATH) (#12738)
The AC_SUBST(INCLUDE_PATH) is enough to only replace the variable in the
build-defs.h.in file.
2023-11-21 02:56:36 +00:00
Niels Dossche
9a34b57b28 ext/dom: Use zend_hash_add_new variant when registering classes and properties 2023-11-20 21:09:10 +01:00
Jakub Zelenka
107ed64e2e
Merge branch 'PHP-8.3' 2023-11-20 16:24:57 +00:00
Jakub Zelenka
594839b5fe
Merge branch 'PHP-8.3' 2023-11-20 13:43:43 +00:00
Saki Takamachi
239379b75b
ext/pdo_firebird: Output correct error messages 2023-11-20 13:21:43 +00:00
Ilija Tovilo
a5833577d7
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix in-place modification of filename in php_message_handler_for_zend
2023-11-20 14:13:12 +01:00
Ilija Tovilo
e0a6dbcbf4
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix use-after-free of name in var-var with malicious error handler
2023-11-20 14:06:40 +01:00
Dmitry Stogov
b46ed399c6 Fix php.ini (add missing "\n") 2023-11-20 11:59:47 +03:00
Máté Kocsis
ed6e289c31
Make the return type of some stream context related functions true (#12720)
Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
2023-11-19 20:36:42 +01:00
Niels Dossche
c15db2250d Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-11992: utf_encodings.phpt fails on Windows 32-bit
2023-11-19 16:46:13 +01:00
Niels Dossche
a963b1fbd9 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-12721: SplFileInfo::getFilename() segfault in combination with GlobIterator and no directory separator
2023-11-19 11:53:21 +01:00
Peter Kokot
77ea5c5691
Remove obsolescent AC_TYPE_SIZE_T (#12719)
The macro checks for existence of size_t in <stddef.h> otherwise it sets
it to 'unsigned int'. The size_t is part of C89 standard and all
platforms should have it. Macro is also marked to be made obsolete in
the future versions of Autoconf.

At this point there is still AC_FUNC_ALLOCA in PHP's configure.ac which
uses AC_TYPE_SIZE_T under the hood so the check is still done there in
the meantime.
2023-11-19 06:57:22 +00:00
Niels Dossche
91279cfdc0
Use binary search for cp932ext*_ucs_table lookups (#12712)
* Use binary search for cp932ext*_ucs_table lookups

A large amount of time is spent doing a linear search through these
tables in the CP932 encoding. Instead of that, we can add sorted
versions of these tables that also store the index of the non-sorted
version and perform a binary search on those sorted versions.

This reduces the time spent from 1.54s to 0.91s for the reference
benchmark [1].

[1] https://github.com/php/php-src/issues/12684#issuecomment-1813799924

* Fix search bounds
2023-11-18 12:09:12 +01:00
Niels Dossche
3ad422ebd0
Avoid temporary string allocations in php_mb_parse_encoding_list() (#12714)
This brings execution time down from 0.91s to 0.86s on the reference
benchmark [1].

[1] https://github.com/php/php-src/issues/12684#issuecomment-1813799924
2023-11-18 12:08:59 +01:00
Peter Kokot
a35a69ff0f
Clean duplicate headers check (#12710)
- AC_CHECK_HEADERS already includes the header(s) listed in the first
  argument, so additional net/if.h is redundant.
- The crypt.h is checked two times and HAVE_CRYPT_H is only needed in
  ext/standard.
- Remove duplicate <string.h> in ext/standard
- Remove duplicate <string.h> in getaddrinfo check in configure.ac
2023-11-18 04:20:36 +00:00
Peter Kokot
a6d5f3461b
Remove obsolete DG/UX check (#12713)
DG/UX is a discontinued Unix OS, the support for which ended in 2001.
2023-11-18 04:18:26 +00:00
Peter Kokot
de85e4a6d3
Remove unused PDO_MYSQL_MODULE_TYPE variable (#12711) 2023-11-18 04:18:15 +00:00
Jakub Zelenka
500b0fee40
Merge branch 'PHP-8.3' 2023-11-17 19:44:45 +00:00
Niels Dossche
6f215e0727 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-12616: DOM: Removing XMLNS namespace node results in invalid default: prefix
  Fix GH-12702: libxml2 2.12.0 issue building from src
2023-11-17 19:58:57 +01:00
Niels Dossche
7658220599
Improve performance of mbfl_name2encoding() by using perfect hashing (#12707)
mbfl_name2encoding() uses a linear loop through the encodings, comparing
the name one by one, which is very slow. For the benchmark [1] just
looking up the name takes about 50% of run-time.

By using perfect hashing instead, we no longer have to loop over the
list, and the number of string comparisons is reduced to just a single
one. The perfect hashing table is generated using GNU gperf and amended
manually to fit in with mbstring and manually changed to  reduce the
cache size.

[1] https://github.com/php/php-src/issues/12684#issuecomment-1813799924
2023-11-17 19:38:43 +01:00
David CARLIER
931a8b0739
inet_ntop requirement check at configure time instead (#12700) 2023-11-17 16:01:46 +00:00
KentarouTakeda
7f7da6aef9
Enable pdo-firebird nightly testing (#12699)
* Enable `pdo-firebird` Testing in Nightly

* fix(ext/pdo_firebird/tests): dont detect memory leak

* fix(ext/pdo_firebird): memory alignment error
2023-11-17 15:25:44 +01:00
Jakub Zelenka
62b2ad4b8a
Merge branch 'PHP-8.3' 2023-11-17 13:42:59 +00:00
Jakub Zelenka
d75240634d
Merge branch 'PHP-8.3' 2023-11-17 12:46:30 +00:00
Jakub Zelenka
21596bfeb9
Merge branch 'PHP-8.3' 2023-11-17 12:11:54 +00:00
Jakub Zelenka
0f349d4c24
Add POSIX_SC_CHILD_MAX and POSIX_SC_CLK_TCK constants
Closes GH-12689
2023-11-17 11:09:30 +00:00
Alexandre Daubois
6f95273941
ext/pdo_mysql: Improve tests cleanup (#11879)
This allows the tests to be run in parallel.
2023-11-16 18:49:43 +00:00
Ilija Tovilo
44467eb29b
[skip ci] Update libmysqlclient versions
5.7 is EOL, 8.2 was released. Also remove mysqli from these builds as PHP-8.1
goes into security mode, after which nightly is not really actively supported
anymore.

Closes GH-12690
2023-11-16 17:02:35 +01:00
Ilija Tovilo
02494e7657
Merge branch 'PHP-8.3'
* PHP-8.3:
  [skip ci] Fix more test tmp file conflicts
2023-11-16 16:28:46 +01:00
Ilija Tovilo
52535ba08c
Merge branch 'PHP-8.3'
* PHP-8.3:
  Retry tests on deadlock
2023-11-16 16:03:08 +01:00
Ilija Tovilo
4a06c1d18b
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix file test race condition
2023-11-16 15:40:48 +01:00
Jakub Zelenka
ee56038d38
Merge branch 'PHP-8.3' 2023-11-16 14:37:41 +00:00
KentarouTakeda
3a544d151c
Enable pdo-firebird Testing in Linux CI Environments (#12677) 2023-11-16 11:52:14 +01:00
Ilija Tovilo
2895d4ac46
[skip ci] Update mysql 8.0 patch 2023-11-16 11:04:42 +01:00
Pengfei Li
f2706a8f30
JIT/AArch64: Fix an undefined symbol issue (#12687)
In AArch64 function `zend_jit_set_veneer()`, some debug code calls two
other functions `ir_disasm_find_symbol()` and `ir_disasm_add_symbol()`
defined in `ir_disasm.c`. However, `ir_disasm.c` is compiled under the
condition that capstone is available. This causes an undefined symbol
issue while loading `opcache.so` when JIT is triggered if PHP is built
without `--with-capstone`.

We find this issue on MacOS 12.5 if we build PHP with Clang 14. It does
not appear immediately when using other versions of toolchains because
of lazy binding. To reproduce this with Linux/GCC, we can disable lazy
binding by `export LD_BIND_NOW=1` before building PHP.

This fixes the issue by making the debug code conditionally compile.
2023-11-16 11:57:09 +03:00
George Peter Banyard
ba204a2e3a
ext/spl: Restructure spl_array.c file to move ArrayObject methods together 2023-11-16 00:41:37 +00:00
Gina Peter Banyard
1bdb0fddc1
Refactor pcntl_sigprocmask()/pcntl_sigwaitinfo()/pcntl_sigtimedwait() (#11860) 2023-11-16 00:40:18 +00:00
Niels Dossche
d882c5d580 Merge branch 'PHP-8.3'
* PHP-8.3:
  Use __DIR__-relative path in tests
  Fix GH-12675: MEMORY_LEAK in phpdbg_prompt.c
2023-11-15 22:01:05 +01:00
Ilija Tovilo
16f39ec80b
Intercept strlcpy and strlcat for msan on Clang 17 (#12674) 2023-11-15 17:43:44 +01:00
Ilija Tovilo
7bcfac9e65
Merge branch 'PHP-8.3'
* PHP-8.3:
  Automatically mark tests as flaky
2023-11-15 13:22:43 +01:00
Ilija Tovilo
5aeada0ee3
Fix potentially uninitialized warning on release build 2023-11-15 13:14:55 +01:00
Ilija Tovilo
bef97fb4a5
[skip ci] Fix nightly version check
The last attempt was incorrect for the schedule trigger, which runs multiple PHP
versions. Instead, the version information should be stored in the branch
object.
2023-11-15 11:53:39 +01:00
Daniil Gentili
2ca142ecd8
Improve jit tests
Closes GH-12425
2023-11-14 20:09:27 +01:00
Daniil Gentili
82dcfd19e6
Update nightly config (#12662) 2023-11-14 21:48:01 +03:00
Daniil Gentili
df286a1b98
Improve JIT config in fuzzer SAPI (#12519)
* Improve JIT config in fuzzer SAPI

* Fix

* Fix

* Update
2023-11-14 21:26:24 +03:00
Niels Dossche
50c2a9305c
Fix building ext/dom in directory other than src (#12671) 2023-11-14 19:23:10 +01:00
Ilija Tovilo
c3e98092df
[skip ci] Add xleak to xml test due to libxml2 bug 2023-11-14 18:42:00 +01:00
Ilija Tovilo
9f7148ece5
Merge branch 'PHP-8.3'
* PHP-8.3:
  [skip ci] Further increase allowable atime deviation
2023-11-14 18:37:32 +01:00
Ilija Tovilo
90fda030bd
Run nightly on single branch with workflow_dispatch and explicit branch (#12649) 2023-11-14 18:24:39 +01:00
Remi Collet
74a7b79883
Merge branch 'PHP-8.3'
* PHP-8.3:
  zip extension is 1.22.3
2023-11-14 15:58:27 +01:00
Remi Collet
42008b02dd
Merge branch 'PHP-8.3'
* PHP-8.3:
  NEWS
2023-11-14 14:59:01 +01:00
Remi Collet
6cbb075ffa
Merge branch 'PHP-8.3'
* PHP-8.3:
  NEWS
  NEWS
  fix GH-12661 (Inconsistency in ZipArchive::addGlob remove_path Option Behavior)
2023-11-14 14:58:11 +01:00
Dmitry Stogov
94f32df866 Fixed compilation warning 2023-11-14 12:22:38 +03:00
Niels Dossche
1492be5286
[RFC] DOM HTML5 parsing and serialization support (#12111) 2023-11-13 20:18:19 +01:00
Niels Dossche
17d2917fb7 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-12655: proc_open() does not take into account references in the descriptor array
2023-11-13 19:34:49 +01:00
David CARLIER
cc2bf11951
zend: introducing ZEND_ELEMENT_COUNT for struct's dynamic arrays. (#12650)
zend: introducing ZEND_ELEMENT_COUNT for struct's dynamic and flexible arrays.

It is mostly for ubsan and helping array bound checking.
2023-11-13 12:42:45 +00:00
Dmitry Stogov
350a692271 Merge branch 'PHP-8.3'
* PHP-8.3:
  Backport fix for GH-12512: JIT Assertion `info & (1 << type)' failed (#12660)
2023-11-13 13:33:55 +03:00
Jakub Zelenka
dee6a8f815
Merge branch 'PHP-8.3' 2023-11-12 18:18:43 +00:00
Ilija Tovilo
f8c2d1ec2f
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix astat imperciseness excemption in test
2023-11-12 14:07:17 +01:00
Ilija Tovilo
a785b2fac0
Merge branch 'PHP-8.3'
* PHP-8.3:
  Disable -fsanitize=function on Clang 17
2023-11-11 21:11:08 +01:00
Ilija Tovilo
a202bf54df
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix undeclared variable in stat tests
2023-11-11 21:01:26 +01:00
Niels Dossche
f150f99752
Improve browscap get_browser performance (#12651)
* Split function and use _new variant to avoid redundant checks

* Precompute better array size to avoid rehashing

* Use new function to add into array instead of merging into, preventing temporary memory allocations

* Convert to regex without separate copy + lowering

We're already doing a character-wise loop after lowering, so just lower
it character by character instead of looping over it twice and
allocating memory.

* Use HASH_MAP loop because htab can never be packed

This saves additional checks.

* Move destructor to more sensible place

* Remove now unused browscap_zval_copy_ctor

* Use zend_string_release_ex variant where possible

* Implement dedicated greedy wildcard matching algorithm

This avoids compiling, allocating and caching regexes and should run in
the same complexity.

* Cache previous length instead of repeatedly recomputing it

* Add additional optimization to wildcard * matching

* Move cheap checks to the callsite

The function prologue and epilogue have a stupidly high overhead for
those 2 simple checks at the start.

We can't always-inline the reg_compare function because it contains
alloca, and the alloca is really important for performance.
Instead, move those cheap checks to the call site.

* Use specialised loop to avoid unnecessary conversions and checks

* Optimize counting loop by taking into account the prefix

* Precompute the hash values of known keys

* [ci skip] UPGRADING

* Code style

* Add a note why we have the early-skip checks in the loop
2023-11-11 18:44:17 +01:00
Niels Dossche
299a234eb7 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-12621: browscap segmentation fault when configured in the vhost
2023-11-11 18:36:41 +01:00
Niels Dossche
b3e10df1f7 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-12635: Test bug69398.phpt fails with ICU 74.1
2023-11-11 17:04:48 +01:00
Arnaud Le Blanc
8f424dd36b
Test that objects free handler call zend_weakrefs_notify (#12546) 2023-11-11 13:53:35 +01:00
Niels Dossche
9bb341d1b1 [ci skip] Add myself to CODEOWNERS for ext/xsl
I'm able to review code for this and I'd like to get notified on PRs.
2023-11-10 17:30:19 +01:00
David Carlier
994d19d500 Merge branch 'PHP-8.3' 2023-11-10 16:08:08 +00:00
Ilija Tovilo
60ca5a0c1e
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix timezone dependent test
2023-11-10 12:11:36 +01:00
Jakub Zelenka
311cae03e7
Merge branch 'PHP-8.3' 2023-11-10 09:46:25 +00:00
Niels Dossche
490b80858d Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-12633: sqlite3_defensive.phpt fails with sqlite 3.44.0
  Fix GH-12628: The gh11374 test fails on Alpinelinux
2023-11-10 00:13:15 +01:00
Dmitry Stogov
a1cd010b12 Fix mistakes introduced in 886dd7c06f 2023-11-10 01:18:19 +03:00
Máté Kocsis
1f6770abf0
Remove unused stream filter resource name 2023-11-09 22:44:02 +01:00
Dmitry Stogov
886dd7c06f Improve fix for GH-12512: JIT Assertion `info & (1 << type)' failed 2023-11-09 23:21:38 +03:00
Jakub Zelenka
5492f0ae8f
Merge branch 'PHP-8.3' 2023-11-09 13:39:52 +00:00
Ilija Tovilo
1e5241d49b
[skip ci] Re-unparallelize odbc tests
SQL Server frequently deadlocks. Parallelization of these jobs, at least in CI,
is not worthwhile because there are enough tests to run in parallel for the few
workers available.
2023-11-09 11:22:15 +01:00
Dmitry Stogov
fc66f37d61 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fixed empty array inference
2023-11-08 22:04:23 +03:00
Dmitry Stogov
524b134607 Fixed failure in generator related tests on Mac introduced by 8ef695795c 2023-11-08 13:06:15 +03:00
Dmitry Stogov
01f24bb708 Fix incorrect trace type inference in a false loop
Fixes oss-fuzz #63846
2023-11-08 11:19:52 +03:00
Dmitry Stogov
11f46117d0 IR Update
IR commit: 1eaf5531e5f728b9519190bcf7906c9c9c9168ec
2023-11-08 10:25:02 +03:00
Ben Ramsey
66e95d945e
Add manifest file generated for releases to gitignore
[ci skip]
2023-11-07 14:45:05 -06:00
Ben Ramsey
9976feb11d
Merge branch 'PHP-8.3' 2023-11-07 14:32:32 -06:00
Eric Mann
d6c16874cd
Merge branch 'PHP-8.3' 2023-11-07 12:14:18 -08:00
Jakub Zelenka
894180e10e
Merge branch 'PHP-8.3' 2023-11-07 19:32:56 +00:00
Saki Takamachi
61c251d7bc
Add XLEAK for some msodbcsql tests (#12615) 2023-11-07 18:11:54 +01:00
Gina Peter Banyard
be2401ab61
[skip ci] gen_stub: Fix final comment text generation 2023-11-07 16:37:35 +00:00
Dmitry Stogov
b88d38787b Revert "Fix incorrect trace type inference in a false loop"
This reverts commit 7f06a9daa2.
2023-11-07 18:29:26 +03:00
Dmitry Stogov
7f06a9daa2 Fix incorrect trace type inference in a false loop
Fixes oss-fuzz #63846
2023-11-07 17:29:10 +03:00
Sergey Panteleev
420acedf04
Merge branch 'PHP-8.3'
* PHP-8.3:
  PHP-8.2 is now for PHP 8.2.14-dev
2023-11-07 17:14:29 +03:00
Dmitry Stogov
8ef695795c Fixed GH-12623: Segmentation fault in ZEND_DO_UCALL_SPEC_RETVAL_USED_HANDLER 2023-11-07 16:15:22 +03:00
Ilija Tovilo
c01fb83fee
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix inference of COPY_TMP
2023-11-07 12:04:24 +01:00
Dmitry Stogov
3a3d83625b Fixed IR construction
Fixes oss-fuzz #63857
2023-11-07 13:25:09 +03:00
Dmitry Stogov
a30d809290 Fixed incorrect dead edge elimination during IR construction
Fixes oss-fuzz #63931
2023-11-07 11:41:23 +03:00
Dmitry Stogov
fa59bbe662 Update IR
IR commit: ec588537889c84a4ec649a6f1aa9d7f1bfea7b4d
2023-11-07 11:40:11 +03:00
KentarouTakeda
c15988aab3
ext/pgsql: Refactor tests (#12608)
This makes the tests independent of each other and allows them to be run in parallel.

Co-authored-by: Gina Peter Banyard <girgias@php.net>
2023-11-06 22:36:52 +00:00
Niels Dossche
6537811527 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix unspecified behaviour in zend_alloc in heap->limit computation
2023-11-06 19:47:04 +01:00
Niels Dossche
92e4e8bdf4 Fix #49278: SoapClient::__getLastResponseHeaders returns NULL if wsdl operation !has output
Instead of early exiting, process the headers if tracing is enabled, and
exit after that.

Closes GH-12609.
2023-11-06 19:04:15 +01:00
Peter Kokot
ccdc21b39a
Remove check for dnet_addr in dnet_stub library (#12611)
The dnet_stub library was once used on some obsolete systems and was
needed for transitive linking with Sybase and some PHP extensions. At
this point, no known and supported system uses the dnet_stub library
name, so it's safe to remove this check. This also came in pdo_dblib as
a copy/paste from other removed PHP extensions.

Partially was already removed in 1b969a74d0.
2023-11-06 12:46:04 +00:00
Peter Kokot
d0056d63da
[skip ci] Use GitHub issue tracker link for reporting bugs (#12612) 2023-11-06 12:45:12 +00:00
Dmitry Stogov
93ed314432 Fixed incorrect type stores 2023-11-06 15:20:26 +03:00
David Carlier
44f9c226aa following-up on GH-12551: removing inet_ntoa usage
Close GH-12554
2023-11-06 12:05:56 +00:00
Niels Dossche
4022e287b2 [ci skip] NEWS 2023-11-05 14:06:50 +01:00
Niels Dossche
bb42b418d4
Cleanup arguments of _php_dom_insert_fragment() (#12610) 2023-11-04 17:09:01 +01:00
Peter Kokot
8f4dc71256
build: Fix check for sigsetjmp (#12606)
The usual check for presence of sigsetjmp will not be sufficient since
the sigsetjmp might be defined as a macro.
2023-11-04 15:13:01 +00:00
Peter Kokot
7d485aa628
ext/sockets: Clean header checks (#12607)
- Unused header checks removed:
  HAVE_NETINET_TCP_H and HAVE_SYS_UN_H are not used in the code.
- Duplicate linux/filter.h check removed:
  HAVE_LINUX_FILTER_H is already defined in ext/sockets.
2023-11-04 15:12:16 +00:00
Niels Dossche
1ad5f9da36 [ci skip] UPGRADING 2023-11-04 15:20:49 +01:00
Niels Dossche
9a973a3743
Optimize strcspn (#12594) 2023-11-04 13:54:30 +00:00
Saki Takamachi
bbe1222956
Fix GH-12296: [odbc] [pdo_odbc] Optimized odbc connection string creating (#12306)
Declare and initialize on one line

changed to use php_memnistr

store strlen(db) in a variable

Added a semicolon to the end of dsn.

If there is a semicolon at the end of the original dsn, it will be duplicated, so it will be removed.

Add condition when authentication information is null
2023-11-04 13:46:17 +00:00
Jakub Zelenka
f288d9c4b0
Merge branch 'PHP-8.3' 2023-11-03 17:18:40 +00:00
Jakub Zelenka
a66c926b68
Merge branch 'PHP-8.3' 2023-11-03 14:08:39 +00:00
Dmitry Stogov
afffcaeb4d Fixed GH-12512: JIT Assertion `info & (1 << type)' failed 2023-11-03 14:12:00 +03:00
Dmitry Stogov
3844593bfb An attempt to fix GH-12512 2023-11-03 13:49:50 +03:00
Dmitry Stogov
9e15910889 Merge branch 'PHP-8.3'
* PHP-8.3:
  Remove spaces
2023-11-03 10:58:47 +03:00
Dmitry Stogov
88a82cc6a1 Merge branch 'PHP-8.3'
* PHP-8.3:
  Backport fix for HASH/PACKED array inference through MAY_BE_ARRAY_EMPTY flag (#12591)
2023-11-03 10:57:31 +03:00
Dmitry Stogov
77312d8ea1 Fixed assertion 2023-11-03 02:16:08 +03:00
Dmitry Stogov
4489d17146 Remove spaces 2023-11-03 01:03:50 +03:00
Niels Dossche
4af359c93a Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix validation logic of php:function() callbacks in dom and xsl
2023-11-02 20:36:16 +01:00
Dmitry Stogov
7aa9ef7d12 Fixed incorrect type assumption
Fixes oss-fuzz #63809
2023-11-02 22:33:01 +03:00
David Carlier
bc47e2db80 Merge branch 'PHP-8.3' 2023-11-02 18:49:01 +00:00
Ilija Tovilo
9ba9b8f874
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix OP1 leak in error path of post inc/dec
2023-11-02 19:32:02 +01:00
Dmitry Stogov
1226fe027a Fixed codegeneration for ISSET_ISEMPTY_DIM
Fixes oss-fuzz #63805
2023-11-02 19:48:04 +03:00
Dmitry Stogov
1c95e227e9
Fixed HASH/PACKED array inference through MAY_BE_ARRAY_EMPTY flag (#12591)
* Fixed HASH/PACKED array inference through MAY_BE_ARRAY_EMPTY flag

This fixes GH-12527

* typo
2023-11-02 16:17:31 +03:00
Dmitry Stogov
4fce8c83bc Merge branch 'PHP-8.3'
* PHP-8.3:
  Don't JIT after fatal errors
2023-11-02 14:15:13 +03:00
Niels Dossche
d45f4cef08
Drop Laravel from benchmark CI (#12595)
Two issues:
- The demo page does not seem to be doing much, so the value is limited.
- The benchmark instruction count has too much variance to be useful.
2023-11-02 11:38:31 +01:00
Dmitry Stogov
110cdd336a Merge branch 'PHP-8.3'
* PHP-8.3:
  Fixed GH-10008: Narrowing occurred during type inference of ZEND_ADD_ARRAY_ELEMENT
  ext/intl: change when the locale is invalid for the 8.1/8.2 serie.
2023-11-02 08:21:36 +03:00
David Carlier
95c8ad2bd6 Merge branch 'PHP-8.3' 2023-11-01 19:19:16 +00:00
Peter Kokot
2a60543cee
Add deprecation notice when enabling mhash (#12586)
The mhash* functions are deprecated as of PHP 8.1.0.
https://wiki.php.net/rfc/deprecations_php_8_1
2023-11-01 16:26:27 +00:00
Dmitry Stogov
1b846f89b9 Fixed GH-12584: Assertion `ctx->control' failed with new JIT and CALL
VM`
2023-11-01 17:19:17 +03:00
Dmitry Stogov
f27090cbc2 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fixed GH-12564: The negative fiber.stack_size setting leads to crash
2023-11-01 16:28:50 +03:00
Dmitry Stogov
d7fc3ab07f Fixed GH-12585: Assertion t->stack_map[t->exit_info[exit_point].stack_offset + var].type == 4 2023-11-01 16:11:54 +03:00
Ilija Tovilo
d35faecbf2
Split strtr zpp (#12583) 2023-11-01 13:08:06 +01:00
Dmitry Stogov
aa7465a435 Fixed missed type store
Fixes oss-fuzz #63601
2023-11-01 14:26:01 +03:00
Dmitry Stogov
7fcbedd7df Merge branch 'PHP-8.3'
* PHP-8.3:
  Fixed inorrect QM_ASSIGN elimination
2023-11-01 09:55:51 +03:00
Gina Peter Banyard
5d98069456
[skip ci] gen_stub: Generate useful methodsynopsises for new functions/methods (#12330)
Co-authored-by: Máté Kocsis <kocsismate@woohoolabs.com>
2023-10-31 19:45:34 +00:00
Dmitry Stogov
2782577c4f Prevent starting JIT on AArch64 with buffuer aize above 128M
B and BL instructions are limited by 128M offset
2023-10-31 21:42:25 +03:00
Dmitry Stogov
93d5c0e946 Fixed missed type store 2023-10-31 17:55:37 +03:00
Marcos Marcolin
06b009c5a4
Declare missing types and other minor improvements in run-tests.php (#12573)
* refactor: declare missing types and other minor improvements.

* refactor: declare missing types and other minor improvements.

* refactor: declare missing types and other minor improvements.

* refactor: declare missing types and other minor improvements.

---------

Co-authored-by: Marcos Marcolin <marcos@ixcsoft.com.br>
2023-10-31 14:56:06 +01:00
Máté Kocsis
60a33af3c4
Fix validation of CLI arguments when a target manual directory has to be provided
Additionally, let's make sure that we don't try to process the stub files in the
manual target directory. This comes with a slight performance benefit.
2023-10-31 12:14:03 +01:00
Ilija Tovilo
36b7692b9c
Merge branch 'PHP-8.3'
* PHP-8.3:
  Use attribute for ignoring Laravel test
2023-10-31 11:49:19 +01:00
Máté Kocsis
500490ddd5
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-12558 Escape \N in generated stubs
2023-10-31 10:11:27 +01:00
Dmitry Stogov
f56f5e00fb Merge branch 'PHP-8.3'
* PHP-8.3:
  Backport fix for incorrect assumption about in-memory zval type
2023-10-31 12:04:46 +03:00
Michael Voříšek
cc8c24ab8f
Fix unused variable in phpdbg_cmd.c (#12575) 2023-10-31 08:28:16 +01:00
Dmitry Stogov
4fa8e68c24 Merge branch 'PHP-8.3'
* PHP-8.3:
  Backport implementation of iterative Pearce's SCC finding algoritm (#12528)
2023-10-31 10:00:33 +03:00
Dmitry Stogov
c282e2080f Add reference to IR framework 2023-10-31 08:54:04 +03:00
Dmitry Stogov
ed37ab9d14 Fixed codegeneration for NOT
Fixes oss-fuzz #63749
2023-10-31 08:34:14 +03:00
Dmitry Stogov
037d6d0924 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fixed GH-12511: Use must be in next opline assertion with patched infection
2023-10-31 07:52:56 +03:00
Dmitry Stogov
b7c34b7ff9 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix memory leak after GC inside a foreach loop (#12572)
2023-10-30 23:37:03 +03:00
Dmitry Stogov
93c57af778 Fixed GH-12560: Assertion `0 && "too long jmp distance"' failed with new JIT on AArch64 2023-10-30 21:39:29 +03:00
Ilija Tovilo
2efe366af6
Add zend_worklist.h to PHP_INSTALL_HEADERS (#12571)
Fixes GH-12565
2023-10-30 19:37:27 +01:00
Dmitry Stogov
411b6fb4e6 Fixed codegeneration for PRE_DEC
Fixes oss-fuzz #63713
2023-10-30 20:41:04 +03:00
Ilija Tovilo
e95ba52d88
Merge branch 'PHP-8.3'
* PHP-8.3:
  [skip ci] Fix laravel community build
2023-10-30 17:57:06 +01:00
Marcos Marcolin
3fd1e57ac0
Remove unused code in run-tests.php (#12553)
* chore: remove unused code in run-tests.php

* chore: remove unused code in run-tests.php

---------

Co-authored-by: Marcos Marcolin <marcos@ixcsoft.com.br>
2023-10-30 17:19:43 +01:00
Ilija Tovilo
3481f5d7a1
Merge branch 'PHP-8.3'
* PHP-8.3:
  [skip ci] Update mysql 5.7 patch
2023-10-30 16:51:07 +01:00
Ilija Tovilo
39459467f6
Attempt to fix pdo_mysql conflict on CircleCI (#12563) 2023-10-30 16:19:27 +01:00
Dmitry Stogov
52480b3a79 Fixed incorrect assumption about in-memory zval type 2023-10-30 17:54:30 +03:00
Ilija Tovilo
8b840b90e1
Merge branch 'PHP-8.3'
* PHP-8.3:
  Run FreeBSD on push
2023-10-30 11:28:34 +01:00
Dmitry Stogov
bd183a4069 Fixed codegeneration for MATCH
Fixes oss-fuzz #63681
2023-10-30 12:57:31 +03:00
Dmitry Stogov
e482785886 Fixed codegeneration for FETCH_DIM_IS
Fixes oss-fuzz #63666
2023-10-30 11:53:43 +03:00
Dmitry Stogov
c8cb68ad0a Fixed codegenertion for FETCH_DIM_W
Fixes oss-fuzz #63664
2023-10-30 11:19:49 +03:00
George Peter Banyard
c1fec9bbc3
PDO: Clean-up tests so it's easier to see if they use default test table (#12552) 2023-10-29 23:13:30 +00:00
Niels Dossche
4c6dbe0dd0 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix memory leak in error path of zend_register_list_destructors_ex
2023-10-29 21:47:44 +01:00
Niels Dossche
10ef903bf4 [ci skip] Update bug link to non-obsolete bugtracker to avoid link rot 2023-10-29 17:58:02 +01:00
Niels Dossche
3e33eda39a Fix cloning attribute with namespace disappearing namespace
Closes GH-12547.
2023-10-29 17:22:41 +01:00
Niels Dossche
a470c4aeef Fix GH-12532: PharData created from zip has incorrect timestamp
The datetime stored in the DOS time fields, which is what zip standard
uses, is local time without a timezone. There's an extension to the zip
file format since '97 that allows storing a unix timestamp (in UTC) in
the header for both the central directory and the local entries.
This patch adds support for this.

Closes GH-12548.
2023-10-29 17:20:44 +01:00
David Carlier
1c8943bc78 cleanup inet_ntoa usage.
starting with the socket extension. PHP 8 requires windows vista/2008
minimum, even more exotic systems like solaris or haiku supports
inet_ntop, so there is no need to keep supporting this old interface.

Close GH-12551
2023-10-29 15:54:20 +00:00
Niels Dossche
4cfc8f6d7a
Remove dead stores from ext/spl (#12550) 2023-10-29 14:42:23 +00:00
Niels Dossche
53218b1a32 Mitigate #51561: SoapServer with a extented class and using sessions, lost the setPersistence()
The problem is that in the testcase, the session is started before the
parent class is loaded. This causes an incomplete class in the session
storage. Then in the soap code the check
`Z_OBJCE_P(tmp_soap_p) == service->soap_class.ce` fails because it is
the incomplete class. It is a silent failure.

We cannot fix this easily. But we should let the user know something is
wrong, because it leaves them confused otherwise. So emit an error to
let them know and suggest a fix.

Closes GH-12540.
2023-10-29 12:56:50 +01:00
Arnaud Le Blanc
e71522419f Merge branch 'PHP-8.3'
* PHP-8.3:
  [ci skip] NEWS
  [ci skip] NEWS
  [ci skip] NEWS
  fix: don't delete an unitialized timer (#12537)
2023-10-29 12:25:55 +01:00
Jorg Adam Sowa
74ba9167c8
Typed constants in sqlite extension (#12379) 2023-10-29 10:53:07 +01:00
Jorg Adam Sowa
9ad7844160
Typed constants in Intl extenstion (#12360) 2023-10-29 10:50:16 +01:00
Jorg Adam Sowa
dff8679af8
Typed constants in PDO extension (#12362) 2023-10-29 10:43:19 +01:00
Alex Dowad
d04854b38c Add fast mb_strcut implementation for UTF-16
Similar to the fast, specialized mb_strcut implementation for UTF-8
in 1f0cf133db, this new implementation of mb_strcut for UTF-16 strings
just examines a few bytes before each cut point.

Even for short strings, the new implementation is around 2x faster.
For strings around 10,000 bytes in length, it comes out about 100-500x
faster in my microbenchmarks.

The new implementation behaves identically to the old one on valid
UTF-16 strings; a fuzzer was used to help verify this.
2023-10-28 19:09:08 +02:00
Alex Dowad
00c567a436 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix infinite loop when mb_detect_encoding is used on UTF-8 BOM
2023-10-28 18:51:33 +02:00
Niels Dossche
d36f1bae86 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix FFI tests on 8.3+
2023-10-28 16:28:52 +02:00
Niels Dossche
3d658480a0 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix #47531: No way of removing redundant xmlns: declarations
2023-10-28 15:47:10 +02:00
Arnaud Le Blanc
d30c78d7f9 Merge branch 'PHP-8.3'
* PHP-8.3:
  [ci skip] NEWS
  [ci skip] NEWS
  [ci skip] NEWS
  Fix segfault caused by weak references to FFI objects (#12488)
2023-10-28 15:06:36 +02:00
Ayesh Karunaratne
3a04532a94
[skip ci] curl: sync-constants.php regex and URL improvements (#12544)
- Updates the URL of Curl constant page from `https://curl.haxx.se/libcurl/c/symbols-in-versions.html`
   to `https://curl.se/libcurl/c/symbols-in-versions.html`.

 - Fixes the regex used to filter constants to match `CURL_HTTP` constants.

Related: GH-12543
2023-10-28 13:38:39 +01:00
Máté Kocsis
f4a5db3e08
Parallelize pdo tests (dblib, firebird, oci, odbc, pgsql) (#12395)
Co-authored-by: George Peter Banyard <girgias@php.net>
Co-authored-by: Jorg Adam Sowa <jorg.sowa@gmail.com>
2023-10-28 12:35:57 +01:00
Jorg Adam Sowa
e8d8a5fe69
Typed constants in reflection extension (#12378) 2023-10-28 09:47:19 +02:00
Peter Kokot
b6bf7a0faf
Remove unused DBA_CDB_MAKE constant (#12535) 2023-10-27 17:37:24 +01:00
Ilija Tovilo
964e9d806b
Split complex regexes to multiple lines in zend_vm_gen.php
As requested by Dmitry in GH-12461 for easier reviewing.
2023-10-27 18:10:48 +02:00
Niels Dossche
d97ce2f086 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-11374: Different preg_match result with -d pcre.jit=0
2023-10-27 17:48:04 +02:00
Dmitry Stogov
c19347a0d3 Fixed incorrect trace type inference
Fixes oss-fuzz #63623
2023-10-27 16:12:18 +03:00
Marcos Marcolin
ad1fbde7c8
chore: removes redundant validation of $repeat, as it is the while condition. (#12521) 2023-10-27 10:15:16 +02:00
Dmitry Stogov
bd185c3dd5
Implement iterative Pearce's SCC finding algoritm (#12528)
* Switch to Pearce's SCC algorithm

* Implement iterative Pearce's SCC algorithm

* Wrap "goto" with "#ifdef SYM_RANGE"
2023-10-27 00:28:22 +03:00
Dmitry Stogov
7a594af365 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fixed GH-12509: JIT assertion when running php-parser tests
2023-10-26 23:59:20 +03:00
Dmitry Stogov
e95faaeebd Fixed codegeneration for IDENTICAL
Fixes oss-fuzz #63618
2023-10-26 23:14:30 +03:00
Dmitry Stogov
ce269178a9 Fixed code generation for DETCH_DIM_R
Fixes oss-fuzz #63613 and #63619
2023-10-26 22:50:25 +03:00
Niels Dossche
eed7474fc8 Merge branch 'PHP-8.3'
* PHP-8.3:
  Minor fix in `NEWS` alignment
  Fix bug #75306: Memleak in SoapClient
2023-10-26 19:59:46 +02:00
Niels Dossche
b7bf5e5706 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix incorrect dtor for persistent sdl->encoders
2023-10-25 17:56:53 +02:00
Dmitry Stogov
8eda3151eb Fixed regression introduced by 4ae483af36 2023-10-25 15:50:43 +03:00
Dmitry Stogov
71ed52137c Merge branch 'PHP-8.3'
* PHP-8.3:
  Fixed regression intoduced by 76c41d27f9
2023-10-25 15:16:30 +03:00
Dmitry Stogov
a96ea5d235 Fixed codegeneration for INC_OBJ 2023-10-25 14:57:58 +03:00
Dmitry Stogov
9f5a4c3799 Fixed code generation for MOD
Fixes oss-fuzz #63570
2023-10-25 13:14:34 +03:00
Dmitry Stogov
c2b704b63e Fixed code generation for CMP
Fixes oss-fuzz #63569
2023-10-25 12:38:46 +03:00
Dmitry Stogov
c163ff68da Fixed code generation for ASSIGN_DIM
Fixes oss-fuzz #63563
2023-10-25 12:01:28 +03:00
Dmitry Stogov
accc1e6c67 Invalidate "memory" type of zval if a register was stored in memory to call a helper function 2023-10-25 11:35:29 +03:00
Dmitry Stogov
8fc3615a7a Fixed compilation of "switch" with undefined input
Fixes oss-fuzz #63559
2023-10-25 10:34:54 +03:00
Dmitry Stogov
3a8767b0d1 Fixed compilation of dead code after assignment property to non object
Fixes oss-fuzz #63558
2023-10-25 09:42:07 +03:00
Dmitry Stogov
894a7594aa Update IR
IR commit: 091907f4a49648e8428f797442fb757d1cb737e9

Fixed oss-fuzz #63557
2023-10-25 08:44:01 +03:00
Dmitry Stogov
1068a5f758 Update IR
IR commit: dfd22749acb2a8cb7c728600e1d89f84cab4f99c

Fixes oss-fuzz #63548
2023-10-25 08:31:13 +03:00
Dmitry Stogov
4ae483af36 Fixed selection candidates for register allocation
Fixea oss-fuzz #63545
2023-10-25 00:26:37 +03:00
Niels Dossche
0493842635
Fix soap crash with ZEND_RC_DEBUG (#12514) 2023-10-24 22:05:41 +02:00
Dmitry Stogov
23e4e3b18b Fixed compilation of match with undefined input
Fixes oss-fuzz #63542
2023-10-24 22:12:53 +03:00
Niels Dossche
f9a9008fea Merge branch 'PHP-8.3'
* PHP-8.3:
  [ci skip] NEWS
  Fix null pointer dereferences in case of allocation failure
2023-10-24 19:42:59 +02:00
Dmitry Stogov
2fffb83c8f Merge branch 'PHP-8.3'
* PHP-8.3:
  Fixed incorrect type inference
2023-10-24 18:49:54 +03:00
Dmitry Stogov
3fb685bb48 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fixed GH-12482: Abortion with tracing JIT
2023-10-24 14:23:48 +03:00
Dmitry Stogov
be275433d9
Remove old JIT implementation (#12498)
* Remove old JIT implementation

* Remove ext/opcache/jit/zend_jit_vtune.c
2023-10-24 11:37:58 +03:00
Viktor Vassilyev
e58af7c160 ext/soap: Add support for clark notation for namespaces in class map
Closes GH-12411.
2023-10-23 23:39:28 +02:00
Jakub Zelenka
fa218eab4a
Merge branch 'PHP-8.3' 2023-10-23 14:06:30 +01:00
Saki Takamachi
cf701fb4fc
Optimized pdo_pgsql connection test (#12454) 2023-10-23 12:18:55 +01:00
Dmitry Stogov
3eba1a876a Merge branch 'PHP-8.3'
* PHP-8.3:
  memory_consumption must be page aligned
2023-10-23 12:11:09 +03:00
Dmitry Stogov
3d832fcc76 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fixed GH-12494: Zend/tests/arginfo_zpp_mismatch.phpt causes a segfault withJIT + --repeat 2
2023-10-23 10:52:09 +03:00
Dmitry Stogov
8f8b5ba082 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix possible NULL dereference (crash on Zend/tests/arginfo_zpp_mismatch.phpt)
2023-10-23 10:24:15 +03:00
Dmitry Stogov
caf102dfae
A new PHP JIT implementation based on IR JIT framework (#12079)
* IR update

* Use folding to allow constant folding and common subexpression elimination

* Implement IR JIT for INIT_FCALL, INIT_FCALL_BY_NAME and INIT_NS_FCALL_BY_NAME

* Implement IR JIT for SEND_VAL and SEND_VAL_EX

* Implement IR JIT for SEND_REF

* Implement IR JIT for SEND_VAR* instructions (incompltere - few tests failures)

* Implement IR JIT for CHECK_FUNC_ARG

* Implement IR JIT for CHECK_UNDEF_ARGS

* Implement IR JIT for ROPE_INIT, ROPE_ADD and ROPE_END

* Implement IR JIT for FREE, FE_FREE, ECHO, STRLEN and COUNT

* Implement IR JIT for IN_ARRAY

* Implement IR JIT support for separate VM stack overflow check

* Implement IR JIT for INIT_DYNAMIC_CALL

* Implemenr IR JIT for INIT_METHOD_CALL

* Fix IR JIT for IN_ARRAY and COUNT

* Implement IR JIT for VERIFY_RETURN_TYPE

* Force C compiler to store preserved registers to allow JIT using them

* Implement IR JIT for DO_FCALL, DO_UCALL, DO_ICALL and DO_FCALL_BY_NAME

* Implement IR JIT for FETCH_CONSTANT

* Fix (reverse) guard conditions

* Implement IR JIT for RECV and RECV_INIT

* Implement IR JIT for RETURN

* Implement IR JIT for BIND_GLOBAL

* Fix guard for: int++ => double

* Fix exception handling

* Allow deoptimization of zval type only (if some register is spilled by the IR engine)

* Fix overflow handling

* Implement IR JIT for FE_RESET_R and FE_FETCH_R

* Eliminate extra temporary register

* Better registers usage

* Implement IR JIT for FETCH_DIM_* and ISSET_DIM

* Implement IR JIT for ASSIGN_DIM and ASSIGN_DIM_OP

* cleanup

* Generae IR that produces a better x86[_64] code

* Allow trace register allocation for live ranges terminated before entering a called function

* Remove following END->BEGIN nodes during IR construction

* Remove useless (duplicate) guard

* Avoid useless exception check

* Prevent duplicate store

* Eliminate repatable re-assignment of stack zval types

* Enable combination of some instructions with the following SEND_VAL for IR JIT

* Avoid generation of useless RLOADs

* Eliminatare refcouting in a sequence of FETCH_DIM_R

* Fix assertion

* Remove ZREG_ZVAL_ADDREF flag from an element of abstract stack

* Implement IR JIT for FETCH_OBJ_*

* Implement IR JIT for ASSIGN_OBJ

* Implement IR JIT for ASSIGN_OBJ_OP

* cleanup

* Implement IR JIT for (PRE/POST)_(INC/DEC)_OBJ

* ws

* cleanup

* Fix IR JIT for constructor call

* Fix opcache.jit=1201 IR JIT.

With opcache.jit=1201  we still have to generate code for follow and target basic blocks with single exiting VM instruction. We mat just omit the entry point.

* Fix IR construction for the case when both IF targets are the same

* Avoid PHP LEAVE code duplication in function IR JIT.

* Reload operands from memeory when overflow (this improves hot code)

* Implement IR JIT for SWITCH_LONG, SWITCH_STRING and MATCH

* Initialize result to IS_UNDEF

* Fix JIT integraion with observer (Zend/tests/gh10346.phpt failure)

* Fix incorrect compilation of FE_FETCH with predicted empty array

* Fix register allocation

* Use sign extension inxted of zero

* Fix trace register allocator

* cleanp

* Fix address sanitizer warning

* Calculate JIT trace prologue sixe on startup (to avoid magic constants).

* Add cgecks for merge arrays overflow (this should be refactored using lists)

* Cache TLS access to perform corresponding read once per basic block

* cleanup unused variable

* Fix IR JIT support for CLANG build (CALL VM without global register variables)

* Fix IR JIT for CALL VM with global register variables

* Allow %rpb ysage in JIT for CALL VM (we save and restore it in prologue/epilogue anyway)

* cleanup

* Allocate enough fixed stack to keep preserved registers

* We don't have to care about x29 and x30

* cleanup (JMPZ/NZ_EX work fine)

* Revert "cleanup (JMPZ/NZ_EX work fine)"

This reverts commit cf8dd74a040e225d290d8ac4f5e33df638e6f8b8.

* Don't allocate register for PHP variables that are loaded from memory and used once

* Eliminate redundand deoptimization stores

* cleanup

* cleanup

* cleanup

* Optimization for constant comparison

* Cleanup and elimination of dead deoptimization stores

* Eliminate duplicate constant loading

* Set proper initial SP offset info for GDB backtraces

This doesn't take into account the following SP/FP modifications

* Add spill stores

* Remove low limit on number of deoptimization constants

* Emit dead code only when it's really necessary for IR graph

* cleanup

* cleanup

* Prefer loading long constants from memory (instead of loading immediate value)

* Regiter disasm labels using macros (add missing helpers)

* Make IR franework to care about GUARD JMP reordering

* Avoid reloading

* Improve register allocation for IR tracing JIT

* Add comment

* Fix deoptimization on result type guard of FETCH_DIM_R and FETCH_OBJ_R

* If HYBRID VM can't provide some stack space for JIT code in "red zone" then JIT has to reserve stack space itself

* Dump IR for stubs only if disassembling of stubs is requested

* Revert "Dump IR for stubs only if disassembling of stubs is requested"

This reverts commit d8b56bec129bc23c2b16f1f3c6367190181b6fdb.

* Dump IR for stubs only if disassembling of stubs is requested (another approach)

* Improve overflow deoptimization for ADD(_,1) and SUB(_,1)

Now we deoptimize to the next instruction, load constant result, and remove op1 from SNAPSHOT

* Switch to IR Builder API

* Switch to new IR builder macros

* Fix jit_set_Z_TYPE_INFO() call. op3 is a simple constant (not a ir_ref).

* Generate better code

* Enable empty ENTRY block merging

* Improve code generated for array separation/creation before an update

(ASSIGN_DIM, ASSING_DIM_OP, etc)

* Fix incorrect deleteion of PHI source (op1 is used for control link)

* Load constant once

* cleanup

* Improve control-flow to avoid two IS_ARRAY checks for REFERENCEs

* Update comments

* cleanup

* Clenup comments

* Fix AAarch 64 build (disable stack adjustment auto-detection)

* Add filename and line number to closure names

* Reserve stack for parameter passing

* Increase size of CPU stack reserved for JIT-ed code

* Fix addess sanitizer warnings

* Clenup: introduce OPTIMIZE_FOR_SIZE macro (disabled by default)

* Port 08e7591206 to IR JIT

Fix (at lease part of the) #GH-10635: ARM64 function JIT causes impossible assertion

* cleanup

* Preload constant and use tests that may be compiled into better code

* Convert helpers to stubs

* Introduce a helper data structure (ir_refs) to collect references for the following use in (MERGE/PHI)_N

* Use ir_refs

* Improve code generated by zend_jit_zval_copy_deref()

* Use "cold" attribute to influence IR block scheduler and achieve better code layout

* Keep info collected by recursion analyzer

* Use HTTPS URL to allow fetching without a SSH key

* Update IR

* Update IR

* Add IR JIT support for Wondows (Win64 support is incomplete)

* Update IR

* Update IR

* Fix support for Windows ZTS build

* Fix stack alignment

* Cleanup ir_ctx.control usage

* Fixed support for irreducable (incomplete) and merged loops

* Revert "Fixed support for irreducable (incomplete) and merged loops"

This reverts commit 672b5b89f47e8b81745fb73c86e0bcb0937daf16.

* Generate better code for RECV_ENTRies

* Use simpler and more efficient checks

* Switch to new ENTRY node concept

* Limit register usage across the OSR ENTRY point

* Upate MEM type only if we write to memory

* Use LOOP_END without a reference edge

* Use new ir_init() prototype

* Delay LOAD for better LOAD fusion

* Fix RECV/RECV_INIT compilation with opcache.jit=1235

* iPtoperly compile fake closures (they mau be called as regular functions)

* Fix reabase

* Fix rebase and add --with-capstone support for IR JIT

* Replace zend_uchar -> uint8_t

* IR JIT support for delayed destructor for zend_assign_to_typed_ref/prop

* Handle zend_execute_internal in IR JIT

* Fix readonly+clone IR JIT issues

* Switch to ir_ctx.mflags

* Ckeanup "inputs_count" access

* Disable CSE for nodes bound to PHP local varibles

The stack slots for temporaty variables may be reused and in case of
spilling this may cause clobbering of the value.

(ext/standard/tests/strings/htmlentities20.phpt on x86 with tracing JIT)

* Fix deoptimization code when link traces

See ext/zlib/tests/bug75273.phpt failure

* Fix missing type store

This fixes ext/openssl/tests/openssl_error_string_basic_openssl3.phpt

* Fix tracing JIT for overflowing INC/DEC

Fixes tests/lang/operators/preinc_basiclong_64bit.phpt

* Remove ir_remove_unreachable_blocks() call. Now it's called by ir_build_cfg(), when necessary.

* IR JIT: Fixed inaccurate range inference usage for UNDEF/NULL/FALSE

* IR JIT: Fixed GH-11127 (JIT fault)

* Avoid allocation of unused exit point

* Don't record already stored PHP variables in SNAPSHOTs

* Delay variable load

* Disable CSE across ENTRY

* Fixed disabling CSE

* Fix deoptimization

* Fixed deoptimization

* Disable incorrect register allocation

* Fix JIT for INDENTICAL+JMPZ_EX

* Add comments

* Fixed missed type stores

* IR JIT: added support for CLDEMOTE

* Fixed incorrect constant usage

* Disable compilation of PHP functions with irreducible CGF

* Fixed liveness check

* Fixed code for constant conditional jump

* Add type store to avoid use-after-free

* Fixed liveness analyses

* Gnerate SNAPSHOT for virtual method calls

* More accurate search for staticaly inferred info about a trace SSA vaiable

* Fix incorrect result use type_info

* Fix JMPZ/NZ_EX support and missing type store

* Fixed trace type inference and missing type store

* Store type of unused CV to prevent possible following use after free

* Fixed deoptimizaton info

* Fixed stack layout

* Implemented support for veneers on AArch64

* Dsable CSE to avoid over-optimization

* Don't bind nodes for TMP PHP variables

* Re-enable CSE for temporary variables as we don't bind them anymore

* Switch to CPU stack spill slots

* Add codegen info dump

* Initialize CV variables through FP (this enables some folding optimizatios)

* Use zero-extension that can be eliminated

* Avoid generation of dead PHIs

* Increase preallocated spill stack size

* Enable IR based JIT by default

* Fixed build with -disable-opcache-jit

* Use explicit type conversion & force load values to registerts

* Fix IR build

* Checkout submodules in github actions

* Fixed Windows build

* Fixed Windows build

* Fixed reattach to IR JIT SHM

* Update IR

* Checkout submodules in nightly CI

* Fix MACOS ZTS in IR JIT

* Update ir

* Fixed incorrect register allocation

* Fixed incorect code generation

* Fixed tracing jit for BIND_INIT_STATIC_OR_JMP

* Update README

* Typos

* Revert JIT disabling for run-tests.php workers

* Fixed code review issues

* Update IR

* Update IR

* Update IR

* Allow exit_point duplication, when the deoptimization info differs because of spilling

* Use bound spill slots for CV (once again)

* Improve error handling

* Removed IR submodule

* Remove IR submodule from workflows

* Embed IR

IR commit: 8977307f4e96ee03847d7f2eb809b3080f9ed662

* Add .gitignore

* Fixed according to feedback

* Force C saving preserved registers only for HYBRID VM

* Update IR

IR commit: a2f8452b3d35a756cba38924f5c51a48a7207494

* cleanup

* Replace ZEND_ASSERT(0) by ZEND_UNREACHABLE()

* Update IR and remove unused IR files

IR commit: 399a38771393c202a741336643118991290b4b1b

* Fixed inconsistency between IR code-generation and register-allocation

* Update IR

IR commit: 86685504274b0c71d9985b3c926dccaca2cacf9b

* Update ir_PHI*() according to IR construction API changes

* Fixed 32-bit build

* Update IR

IR commit: d0686408e20cd8c8640e37ed52ab81403a2383cb

* Support for ir_TAILCALL() prototype changes

* Update IR

IR commit: d72ae866e09d17e879378767aceb91d51894818c

* Fixed incorrect extension (ZEXT->SEXT)

* Fix SSA dominance

* Update IR

IR commit: d60d92516dc5f89b93cdf1df7a54141e83226b07

* Fixed support ir_ctx.ret_type
2023-10-23 10:15:52 +03:00
Julien Desrosiers
226b92b1dc
Nested match expression tests
Closes GH-12433
2023-10-23 08:18:17 +02:00
Niels Dossche
6b73fcc2b3
Convert ext/xml fields from int to bool (#12497) 2023-10-22 22:11:16 +02:00
Niels Dossche
046d7f95f1
Use Clang 16 to work around LSAN TLS crashes (#12496) 2023-10-22 22:01:40 +02:00
Niels Dossche
1b5e58f282 [ci skip] NEWS
NEWS for 98b08c52db that I forgot to add.
2023-10-22 20:56:29 +02:00
Niels Dossche
f093409052
[RFC] DOM HTML5 parsing and serialization support (Lexbor library part) (#12493)
* Update meta files

* Add (patched) Lexbor v2.4.0

* Add (already-applied) Lexbor patches

* Add linguist-vendored flag for Lexbor
2023-10-22 17:26:21 +02:00
Niels Dossche
98b08c52db
Implement request #68325: parse huge option for xml_parser_create (#12256) 2023-10-22 16:44:49 +02:00
Jakub Zelenka
06ee697cff
Merge branch 'PHP-8.3' 2023-10-22 15:31:46 +01:00
Jakub Zelenka
f4efb8815b
Merge branch 'PHP-8.3' 2023-10-22 13:28:32 +01:00
Jakub Zelenka
d105257108
Merge branch 'PHP-8.3' 2023-10-22 13:23:54 +01:00
Niels Dossche
7699534d51
Remove php_xsl_create_object() (#12492) 2023-10-21 23:48:27 +02:00
George Peter Banyard
0e5d654409
ext/xml: Refactor extension to use FCC instead of zvals for handlers (#12340)
To get proper errors and sensible behaviour, as the current behaviour is somewhat insane and part of it should be axed ASAP.

The behaviour is mostly intact with some minor BC breaks which are mentioned in UPGRADING.

Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
2023-10-20 13:14:55 +01:00
Yurun
6d10a69898 Fix the incorrect data type of float values in PDO query results
Close GH-12476
2023-10-20 12:49:25 +01:00
Ilija Tovilo
8372da71eb
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix pgsql and mysql tests on GitHub actions
2023-10-20 10:39:07 +02:00
Niels Dossche
48f0b10f32 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix segfault and assertion failure with refcounted props and arrays
  Fix incorrect uri check in SOAP caching
  Fix bug #66150: SOAP WSDL cache race condition causes Segmentation Fault
2023-10-19 18:33:08 +02:00
Ilija Tovilo
f39b0292bf
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix double-free of doc_comment when overriding static property via trait
2023-10-19 15:23:34 +02:00
Niels Dossche
cdfa016854
Avoid refcounted copy in _object_properties_init() for internal classes (#12474)
This currently uses ZVAL_COPY_OR_DUP, which copies the value and handles
refcounting. However, internal classes cannot have refcounted default
properties because of constraints imposed by
zend_declare_typed_property(). So copying the value is sufficient.

While this doesn't really improve the performance for our benchmarks, it
improves performance for cases where a lot of temporary internal objects
are instantiated. For example, when instantiating DOM classes: DOM
objects are transient, so lots of temporary objects are created.
2023-10-19 12:34:55 +02:00
Niels Dossche
7d551a89e5 [ci skip] Add test for GH-12455
This was already indirectly fixed via e127f87.

Co-authored-by: InvisibleSmiley
2023-10-18 19:21:43 +02:00
Ilija Tovilo
94c1e559f9
Merge branch 'PHP-8.3'
* PHP-8.3:
  Implement diagnostic ignore macro for Clang
2023-10-18 17:38:12 +02:00
Ilija Tovilo
f39b5c4c25
Close PHP tags in tests
Closes GH-12422
2023-10-18 17:34:10 +02:00
Niels Dossche
1c9c3af157 Add Laravel demo page to benchmark CI
The demo page doesn't do a lot, but might still be useful.
100 runs is enough to get rid of any prominent compilation overhead
in the profiles.

Closes GH-12466.
2023-10-18 17:31:47 +02:00
Ilija Tovilo
25f42bc9ce
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fixed a bug in zend_memnistr with single character needle
2023-10-18 16:02:27 +02:00
Ilija Tovilo
de369a1aa1
Merge branch 'PHP-8.3'
* PHP-8.3:
  [skip ci] Set travis_wait timeout to 60m
2023-10-18 15:39:52 +02:00
Ilija Tovilo
81bebef3ee
Merge branch 'PHP-8.3'
* PHP-8.3:
  Avoid JIT warning with opcache.jit_buffer_size=0
2023-10-18 10:49:19 +02:00
David CARLIER
95f829db13
ext/pdo_pgsql: cleanup the 3rd protocol is supported since circa 2010. (#12464) 2023-10-18 05:29:14 +01:00
David CARLIER
045dc10b1b
ext/pgsql: cleanup the 3rd protocol is supported since circa 2010. (#12465) 2023-10-18 05:28:47 +01:00
David CARLIER
6518feced0
CODEOWNERS: adding myself for the pdo_pgsql extension (#12456) 2023-10-18 00:58:36 +01:00
Niels Dossche
7f46c87fa1
Cleanup unused variable in php_dom.c (#12463) 2023-10-17 22:46:05 +02:00
Dmitry Stogov
221b4fe246 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fixed GH-11917: primitives seem to be passed via reference instead of by value under some conditions when JIT is enabled on windows (#12451)
2023-10-17 01:59:01 +03:00
Niels Dossche
1e2e2f391c
Refactor some ext/pcre code for performance (#12447)
* Always inline populate_match_value and fix argument type

The call overhead of this function is quite large.

* Use _new variant of zend_hash in some places to avoid additional check

* Move allocation of match_sets down to simplify and reduce code size

* Move pcre2_get_ovector_pointer out of the loop

This is allocated together with the match data and stays loop invariant:
the pointer is always the same (the values not however).

* Mark error condition as cold block

* Simplify condition: subpats is already checked

* Move array size preallocation to use allocate the up-to-date size

* Simplify condition

* Rework internal functions to avoid repeated unwrapping

* Remember Z_ARRVAL_P(return_value)

The lookup is loop invariant.

* Mark some pointers as const
2023-10-16 19:39:29 +02:00
Dmitry Stogov
191966be05 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fixed GH-12428: Assertion with function/tracing JIT
2023-10-16 15:12:45 +03:00
Saki Takamachi
47c6b3bd45
Fixed regular expression to get password from dsn (#12448) 2023-10-16 12:49:33 +01:00
David CARLIER
4bb75058a3
Fix 12424 PDO_PGSQL unit test unexistent variables (#12446)
* Fix 12424 PDO_PGSQL unit test unexistent variables
Co-authored-by: Saki Takamachi <34942839+SakiTakamachi@users.noreply.github.com>
2023-10-16 08:04:55 +01:00
Niels Dossche
5bfdedd15d Merge branch 'PHP-8.3'
* PHP-8.3:
  Add missing module dependency for xsl
2023-10-15 21:56:31 +02:00
SakiTakamachi
b5c287e4b4 Fix GH-12423: Changed to prioritize DSN authentication information over arguments.
Added connection test

Close GH-12424
2023-10-15 20:24:30 +01:00
Niels Dossche
5465cea8c8
Remove unused variable 'error' (#12438)
Will also get rid of the potential allocation happening in
zend_is_callable_ex().
2023-10-15 18:24:18 +02:00
Ilija Tovilo
5a0c0072dd
Revert "Test ASAN on Ubuntu 22.04 in nightly by increasing swap"
This reverts commit f7cef9a242.

This didn't work as intended, the builds are still failing for no obvious
reason.
2023-10-15 12:17:39 +02:00
Niels Dossche
7e0495481a Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix compile error when php_libxml.h is included in C++
2023-10-15 11:48:40 +02:00
Niels Dossche
d0b29d8286 Optimize strspn()
The current implementation uses a nested loop (for + goto), which has
complexity O(|s1| * |s2|). If we instead use a lookup table, the
complexity drops to O(|s1| + |s2|).
This is conceptually the same strategy that common C library
implementations such as glibc and musl use.
The variation with a bitvector instead of a table also gives a speed-up,
but the table variation was about 1.34x faster.

On microbenchmarks this easily gave a 5x speedup.

This can bring a 1.4-1.5% performance improvement in the Symfony
benchmark.

Closes GH-12431.
2023-10-14 21:24:55 +02:00
Jakub Zelenka
14404ac1fa
Merge branch 'PHP-8.3' 2023-10-14 18:45:31 +01:00
Tim Düsterhus
6b1d0606d0
Merge branch 'PHP-8.3'
* PHP-8.3:
  random: Add additional test for Randomizer::getFloat() (#12436)
2023-10-14 18:38:43 +02:00
Niels Dossche
3ff3199dc9 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix registerNodeClass with abstract class crashing
2023-10-13 19:11:10 +02:00
Tim Düsterhus
82c2143ddb
Merge branch 'PHP-8.3'
* PHP-8.3:
  random: Fix γ-section implementation for Randomizer::getFloat() (#12402)
2023-10-13 18:04:40 +02:00
Ilija Tovilo
b11af37a3f
[skip ci] Re-add JIT flags just for COMMUNTIY build
Deletion was a bit too eager.
2023-10-13 11:51:05 +02:00
Ilija Tovilo
29fed1cf47
Remove redundant CI JIT flags
These flags are already set from run-tests.php.
2023-10-13 11:49:42 +02:00
Ilija Tovilo
6d3d4dfb3a
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix JIT on nightly
2023-10-13 11:46:23 +02:00
Niels Dossche
49b8168ddb Cover more paths in dom_xpath_ext_function_php() with tests
Also removes an incorrect comment: we *do* need the special namespace
node handling code, otherwise we'd segfault.
2023-10-12 22:58:52 +02:00
Ilija Tovilo
3a41dc8b2e
Merge branch 'PHP-8.3'
* PHP-8.3:
  CircleCI: Increase no_output_timeout to 30m
2023-10-12 14:04:58 +02:00
Ilija Tovilo
384a4764b1
Remove invalid --with-zlib-dir=/usr configure flag 2023-10-12 13:22:30 +02:00
Ilija Tovilo
34e6e40447
Merge branch 'PHP-8.3'
* PHP-8.3:
  Move ARM build to CircleCI
2023-10-12 13:16:09 +02:00
Ilija Tovilo
2aa2d91a7b
Reduce jit_max_root_traces in tests
This value would be so high, occupying 88MB of shm on my machine and effectively
disabling the JIT in some cases.

Co-authored-by: Daniil Gentili <daniil@daniil.it>
2023-10-12 13:08:17 +02:00
Niels Dossche
345ac90eac
Introduce Z_PARAM_FUNC_EX2 to maintain compatibility (#12419)
Commit d86314939c added an additional parameter to Z_PARAM_FUNC_EX.
To maintain compatibility with third-party extensions, we keep
Z_PARAM_FUNC_EX as it used to be, and add Z_PARAM_FUNC_EX2 instead.
2023-10-11 19:55:00 +02:00
Niels Dossche
0ba24a5ed9 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-12392: Segmentation fault on SoapClient::__getTypes
  Fix GH-11121: ReflectionFiber segfault
  [ci skip] NEWS
2023-10-11 17:32:22 +02:00
Ilija Tovilo
f240f4fed2
Merge branch 'PHP-8.3'
* PHP-8.3:
  Report warning if JIT cannot be enabled
2023-10-11 12:12:37 +02:00
Ilija Tovilo
fc4f0ff377
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix use-after-free of constant name
2023-10-11 11:52:21 +02:00
Dmitry Stogov
7dc352e902 Merge branch 'PHP-8.3'
* PHP-8.3:
  Reset inheritance_cache pointer of zend_class_entry upon serialization (#12401)
2023-10-11 09:57:58 +03:00
Patrick Allaert
63c8ce84dd
Merge branch 'PHP-8.3' 2023-10-10 23:05:44 +02:00
Pierrick Charron
463a90ffc7
Merge branch 'PHP-8.3'
* PHP-8.3:
  PHP-8.2 is now for PHP 8.2.13-dev
  Prepare NEWS for PHP 8.3.0RC5
2023-10-10 11:49:33 -04:00
George Peter Banyard
e41598c7fc ext/spl: Use new F ZPP modifier 2023-10-10 13:44:21 +01:00
George Peter Banyard
52de0950f4 ext/libxml: Use new F ZPP modifier 2023-10-10 13:44:21 +01:00
George Peter Banyard
d86314939c Zend: Add ZPP F type check for callables that do not free trampolines
As refetching it with the new FCC API does get tedious
2023-10-10 13:44:21 +01:00
Ilija Tovilo
d24f07cbfe
Merge branch 'PHP-8.3'
* PHP-8.3:
  Move Cirrus to nightly only, trigger on-demand
2023-10-10 11:47:46 +02:00
Dmitry Stogov
3093f1768f Merge branch 'PHP-8.3'
* PHP-8.3:
  Fixed possible use-after-free
2023-10-10 00:02:05 +03:00
Niels Dossche
646bcfaf08 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-8996: DOMNode serialization on PHP ^8.1
  Fix GH-12380: JIT+private array property access inside closure accesses private property in child class
2023-10-09 22:12:44 +02:00
Dmitry Stogov
986e08ed33 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-12364: JIT leak in Symfony TranslationDebugCommandTest (#12394)
2023-10-09 23:07:52 +03:00
Dmitry Stogov
94d8ba77a9
Fix GH-12364: JIT leak in Symfony TranslationDebugCommandTest (#12394) 2023-10-09 23:06:13 +03:00
Dmitry Stogov
435530f035 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix incorrect trace type inference
2023-10-09 22:58:42 +03:00
David CARLIER
2e0ca4718b opcache posix creating special shared segments for FreeBSD 13 and above.
From this release, it is permitted to create shared memory blocks tagged
 as large for faster accesses for a size compatible with otherwise
we fallback to a classic creation.

Close GH-8037
2023-10-09 19:10:26 +01:00
George Peter Banyard
76a773b8dd
Add some const qualifiers in HashTable foreach macros (#8671) 2023-10-09 17:20:09 +01:00
Peter Kokot
f119b61d03
Remove redundant code in ext/mysqlnd build (#12384)
This was once used by the ext/mysqli when building without ext/mysqlnd
and the ext/mysqlnd/php_mysqlnd_config.h file was created in the build
directory.
2023-10-09 15:23:52 +01:00
Cristian Rodríguez
9ff6220e06
opcache: Use O_TMPFILE file lock if available (#8634)
Use O_TMPFILE if the kernel supports it to create the lock fd, this
has multiple advantages including not having to worry about naming,
permissions and the assurance that it will always go away cleanly
even on abnormal termination.

Co-authored-by: Dmitry Stogov <dmitry@zend.com>
2023-10-09 16:08:55 +03:00
Julien Francoz
36b194ba29
add file path in opcache lock file error (#10331)
Co-authored-by: Julien Francoz <julien@francoz.net>
2023-10-09 14:12:40 +03:00
Dmitry Stogov
d17c672833 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fixed GH-12382: JIT Index invalid or out of range error
2023-10-09 11:21:01 +03:00
David Carlier
57a8f63f7f [ci skip] UPGRADING pgsql update 2023-10-08 18:26:02 +01:00
Omar Emara
75da0d7c45 PGSQL: Allow unconditional selection in pg_select
Previously, pg_select did not allow unconditional selection, where an
empty ids array would result in a function failure.

This patch implements two changes:
- Make the ids array an optional parameter.
- Allow the ids array to be empty.

In both cases, unconditional selection happen, which is equivalent to
pg_query('SELECT * FROM <table>;').

Two test cases were added to test the aforementioned changes.

Close GH-5332
2023-10-08 18:22:50 +01:00
Niels Dossche
009d48da1c
Convert bounds exception in SplFixedArray to OutOfBoundsException instead of RuntimeException (#12383) 2023-10-08 18:57:57 +02:00
Niels Dossche
07003137dc Merge branch 'PHP-8.3'
* PHP-8.3:
  [ci skip] Add xml and simplexml dependency to EXTENSIONS section in test
2023-10-07 21:14:32 +02:00
Niels Dossche
02865b1f56 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix Windows CI
2023-10-07 15:50:58 +02:00
Tim Düsterhus
3bc63a37a3
random: Remove RAND_RANGE_BADSCALING (#12374)
This macro is no longer used within php-src since
60ace13f9c, it invokes undefined behavior
depending on the input and the corresponding MT_RAND_PHP mode was deprecated in
PHP 8.3.

Thus remove this macro. Any remaining non-php-src user should just inline it
into their code, but should ideally migrate to a non-biased scaler. In any case
the undefined behavior of the original implementation should be accounted for.
2023-10-07 13:19:54 +01:00
Jorg Adam Sowa
f0757100a4
Typed constants in SPL extension (#12358) 2023-10-07 13:14:57 +01:00
Tim Düsterhus
72cac39698
pcre: Stop special-casing /e (#12355)
Support for /e was removed in PHP 7.0, remove the custom error message and stop
special casing it to simplify the logic.
2023-10-06 19:45:14 +02:00
Niels Dossche
5cc6979210 Merge branch 'PHP-8.3'
* PHP-8.3:
  php_cli_server: ensure single date header is present
2023-10-06 17:54:03 +02:00
Niels Dossche
3bb56ae418
Add missing properties to xsl stub (#12334)
* Define doXInclude for XSLTProcessor, and test the property

This was added in 8d1427dd98, but never defined on the stub.
It was more or less fine when dynamic properties were not deprecated,
but now they throw a deprecation warning. To fix it, define on the stub.
This should also help discoverability of the functionality.

* Define cloneDocument for XSLTProcessor, and test the property

This was introduced in 5c039bbad9, but never defined on the stub.
It was more or less fine when dynamic properties were not deprecated,
but now they throw a deprecation warning. To fix it, define on the stub.
This should also help discoverability of the functionality.
2023-10-06 17:42:47 +02:00
Tim Düsterhus
42a85fc5d9
password_hash: Increase PHP_PASSWORD_BCRYPT_COST to 12 (#12367)
RFC: https://wiki.php.net/rfc/bcrypt_cost_2023
2023-10-06 14:27:01 +02:00
Oleksii Bulba
4c22060f1d
[skip ci] Removed misleading comments in tests on expected output; (#12370) 2023-10-06 13:02:09 +01:00
Ben Ramsey
65a8c70f93
Add instructions for updating security.txt in web-php (#12316)
[ci skip]
2023-10-05 13:39:45 -05:00
Ilija Tovilo
3a4091c388
Merge branch 'PHP-8.3'
* PHP-8.3:
  Minimal backport of 098d9ca
2023-10-04 15:37:14 +02:00
Ilija Tovilo
8e047d98e9
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix SKIPIF jit test
2023-10-04 15:06:48 +02:00
Alex Dowad
1f0cf133db Add fast mb_strcut implementation for UTF-8
The old implementation runs through the entire string to pick out the
part which should be returned by mb_strcut. This creates significant
performance overhead. The new specialized implementation of mb_strcut
for UTF-8 usually only examines a few bytes around the starting and
ending cut points, meaning it generally runs in constant time.

For UTF-8 strings just a few bytes long, the new implementation is
around 10% faster (according to microbenchmarks which I ran locally).
For strings around 10,000 bytes in length, it is 50-300x faster.
(Yes, that is 300x and not 300%.)

The new implementation behaves identically to the old one on VALID
UTF-8 strings; a fuzzer was used to help ensure this is the case.
On invalid UTF-8 strings, there is a difference: in some cases, the
old implementation will pass invalid byte sequences through unchanged,
while in others it will remove them. The new implementation has
behavior which is perhaps slightly more predictable: it simply backs
up the starting and ending cut points to the preceding "starter
byte" (one which is not a UTF-8 continuation byte).
2023-10-04 09:10:38 +02:00
Alex Dowad
3fa836f711 Add test cases for mb_strcut 2023-10-04 09:10:25 +02:00
Ilija Tovilo
c8e1fc0973
Merge branch 'PHP-8.3'
* PHP-8.3:
  [skip ci] Test opcache_invalidate() return value for deleted files
2023-10-03 15:56:26 +02:00
Ilija Tovilo
e044442272
Merge branch 'PHP-8.3'
* PHP-8.3:
  Invalidate path even if the file was deleted
2023-10-03 15:33:02 +02:00
Ilija Tovilo
234648e40c
Add missing jitType input for test-macos action 2023-10-03 14:38:20 +02:00
Ilija Tovilo
24d6dce668
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix invalid returned opcode for memoized expressions
2023-10-03 14:02:28 +02:00
Ilija Tovilo
08fea2a10b
Merge branch 'PHP-8.3'
* PHP-8.3:
  Test ASAN on Ubuntu 22.04 in nightly by increasing swap
2023-10-03 13:53:26 +02:00
Dmitry Stogov
a01e0aa590 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fixed GH-12262: Tracing JIT assertion crash when using phpstan
2023-10-03 13:25:46 +03:00
Daniil Gentili
098d9ca720
Trigger JIT tracing&compilation more often
Closes GH-12250
2023-10-03 11:02:23 +02:00
Levi Morrison
24915924bf
Merge branch 'PHP-8.3' 2023-10-02 22:08:03 -06:00
Niels Dossche
cb0d04e9f4 Merge branch 'PHP-8.3'
* PHP-8.3:
  Ignore optional warning output in test
2023-10-02 22:55:54 +02:00
Niels Dossche
c24478fb12 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix test under older CI configurations
2023-10-02 21:53:09 +02:00
Niels Dossche
e2c50f6bcb Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix #80092: ZTS + preload = segfault on shutdown
2023-10-02 19:42:45 +02:00
Niels Dossche
f88368cfc8
Improve error messages for XSLTProcessor::transformToDoc() (#12332)
* Improve error messages for XSLTProcessor::transformToDoc()

Also adds a relevant test file, as these branches were untested before.
2023-10-02 19:21:54 +02:00
Ilija Tovilo
41ea14b154
Merge branch 'PHP-8.3'
* PHP-8.3:
  [skip ci] Avoid running asan tests that timeout
2023-10-02 16:58:05 +02:00
Levi Morrison
032b98fb34
Merge branch 'PHP-8.3' 2023-10-02 08:55:49 -06:00
Ilija Tovilo
1df82938b2
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix str_decrement() on "1"
2023-10-02 16:42:16 +02:00
Ilija Tovilo
dab5aba45a
Merge branch 'PHP-8.3'
* PHP-8.3:
  Use separate sqlsrv dbs for different exts
2023-10-02 12:56:11 +02:00
Ilija Tovilo
fcae58809f
Fix GCC warning in math.c 2023-10-02 10:55:57 +02:00
Niels Dossche
b56141c5dd Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix broken cache invalidation with deallocated and reallocated document node
2023-10-01 17:07:11 +02:00
Alex Dowad
9aa4b2bbad Add tests to document behavior of UTF7-IMAP conversion in obscure corner case
These unit tests cover situations which were not previously tested by the
mbstring test suite. Adding them will make the test suite more complete.

To be specific, the 'obscure' case which we are now testing is: what happens
when the first half of a surrogate pair appears at end of an improperly
terminated Base64 section in UTF7-IMAP text?
2023-10-01 14:44:05 +02:00
Alex Dowad
a57fdea149 Add assertion to mb_utf7imap_to_wchar to catch buffer overrun
I don't believe such a buffer overrun will ever occur, but just in
case the code is changed in the future, it will be good to have an
assertion here to help catch bugs. (A similar assertion is already
used in the UTF-7 version of this function.)
2023-10-01 14:43:35 +02:00
David CARLIER
3944bb01eb
zend call stack for DragonFlyBSD. (#12325)
Shares the same codepaths as FreeBSD for the most part.
2023-10-01 13:12:14 +01:00
Niels Dossche
f10e1b8f59 Use RETURN_STR_COPY() in xsl
Everything in intern->parameter is already a string.
2023-09-30 21:41:11 +02:00
Niels Dossche
5c749ad4cf Implement request #64137 (XSLTProcessor::setParameter() should allow both quotes to be used)
This reimplements the parameter handling. Instead of quoting the strings
manually, adding them to an array, and passing that as input; use the
libxslt API to pass data verbatim to the processor.
This also simplifies the code a lot.

Closes GH-12331.
2023-09-30 21:41:06 +02:00
Anatol Belski
f550c082dd Merge branch 'PHP-8.3'
* PHP-8.3:
  NEWS: Add note about #11891
  NEWS: Added note about #11891
  NEWS: Added note about #11891
2023-09-30 19:20:08 +02:00
Anatol Belski
022057b907 Merge branch 'PHP-8.3'
* PHP-8.3:
  fileinfo: Backport svg detection patch
2023-09-30 18:26:23 +02:00
Niels Dossche
3e29332a5c Merge branch 'PHP-8.3'
* PHP-8.3:
  Apply SimpleXML iterator fixes only on master
2023-09-30 18:02:59 +02:00
Anatol Belski
2546bbd3bc Merge branch 'PHP-8.3'
* PHP-8.3:
2023-09-30 16:52:53 +02:00
Anatol Belski
b79a2403b5 Merge branch 'PHP-8.2'
* PHP-8.2:
  fileinfo: Backport svg detection patch
2023-09-30 16:33:39 +02:00
Niels Dossche
b67530a6c0 Add test for XSLTProcessor::getParameter() 2023-09-30 16:25:07 +02:00
Niels Dossche
2fb9ef069f Merge branch 'PHP-8.3'
* PHP-8.3:
  Revert "Fix GH-10008: Narrowing occurred during type inference of ZEND_ADD_ARRAY_ELEMENT"
2023-09-30 01:27:43 +02:00
Niels Dossche
5fd89652e5 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix compile error with -Werror=incompatible-function-pointer-types and old libxml2
  Fix GH-10008: Narrowing occurred during type inference of ZEND_ADD_ARRAY_ELEMENT
  Fix type error on XSLTProcessor::transformToDoc return value with SimpleXML
2023-09-30 00:12:42 +02:00
George Peter Banyard
6a4031b8c4
ext/mysqli: Work on making tests parallizable (#11814)
Batch 1 of amending tests, so they can run in parallel.

Co-authored-by: Kamil Tekiela <tekiela246@gmail.com>
2023-09-29 18:57:30 +01:00
Remi Collet
7200bc23a0
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix port conflict 64324 used in bug51056.phpt
2023-09-29 14:02:57 +02:00
twosee
dcee59eb33
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix socket_export_stream() with wrong protocol
2023-09-29 18:59:17 +08:00
David CARLIER
14b827049a
zend call stack support for haiku w/o using posix pthread api but the (#12103)
underlying native BeOs one.
2023-09-29 11:47:23 +01:00
Jakub Zelenka
569b95d2c3
Merge branch 'PHP-8.3' 2023-09-29 11:39:41 +01:00
Niels Dossche
0b7a0e9f41 Merge branch 'PHP-8.3'
* PHP-8.3:
  Restore old namespace reconciliation behaviour
2023-09-27 22:41:09 +02:00
Niels Dossche
21d9fd3bc1 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-11997: ctype_alnum 5 times slower in PHP 8.1 or greater
  Fix GH-12297: PHP Startup: Invalid library (maybe not a PHP library) 'mysqlnd.so' in Unknown on line
2023-09-26 21:45:19 +02:00
Niels Dossche
2e8cdd8eec Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-12167 and GH-12169: Unable to get comment or processing instruction contents in SimpleXML
2023-09-25 19:50:58 +02:00
Niels Dossche
9b6afd88fb
Make sure core module has number 0 (#12272)
* Make sure core module has number 0

Some places, possibly also outside PHP, assume the core extension has
module number 0. After 8a812c3fda this wasn't the case anymore as
reported in [1]. Fix it by changing how the next module ID is computed.

[1] https://github.com/php/php-src/pull/12246#issuecomment-1731432377

* Add assertion

* Add test
2023-09-25 17:36:13 +02:00
Levi Morrison
f1f04cf0c9
Merge branch 'PHP-8.3' 2023-09-25 08:27:46 -06:00
Niels Dossche
12790b2b35
Extend C14N fast path to HTML documents too (#12293) 2023-09-24 22:18:32 +02:00
Jakub Zelenka
96a30882ca
Merge branch 'PHP-8.3' 2023-09-24 16:51:35 +01:00
Tim Düsterhus
9e66bc9b97
abs: Make value == ZEND_LONG_MIN an unexpected branch
As suggested in GH-12286. This results in slightly better assembly in clang,
because the expected case will be handled by a forward jump that is not taken.
2023-09-24 17:37:09 +02:00
Tim Düsterhus
865535267b
round: Make fractional == 0.5 an unexpected branch
This does indeed result in slightly better assembly for clang.
2023-09-24 17:15:09 +02:00
David Carlier
4834e7ede5 Merge branch 'PHP-8.3' 2023-09-24 15:21:10 +01:00
Tim Düsterhus
82aad0b483
Unify type juggling in math.c (#12286)
- Consistently use a `switch()` with `EMPTY_SWITCH_DEFAULT_CASE();`
- Consistently use `zval_get_double()` for multi-type / non-double zvals
  instead of casting manually.
2023-09-24 14:55:26 +02:00
David Carlier
0a8ff0bb3e Merge branch 'PHP-8.3' 2023-09-24 08:10:01 +01:00
David Carlier
a209ac61cd Merge branch 'PHP-8.3' 2023-09-24 08:05:16 +01:00
David Carlier
0c022ec163 Merge branch 'PHP-8.2' into PHP-8.3 2023-09-24 08:05:05 +01:00
Niels Dossche
6a7b96529b Remove unnecessary libxml2 version checks
The minimum required version is 2.9.0. So these checks are useless.
2023-09-24 00:17:52 +02:00
David Carlier
ab22571981 Merge branch 'PHP-8.3' 2023-09-23 20:13:45 +01:00
Niels Dossche
916dedf7d7 Add additional test for special cases for C14N 2023-09-23 20:56:18 +02:00
Niels Dossche
554f659602 Remove unnecessary invalidation 2023-09-23 20:56:18 +02:00
Niels Dossche
5d68d61943 Implement #53655: Improve speed of DOMNode::C14N() on large XML documents
The XPath query is in accordance to spec [1]. However, we can do it in a
simpler way. We can use a custom callback function instead of a linear
search in XPath to check if a node is visible. Note that comment nodes
are handled internally by libxml2 already, so we do not need to
differentiate between node types. The callback will do an upwards
traversal of the tree until the root of the canonicalization is reached.
In practice this will speed up the application a lot.

[1] https://www.w3.org/TR/2001/REC-xml-c14n-20010315 section 2.1

Closes GH-12278.
2023-09-23 20:56:16 +02:00
divinity76
ab30f27ce3
random: Perform fewer iterations if SKIP_SLOW_TESTS is set (#12279)
Co-authored-by: Tim Düsterhus <tim@bastelstu.be>
2023-09-23 14:48:33 +02:00
Lewis Cowles
b94ef611e3
ci: more verbose output (#12264) 2023-09-23 01:34:48 +02:00
Niels Dossche
1df8fd4f12 Merge branch 'PHP-8.3'
* PHP-8.3:
  [ci skip] Move things to the right section in UPGRADING
2023-09-22 23:55:36 +02:00
Peter Kokot
abed8b8e41 Remove _IO_cookie_io_functions_t in favor of cookie_io_functions_t
As noted in glibc, the cookie_io_functions_t should be used instead of
internal _IO_cookie_io_functions_t.

The _IO_cookie_io_functions_t was once used as a convenience for not
having the cookie_io_functions_t available (glibc <=2.1.1) as noted in
67bb9d1ae2.

Check in the build system was also always setting the
COOKIE_IO_FUNCTIONS_T to cookie_io_functions_t due to a typo. There is
unused variable have_IO_cookie_io_functions_t vs.
have_cookie_io_functions_t.

- COOKIE_IO_FUNCTIONS_T removed

Closes GH-12236
2023-09-22 22:31:19 +02:00
Tim Düsterhus
659c06d4c9
UPGRADING: Move the validation of the rounding mode to Backward Incompatible Changes 2023-09-22 17:35:03 +02:00
Tim Düsterhus
3d857d5b81
round(): Validate the rounding mode (#12252) 2023-09-22 17:32:09 +02:00
David Carlier
f6fae19a10 ext/intl: expose dateformat UDAT_PATTERN constant.
Close GH-12258
2023-09-22 12:32:22 +01:00
Ilija Tovilo
62e2402534
Use autoconf for recognizing __builtin_unreachable() (#12266)
Older versions of GCC don't support __has_builtin(), but do support
__builtin_unreachable().
2023-09-22 11:53:09 +02:00
Ilija Tovilo
77bc5aafe1
Merge branch 'PHP-8.3'
* PHP-8.3:
  support running testsuite with negative niceness (#11481)
2023-09-22 11:33:45 +02:00
Ilija Tovilo
60722b9773
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix getpriority test with negative return value
2023-09-22 10:26:17 +02:00
Niels Dossche
edd72da03a Merge branch 'PHP-8.3'
* PHP-8.3:
  [ci skip] NEWS
2023-09-21 20:05:05 +02:00
Niels Dossche
1b199d3b77 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix memory leak when calling xml_parse_into_struct() twice
  Fix return type of stub of xml_parse_into_struct()
2023-09-21 19:52:37 +02:00
David Carlier
ff095cca27 Merge branch 'PHP-8.3' 2023-09-21 05:36:51 +01:00
Niels Dossche
8a812c3fda Fix GH-12215: Module entry being overwritten causes type errors in ext/dom (PHP 8.4)
When we try to load an extension multiple times, we still overwrite the
type, module number, and handle. If the module number is used to
indicate module boundaries (e.g. in reflection and in dom, see e.g.
dom_objects_set_class_ex), then all sorts of errors can happen.

In the case of ext/dom, OP's error happens because the following
happens:
- The property handler is set up incorrectly in
  dom_objects_set_class_ex() because the wrong module number is
  specified. The class highest in the hierarchy is DOMNode, so the
  property handler is incorrectly set to that of DOMNode instead of
  DOMDocument.
- The documentElement property doesn't exist on DOMNode, it only exists
  on DOMDocument, so it tries to read using zend_std_read_property().
  As there is no user property called documentElement, that read
  operation returns an undef value.
  However, the type is still checked, resulting in the strange exception.

Solve this by changing the API such that the data is only overwritten if
it's owned data.

Closes GH-12246.
2023-09-20 21:02:51 +02:00
Niels Dossche
aab6bbc6f5 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-12215: Module entry being overwritten causes type errors in ext/dom (<= PHP 8.3)
  Fix bug #55098: SimpleXML iteration produces infinite loop
2023-09-20 21:02:36 +02:00
Ilija Tovilo
37ce7199f2
Use __builtin_unreachable() directly in ZEND_UNREACHABLE
ZEND_UNREACHABLE() currently expands to the following in GCC:

    if (__builtin_expect(!(0), 0)) __builtin_unreachable();

Even though the branch is always executed, GCC does not recognize the outer
branch as unreachable. Removing the if fixes some unexpected warnings.

Closes GH-12248
2023-09-20 15:44:02 +02:00
Peter Kokot
186a07f044
Fix too many arguments in FPM ACL compile check (#12242)
The AC_COMPILE_IFELSE takes 3 arguments unlike AC_RUN_IFELSE which needs
the 4th argument for cross-compilation.
2023-09-19 18:52:34 +01:00
Tim Düsterhus
9652889b43
Reimplement php_round_helper() using modf() (#12220)
This change makes the implementation much easier to understand, by explicitly
handling the various cases.

It fixes rounding for `0.49999999999999994`, because no loss of precision
happens by adding / subtracing `0.5` before turning the result into an integral
float. Instead the fractional parts are explicitly compared.

see GH-12143 (this fixes one of the reported cases)
Closes GH-12159 which was an alternative attempt to fix the rounding issue for
`0.49999999999999994`
2023-09-19 18:05:05 +02:00
Kamil Tekiela
83738fc9a4
Remove MySQL 4.1 checks 2023-09-19 15:40:59 +01:00
Kamil Tekiela
5f6bf3edd6
Improve mysqli_character_set_name tests 2023-09-19 13:48:11 +01:00
Ilija Tovilo
f957335c66
Move static property check to assert (#12239)
Staticness incompatiblity must error before attempting to declare the property.
2023-09-19 10:35:25 +02:00
Niels Dossche
55432bfa16 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-11956: PCRE regular expressions with JIT enabled gives different result
2023-09-18 20:15:24 +02:00
David Carlier
f78c8b91eb Merge branch 'PHP-8.3' 2023-09-18 17:47:44 +01:00
George Peter Banyard
bc4807c506
ext/pcntl: Remove useless call to zend_get_callable_name() (#12241)
Result of it is unused
2023-09-18 17:35:36 +01:00
Christian Clauss
886bf820c9
[skip ci] Fix typos discovered by codespell (#12228) 2023-09-18 11:07:17 +01:00
George Peter Banyard
42010d42f1
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fixed oss-fuzz #62294: Unsetting variable after ++/-- on string variable warning
2023-09-17 15:50:54 +01:00
Niels Dossche
7f0705b1fa Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-12208: SimpleXML infinite loop when a cast is used inside a foreach
2023-09-17 16:35:39 +02:00
Niels Dossche
8f9626c0f7 Simplify php_sxe_count_elements_helper() by using non-destructive iterator reset 2023-09-17 16:21:54 +02:00
Niels Dossche
fe98a16af7 Add a test case for iterator and empty & var_dump interactions 2023-09-17 16:21:54 +02:00
Niels Dossche
550ec29821 Use php_sxe_reset_iterator_no_clear_iter_data() to avoid having to store and restore iterator data
This makes the code less error-prone, and also makes it simpler.
2023-09-17 16:21:54 +02:00
Niels Dossche
695ec3c97e
Remove unnecessary _IS_BOOL case (#12230)
This can never be executed because booleans are handled in a special
case at the top of sxe_object_cast_ex().
2023-09-17 16:19:22 +02:00
Christian Clauss
bae30682b8 [ci skip] Update run-tests.php: Fix typo
Closes GH-12225.
2023-09-16 21:32:24 +02:00
Niels Dossche
fad0e4f4e7 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-12223: Entity reference produces infinite loop in var_dump/print_r
  Fix GH-12192: SimpleXML infinite loop when getName() is called within foreach
  Fix GH-12186: segfault copying/cloning a finalized HashContext
2023-09-16 21:28:59 +02:00
Niels Dossche
0fee720173 Simplify node check in simplexml 2023-09-16 14:02:48 +02:00
Tim Düsterhus
7c4db150cb
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix #[Override] on traits overriding a parent method without a matching interface (#12205)
2023-09-15 14:57:42 +02:00
Ilija Tovilo
7aea6ddec3
Merge branch 'PHP-8.3'
* PHP-8.3:
  Upgrade to macOS 12 in CI
2023-09-15 12:06:03 +02:00
Peter Kokot
a8e1b1018d Remove unused --with-zlib-dir configure option
Commits that removed this option:
- 34dd032e4e
- a2c21e10b2
- e595f5cd8a

Closes GH-12209
2023-09-14 22:21:54 +02:00
Ilija Tovilo
6349b293e7
Upload callgrind profile to GA (#12212) 2023-09-14 19:52:31 +02:00
Niels Dossche
e5252a3f4d Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-12170: Can't use xpath with comments in SimpleXML
2023-09-14 18:45:01 +02:00
Tim Düsterhus
b2d244a444
Show the integer size in phpinfo() (#12201)
Resolves GH-12188
2023-09-14 14:42:10 +02:00
Ilija Tovilo
9f6cb6baa2
Merge branch 'PHP-8.3'
* PHP-8.3:
  [skip ci] Fix NEWS entry
2023-09-14 13:17:54 +02:00
Tim Düsterhus
ede180672b
Merge branch 'PHP-8.3'
* PHP-8.3:
  Add abstract __construct() test for #[\Override] (024.phpt)
2023-09-14 12:58:31 +02:00
Ilija Tovilo
ddd2bd42ea
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix filter_var with callback and explicit REQUIRE_SCALAR
2023-09-14 11:49:57 +02:00
Ilija Tovilo
692cea5cbc
Use zend_error_noreturn for E_ERROR consistently
To be clear, these already don't return. zend_error_noreturn just hints at this
fact through the ZEND_NORETURN attribute.

Closes GH-12204
2023-09-14 11:44:55 +02:00
Ilija Tovilo
2227fefa17
Fix noreturn with warning that should be an error
E_WARNING does not actually abort.
2023-09-14 11:29:53 +02:00
Peter Kokot
8df8550321
Remove unneeded zend_language_parser.h patch (#12178)
This was cleaned in 4cbffd89d9 and
patching the Zend/zend_language_parser.h file to include zend.h is not
needed anymore.

Autotools build system part has been similarly cleaned via
32cdd330f3
2023-09-14 08:04:21 +02:00
Niels Dossche
05c46b71d4
Small optimization in php_sxe_get_first_node() by avoiding unwrapping iterator data (#12194) 2023-09-13 22:47:09 +02:00
Tim Düsterhus
df0aca320c
Merge branch 'PHP-8.3'
* PHP-8.3:
  Update GitHub Action workflows to `actions/checkout@v4` (8.3+)
  Update GitHub Action workflows to `actions/checkout@v4`
2023-09-13 22:18:16 +02:00
Ben Ramsey
789867e844
Merge branch 'PHP-8.3' 2023-09-12 16:25:56 -05:00
Máté Kocsis
cc2a68e588
Fix predefined constant page synchonization 2023-09-12 18:52:38 +02:00
Sergey Panteleev
ca3f3e71ca
Merge branch 'PHP-8.3'
* PHP-8.3:
  PHP-8.2 is now for PHP 8.2.12-dev
  Update NEWS for start of RC3
2023-09-12 14:58:06 +03:00
Remi Collet
cc36d8dc6f
Merge branch 'PHP-8.3'
* PHP-8.3:
  zip: add new test for dynamic files
2023-09-12 11:18:50 +02:00
Ilija Tovilo
02d3eecf8d
Merge branch 'PHP-8.3'
* PHP-8.3:
  Improve invalid cpp modifier message
2023-09-11 16:24:16 +02:00
George Peter Banyard
5c3a6eaec9
Zend: Remove dependency on zend.h for certain headers (#12166) 2023-09-11 12:27:21 +01:00
Graham Campbell
58b8393cce
Removed incorrect news items for things already in 8.3.x or earlier
Closes GH-12160
2023-09-11 11:53:01 +02:00
Ilija Tovilo
4217d55022
Merge branch 'PHP-8.3'
* PHP-8.3:
  [skip ci] Skip arginfo_zpp_mismatch on asan
2023-09-11 11:36:30 +02:00
Niels Dossche
6b54811547 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix #52751: XPath processing-instruction() function is not supported.
2023-09-11 00:15:32 +02:00
Máté Kocsis
038e9b7e4b
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix #12123 Make _ZEND_TYPE_PREFIX apply only for MSVC
2023-09-10 22:43:00 +02:00
Niels Dossche
f2fede56c8 Deduplicate ParentNode and ChildNode interface implementations using @implementation-alias
The entry points are duplicated: they add bloat and make it easier to forget
to change something. Make maintenance easier by using @implementation-alias.
Also, this has the nice side-effect of slightly reducing the amount of
code and binary size.

Closes GH-12158.
2023-09-10 22:35:58 +02:00
Máté Kocsis
69937491bc
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix type of the PHP_FLOAT_DIG constant
2023-09-10 22:33:05 +02:00
Niels Dossche
bec1552a06
Remove useless SKIP_TEXT() invokes (#12164)
In the places I removed them, they were useless because there is already
a type check for a single node type, so I found it confusing having them
there.
2023-09-10 00:02:17 +02:00
Niels Dossche
d18bab5562 Preallocate result array size in simplexml xpath
This is the simplexml version of 4dea42a.
2023-09-09 22:59:24 +02:00
Niels Dossche
0ea268b51a Remove obsolete libxml2 code
LIBXML2_NEW_BUFFER is always defined since libxml2 2.9.0.
That's the minimum version PHP requires, so it will always be defined.
2023-09-09 21:58:13 +02:00
Niels Dossche
518233c39d Merge branch 'PHP-8.3'
* PHP-8.3:
  Use zend_get_gc_buffer_add_fcc()
2023-09-09 20:00:18 +02:00
Niels Dossche
c7777e354d Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix build with sqlite3 gc and fci/fcc api
2023-09-09 16:07:17 +02:00
Niels Dossche
c8e2765ba3 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-11878: SQLite3 callback functions cause a memory leak with a callable array
2023-09-09 15:35:11 +02:00
David Carlier
aef5225394 zend_call_stack_get implementation for NetBSD.
Despite being OpenBSD's predecessor, the approach is in fact
a lot closer to Linux, at least in principle. We purposely
avoid reading /proc/N/maps to be more future-proof.

Close GH-11637
2023-09-09 13:48:40 +01:00
Niels Dossche
880faa39e8
Add DOMNode::compareDocumentPosition() (#12146)
Reference: https://dom.spec.whatwg.org/#dom-node-comparedocumentposition
2023-09-09 01:14:26 +02:00
Niels Dossche
8c2c69494e Replace always-false attribute type check with assertion
The type will always be XML_ATTRIBUTE_NODE by construction via
php_dom_create_object, no need to check the type. Use an assertion
instead. This simplifies code and reasoning about error conditions.
2023-09-08 22:51:22 +02:00
Alex Dowad
50ca24251d PHP_HAVE_BUILTIN_USUB_OVERFLOW macro is defined even if __builtin_usub_overflow not available
...So conditionally including code which uses __builtin_usub_overflow
(for performance) if the macro is defined is not correct. We also need
to check if the macro is defined as a non-zero value.

Apparently this broke the build for a user whose C compiler is GCC
4.9.4. Sorry, user! That was my fault!

Thanks to Jakub Zelenka for reporting the issue.
2023-09-08 20:36:24 +02:00
Dmitry Stogov
be87cf9e62 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fixed tracing JIT support for CALLABLE_CONVERT (#12156)
2023-09-08 18:27:54 +03:00
Niels Dossche
d639a3755a Merge branch 'PHP-8.3'
* PHP-8.3:
  Update bundled pcre2 to 10.42
2023-09-08 17:15:56 +02:00
Niels Dossche
ac62eee842
Remove DOM_NO_ARGS() and DOM_NOT_IMPLEMENTED() (#12147)
DOM_NO_ARGS() has no users.
DOM_NOT_IMPLEMENTED() has a single user.
2023-09-08 17:02:52 +02:00
George Peter Banyard
8f8f31a16a
Merge branch 'PHP-8.3'
* PHP-8.3:
  streams: Checking if a stream is castable should not emit warnings for user defined streams
2023-09-08 13:23:20 +01:00
George Peter Banyard
7723718502
ext/pdo: Refactor pdo_stmt_construct() to use newer FCI/FCC API (#12142) 2023-09-08 12:32:44 +01:00
Jakub Zelenka
e04ddb32c8
Merge branch 'PHP-8.3' 2023-09-08 11:00:14 +01:00
Ilija Tovilo
6fac4d0ff2
Merge branch 'PHP-8.3'
* PHP-8.3:
  [skip ci] Skip leaking odbc test on asan
2023-09-08 11:08:27 +02:00
Remi Collet
c3c4b5356a
also display PHP version in phpize 2023-09-07 16:34:09 +02:00
Ilija Tovilo
c803402162
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix zend_separate_if_call_and_write for FUNC_ARGs
2023-09-07 14:26:31 +02:00
Ilija Tovilo
06c4092d05
Merge branch 'PHP-8.3'
* PHP-8.3:
  Revert "Skip profiling of sqlite3_step"
2023-09-07 10:35:33 +02:00
Máté Kocsis
2fad7cdd60
Fix type of the PHP_FLOAT_DIG constant
It used to be an int (https://github.com/php/php-src/pull/9616/files#diff-2978fe1c2c45b4eca89dc476376ddc7193bc4e5e7fff0c7d1c465f057b35a5e6L2155) before constant registration was refactored.
2023-09-07 10:01:02 +02:00
Máté Kocsis
2cb4d00693
Improve detection of predefined constants
In order to include constants documented at https://www.php.net/manual/en/reserved.constants.php, as well as constants which share the same varlistentry (just like what
https://www.php.net/manual/en/class.datetimeinterface.php#datetimeinterface.constants.atom does). In the same time, special constants like
true, false, null are excluded, since the manual uses their entity (&true;, &false, &null;, respectively), and gen_stub.php couldn't detect
them.
2023-09-07 10:00:55 +02:00
Niels Dossche
d693f0a4dc Merge branch 'PHP-8.3'
* PHP-8.3:
  [ci skip] UPGRADING
2023-09-06 18:02:07 +02:00
George Peter Banyard
e72b6f471a Merge branch 'PHP-8.3'
* PHP-8.3:
  ODBC unit tests shouldn't override odbc.ini location
  Fix persistent procedural ODBC connections not getting closed
2023-09-06 01:58:30 +01:00
Dmitry Stogov
c69ec5402d Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix ws
2023-09-06 00:01:23 +03:00
Dmitry Stogov
ce80c7a73a Merge branch 'PHP-8.3'
* PHP-8.3:
  Fixed tracing jit for BIND_INIT_STATIC_OR_JMP
2023-09-05 23:58:23 +03:00
Ilija Tovilo
fc1c948208
Merge branch 'PHP-8.3'
* PHP-8.3:
  Skip profiling of sqlite3_step
2023-09-05 17:38:25 +02:00
Ilija Tovilo
fd13aeec95
Merge branch 'PHP-8.3'
* PHP-8.3:
  Revert 479e659331
2023-09-05 16:14:59 +02:00
George Peter Banyard
2d3bff38bb Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix OSS Fuzz #61865: Undef variable in ++/-- for declared property that is unset in error handler
2023-09-05 10:41:22 +01:00
George Peter Banyard
ee6453f737 Merge branch 'PHP-8.3'
* PHP-8.3:
  Prevents double call to internal iterator rewind handler
  adds failing test case for #12060
2023-09-05 10:37:00 +01:00
Dmitry Stogov
8cfe2674e3 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fixed uninitialized EX(opline) access (possible Zend/tests/gh12073.phpt crash)
2023-09-05 10:13:55 +03:00
Máté Kocsis
0363dbfef4 Add support for verifying and syncronizing predefined constants with the manual 2023-09-05 08:09:24 +02:00
Ilija Tovilo
3f38105740
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix freeing of incompletely initialized closures
2023-09-04 15:40:07 +02:00
Ilija Tovilo
acd7769733
Merge branch 'PHP-8.3'
* PHP-8.3:
  [skip ci] Backport GA paths-ignore changes
2023-09-04 13:58:42 +02:00
Ilija Tovilo
3620c1a2c6
Merge branch 'PHP-8.3'
* PHP-8.3:
  [skip ci] Skip github actions when editing other ci files
2023-09-04 13:54:29 +02:00
Ilija Tovilo
c1184ff019
[skip ci] Also actually skip the xdebug build step 2023-09-04 13:04:06 +02:00
Ilija Tovilo
349902414a
[skip ci] Temporarily disable xdebug build in nightly 2023-09-04 12:18:01 +02:00
Niels Dossche
e2189e5f37 Merge branch 'PHP-8.3'
* PHP-8.3:
  Tweak behaviour of dynamic properties wrt error handlers
2023-09-03 18:27:32 +02:00
Ilija Tovilo
c0b3cbfdfc
Merge branch 'PHP-8.3'
* PHP-8.3:
  xfail mbstring test on Windows 32-bit
2023-09-03 14:23:09 +02:00
Ilija Tovilo
80c33c2136
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix master branch check in find-target-branch.bat
2023-09-03 14:19:12 +02:00
Ilija Tovilo
b9fee81bb0
Merge branch 'PHP-8.3'
* PHP-8.3:
  [skip ci] Fix branch check in nightly for PHP-8.3
2023-09-03 14:17:01 +02:00
Ilija Tovilo
4b5585120b
Merge branch 'PHP-8.3'
* PHP-8.3:
  Include branch in benchmarking information
2023-09-03 13:48:54 +02:00
George Peter Banyard
4a7aa64f1e Merge branch 'PHP-8.3'
* PHP-8.3:
  Fixed bug GH-12020: intl_get_error_message() broken after MessageFormatter::formatMessage() fails
2023-09-03 01:06:15 +01:00
Niels Dossche
48443183af
Use zend_result as return for properties in ext/dom (#12113) 2023-09-03 00:42:49 +02:00
George Peter Banyard
575263ff3f Merge branch 'PHP-8.3'
* PHP-8.3:
  Add tests for oss-fuzz-61469: Undef dynamic property in ++/-- unset in error handler
2023-09-02 23:35:16 +01:00
George Peter Banyard
2c05db33cc Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix memory leak with failed SQLPrepare
2023-09-02 23:03:38 +01:00
Niels Dossche
4dea42a3f8
Preallocate result array size in xpath (#12105)
We know what size they're going to be, and we know they are packed
arrays. Prevent reallocations and initialisation overhead by setting the
initial size and initializing it as packed from the start.
2023-09-02 16:29:21 +02:00
Niels Dossche
7be47953a3 Add XPath tests for basic types 2023-09-02 14:17:07 +02:00
Niels Dossche
07c688f224 Add XPath test with a context node 2023-09-02 14:16:55 +02:00
Máté Kocsis
0d7ef87bf6
Merge branch 'PHP-8.3'
- PHP-8.3:
  Align class name detection to the new class synopsis format
2023-09-01 14:18:54 +02:00
Ilija Tovilo
ac607b671f
Merge branch 'PHP-8.3'
* PHP-8.3:
  [skip ci] Fix borked xleak skip on <PHP-8.3
2023-09-01 12:40:57 +02:00
Dmitry Stogov
b7af61a154 Use version of PHP SDK binary tools that uses PHP downloads 2023-09-01 12:37:36 +03:00
Sander
dda6b8f682
[skip ci] Remove the link to the custom bugs tracker from the new issue window (#11538) 2023-08-31 15:52:57 +02:00
Remi Collet
2521a3fce1
Merge branch 'PHP-8.3'
* PHP-8.3:
  ensure displays_errors is off (default)
2023-08-31 14:55:33 +02:00
Jakub Zelenka
890cbbf013
Use version of PHP SDK binary tools that uses PHP downloads (#12085) 2023-08-31 13:15:53 +01:00
Ilija Tovilo
0d94b58d35
Merge branch 'PHP-8.3'
* PHP-8.3:
  Increase run-tests.php timeout for asan
2023-08-30 23:10:30 +02:00
Niels Dossche
d5bfaec0b7 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-11972: RecursiveCallbackFilterIterator regression in 8.1.18
2023-08-30 22:31:32 +02:00
Niels Dossche
f66677e325 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-11972: RecursiveCallbackFilterIterator regression in 8.1.18
2023-08-30 22:29:56 +02:00
Ilija Tovilo
da0e0570a3
Merge branch 'PHP-8.3'
* PHP-8.3:
  Skip dl() tests on ASAN
2023-08-30 22:25:51 +02:00
George Peter Banyard
a3725f12a3 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-11876: ini_parse_quantity() accepts invalid quantities
2023-08-30 21:23:36 +01:00
Jakub Zelenka
760367dd70
Remove incorrectly updated dtrace change from NEWS 2023-08-30 14:30:47 +01:00
Jakub Zelenka
0a34716667
Merge branch 'PHP-8.3' 2023-08-30 14:30:06 +01:00
Jakub Zelenka
46929ea92f
Merge branch 'PHP-8.3' 2023-08-30 13:41:42 +01:00
Jakub Zelenka
8c442f1719
Merge branch 'PHP-8.3' 2023-08-30 12:58:06 +01:00
Máté Kocsis
1ee6ad9f1f
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix the class synopsis of Throwable
2023-08-30 08:25:16 +02:00
Pierrick Charron
ad2ac6f05f
Prepare for PHP 8.4 2023-08-29 15:25:46 -04:00
Jakub Zelenka
f612a72de4
Merge branch 'PHP-8.3' 2023-08-29 18:27:18 +01:00
Jakub Zelenka
7deb84b7a6
Start PHP 8.4 development cycle 2023-08-29 17:19:01 +01:00
10614 changed files with 1077026 additions and 759890 deletions

View file

@ -46,8 +46,6 @@ jobs:
libicu-dev \
libtidy-dev \
libenchant-2-dev \
libaspell-dev \
libpspell-dev \
libsasl2-dev \
libxpm-dev \
libzip-dev \
@ -55,8 +53,6 @@ jobs:
libsqlite3-dev \
libwebp-dev \
libonig-dev \
libkrb5-dev \
libgssapi-krb5-2 \
libcurl4-openssl-dev \
libxml2-dev \
libxslt1-dev \
@ -71,7 +67,6 @@ jobs:
`#snmp-mibs-downloader` \
freetds-dev \
`#unixodbc-dev` \
libc-client-dev \
dovecot-core \
dovecot-pop3d \
dovecot-imapd \
@ -95,7 +90,6 @@ jobs:
--prefix=/usr \
--enable-phpdbg \
--enable-fpm \
--enable-opcache \
--with-pdo-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pgsql \
@ -111,7 +105,6 @@ jobs:
--enable-exif \
--with-zip \
--with-zlib \
--with-zlib-dir=/usr \
--enable-soap \
--enable-xmlreader \
--with-xsl \
@ -131,9 +124,7 @@ jobs:
--enable-bcmath \
--enable-calendar \
--enable-ftp \
--with-pspell=/usr \
--with-enchant=/usr \
--with-kerberos \
--enable-sysvmsg \
--with-ffi \
--enable-zend-test \
@ -152,12 +143,7 @@ jobs:
--with-qdbm \
--with-snmp \
`#--with-unixODBC` \
--with-imap \
--with-kerberos \
--with-imap-ssl \
`#--with-pdo-odbc=unixODBC,/usr` \
`#--with-pdo-oci=shared,instantclient,/opt/oracle/instantclient` \
`#--with-oci8=shared,instantclient,/opt/oracle/instantclient` \
--with-config-file-path=/etc \
--with-config-file-scan-dir=/etc/php.d \
--with-pdo-firebird \
@ -181,9 +167,8 @@ 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=16M \
-d opcache.jit_buffer_size=64M \
-d opcache.jit=tracing \
-d zend_test.observer.enabled=1 \
-d zend_test.observer.show_output=0 \

View file

@ -32,3 +32,7 @@ max_line_length = 80
[*.patch]
trim_trailing_whitespace = false
[*.rst]
indent_style = space
max_line_length = 100

7
.gitattributes vendored
View file

@ -21,9 +21,14 @@
# Collapse generated files within git and pull request diff.
**/*_arginfo.h linguist-generated -diff
/main/debug_gdb_scripts.c linguist-generated -diff
/Zend/zend_vm_execute.h linguist-generated -diff
/Zend/zend_vm_handlers.h linguist-generated -diff
/Zend/zend_vm_opcodes.[ch] linguist-generated -diff
# The OSS fuzz files are bunary
# The OSS fuzz files are binary
/ext/date/tests/ossfuzz*.txt binary
# Vendored libraries
/ext/lexbor/lexbor linguist-vendored
/ext/uri/uriparser linguist-vendored

5
.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
@ -25,9 +25,9 @@
/ext/gd @devnexen
/ext/gettext @devnexen
/ext/gmp @Girgias
/ext/imap @Girgias
/ext/intl @devnexen
/ext/json @bukka
/ext/lexbor @kocsismate @nielsdos
/ext/libxml @nielsdos
/ext/mbstring @alexdowad @youkidearitai
/ext/mysqli @bukka @kamil-tekiela
@ -52,6 +52,7 @@
/ext/sockets @devnexen
/ext/spl @Girgias
/ext/standard @bukka
/ext/uri @kocsismate
/ext/xml @nielsdos
/ext/xmlreader @nielsdos
/ext/xmlwriter @nielsdos

View file

@ -22,15 +22,23 @@ body:
```
validations:
required: true
- type: input
- type: textarea
attributes:
label: PHP Version
description: "The used PHP version. Make sure it is [supported](https://www.php.net/supported-versions.php)."
placeholder: "PHP 8.0.12"
description: |
Please run PHP with the `-v` flag (e.g. `php -v`, `php8.3 -v`, `php-fpm -v` or similar) and provide the full output of that command. If executing that command is not possible, please provide the full version number as given in PHPInfo.
Please make sure that the used PHP version [is a supported version](https://www.php.net/supported-versions.php).
placeholder: |
PHP 8.3.19 (cli) (built: Mar 13 2025 17:44:40) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.19, Copyright (c) Zend Technologies
with Zend OPcache v8.3.19, Copyright (c), by Zend Technologies
render: plain
validations:
required: true
- type: input
attributes:
label: Operating System
description: "The used operating system, if relevant."
placeholder: "Ubuntu 20.04"
placeholder: "Ubuntu 24.04"

View file

@ -3,6 +3,3 @@ contact_links:
- name: Documentation issue
url: https://github.com/php/doc-en/issues
about: Please report documentation issues on the doc-en repository.
- name: Security issue
url: https://bugs.php.net/report.php?security_bug
about: Please report security issues in this private bug tracker.

59
.github/actions/apk/action.yml vendored Normal file
View file

@ -0,0 +1,59 @@
name: apk
runs:
using: composite
steps:
- shell: sh
run: |
set -x
OPCACHE_TLS_TESTS_DEPS="clang gcc binutils-gold lld"
apk update -q
apk add \
util-linux \
bash \
sudo \
build-base \
autoconf \
unzip \
tar \
bison \
re2c \
pkgconf \
mysql-client \
bzip2-dev \
curl-dev \
freetype-dev \
gettext-dev \
gnu-libiconv-dev \
gmp-dev \
icu-dev \
icu-data-full \
jpeg-dev \
libffi-dev \
libpng-dev \
libsodium-dev \
libwebp-dev \
libxml2-dev \
libxpm-dev \
libxslt-dev \
libzip-dev \
oniguruma-dev \
openssl-dev \
readline-dev \
sqlite-dev \
tidyhtml-dev \
gdbm-dev \
lmdb-dev \
argon2-dev \
enchant2-dev \
freetds-dev \
imap-dev \
net-snmp-dev \
openldap-dev \
unixodbc-dev \
postgresql14-dev \
tzdata \
musl-locales \
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
@ -17,37 +19,32 @@ runs:
g++-multilib \
gcc-multilib \
language-pack-de \
libaspell-dev:i386 \
libbz2-dev:i386 \
libc6:i386 \
libcurl4-openssl-dev:i386 \
libffi-dev:i386 \
libfreetype6-dev:i386 \
libgmp-dev:i386 \
libgssapi-krb5-2:i386 \
libicu-dev:i386 \
libjpeg-dev:i386 \
libkrb5-dev:i386 \
libonig-dev:i386 \
libpng-dev:i386 \
libpq-dev:i386 \
libpspell-dev:i386 \
libreadline-dev:i386 \
libsasl2-dev:i386 \
libsodium-dev:i386 \
libsqlite3-dev:i386 \
libssl-dev:i386 \
libtidy-dev:i386 \
libwebp-dev:i386 \
libxml2-dev:i386 \
libxml2-dev:i386 \
libxpm-dev:i386 \
libxslt1-dev:i386 \
libzip-dev:i386 \
firebird-dev:i386 \
locales \
make \
pkg-config:i386 \
re2c \
unzip \
wget \
zlib1g-dev:i386
zlib1g-dev:i386 \
$OPCACHE_TLS_TESTS_DEPS

View file

@ -1,4 +1,8 @@
name: apt
inputs:
asan:
default: false
required: false
runs:
using: composite
steps:
@ -6,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
@ -32,22 +38,20 @@ runs:
libicu-dev \
libtidy-dev \
libenchant-2-dev \
libaspell-dev \
libbz2-dev \
libpspell-dev \
libsasl2-dev \
libxpm-dev \
libzip-dev \
libsqlite3-dev \
libsqlite3-mod-spatialite \
libwebp-dev \
${{ inputs.asan == 'false' && 'libavif-dev' || '' }} \
libonig-dev \
libkrb5-dev \
libgssapi-krb5-2 \
libcurl4-openssl-dev \
libxml2-dev \
libxslt1-dev \
libpq-dev \
libreadline-dev \
libedit-dev \
libldap2-dev \
libsodium-dev \
libargon2-dev \
@ -61,7 +65,6 @@ runs:
unixodbc-dev \
llvm \
clang \
libc-client-dev \
dovecot-core \
dovecot-pop3d \
dovecot-imapd \
@ -73,4 +76,5 @@ runs:
libqdbm-dev \
libjpeg-dev \
libpng-dev \
libfreetype6-dev
libfreetype6-dev \
$OPCACHE_TLS_TESTS_DEPS

View file

@ -11,6 +11,9 @@ runs:
code=" keg.link\(verbose: verbose\?"
sudo sed -Ei '' "s/$code.*/$code, overwrite: true\)/" "$formula_installer"
# Some packages exist on x86 but not arm, or vice versa.
# Install them with reinstall to avoid warnings.
brew reinstall autoconf webp tidy-html5 libzip libsodium icu4c curl
brew install \
bison \
re2c
@ -19,7 +22,6 @@ runs:
enchant \
libffi \
intltool \
icu4c \
libiconv \
t1lib \
libxml2 \

View file

@ -0,0 +1,79 @@
name: ./configure
inputs:
configurationParameters:
default: ''
required: false
skipSlow:
default: false
required: false
runs:
using: composite
steps:
- shell: bash
run: |
set -x
./buildconf --force
./configure \
--enable-option-checking=fatal \
--prefix=/usr \
--enable-phpdbg \
--enable-fpm \
--with-pdo-mysql=mysqlnd \
--with-mysqli=mysqlnd \
${{ inputs.skipSlow == 'false' && '--with-pgsql' || '' }} \
${{ inputs.skipSlow == 'false' && '--with-pdo-pgsql' || '' }} \
${{ inputs.skipSlow == 'false' && '--with-pdo-sqlite' || '' }} \
--enable-intl \
--without-pear \
--enable-gd \
--with-jpeg \
--with-webp \
--with-freetype \
--with-xpm \
--enable-exif \
--with-zip \
--with-zlib \
--enable-soap \
--enable-xmlreader \
--with-xsl \
${{ inputs.skipSlow == 'false' && '--with-tidy' || '' }} \
--enable-sysvsem \
--enable-sysvshm \
--enable-shmop \
--enable-pcntl \
--with-readline \
--enable-mbstring \
--with-iconv=/usr \
--with-curl \
--with-gettext \
--enable-sockets \
--with-bz2 \
--with-openssl \
--with-gmp \
--enable-bcmath \
--enable-calendar \
--enable-ftp \
${{ inputs.skipSlow == 'false' && '--with-enchant=/usr' || '' }} \
--enable-sysvmsg \
--with-ffi \
--enable-zend-test \
${{ inputs.skipSlow == 'false' && '--enable-dl-test=shared' || '' }} \
${{ inputs.skipSlow == 'false' && '--with-ldap' || '' }} \
${{ inputs.skipSlow == 'false' && '--with-ldap-sasl' || '' }} \
--with-password-argon2 \
--with-mhash \
--with-sodium \
--enable-dba \
--with-cdb \
--enable-flatfile \
--enable-inifile \
--with-lmdb \
--with-gdbm \
${{ inputs.skipSlow == 'false' && '--with-snmp' || '' }} \
${{ inputs.skipSlow == 'false' && '--with-unixODBC' || '' }} \
${{ inputs.skipSlow == 'false' && '--with-pdo-odbc=unixODBC,/usr' || '' }} \
--with-config-file-path=/etc \
--with-config-file-scan-dir=/etc/php.d \
${{ inputs.skipSlow == 'false' && '--with-pdo-dblib' || '' }} \
--enable-werror \
${{ inputs.configurationParameters }}

View file

@ -10,26 +10,24 @@ runs:
run: |
set -x
BREW_OPT="$(brew --prefix)"/opt
export PATH="/usr/local/opt/bison/bin:$PATH"
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/openssl@1.1/lib/pkgconfig"
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/curl/lib/pkgconfig"
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/krb5/lib/pkgconfig"
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/libffi/lib/pkgconfig"
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/libxml2/lib/pkgconfig"
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/libxslt/lib/pkgconfig"
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/zlib/lib/pkgconfig"
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/icu4c/lib/pkgconfig"
export PATH="$BREW_OPT/bison/bin:$PATH"
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$BREW_OPT/openssl@1.1/lib/pkgconfig"
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$BREW_OPT/curl/lib/pkgconfig"
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$BREW_OPT/libffi/lib/pkgconfig"
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$BREW_OPT/libxml2/lib/pkgconfig"
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$BREW_OPT/libxslt/lib/pkgconfig"
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$BREW_OPT/zlib/lib/pkgconfig"
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$BREW_OPT/icu4c/lib/pkgconfig"
sed -i -e 's/Requires.private:.*//g' "$BREW_OPT/curl/lib/pkgconfig/libcurl.pc"
./buildconf --force
./configure \
CFLAGS="-Wno-strict-prototypes -Wno-unused-but-set-variable -Wno-single-bit-bitfield-constant-conversion" \
--enable-option-checking=fatal \
--prefix=/usr/local \
--enable-fpm \
--with-pdo-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pgsql=/usr/local/opt/libpq \
--with-pdo-pgsql=/usr/local/opt/libpq \
--with-pgsql="$BREW_OPT"/libpq \
--with-pdo-pgsql="$BREW_OPT"/libpq \
--with-pdo-sqlite \
--without-pear \
--enable-gd \
@ -42,26 +40,24 @@ runs:
--enable-soap \
--enable-xmlreader \
--with-xsl \
--with-tidy=/usr/local/opt/tidy-html5 \
--with-tidy="$BREW_OPT"/tidy-html5 \
--with-libxml \
--enable-sysvsem \
--enable-sysvshm \
--enable-shmop \
--enable-pcntl \
--with-readline=/usr/local/opt/readline \
--with-readline="$BREW_OPT"/readline \
--enable-mbstring \
--with-curl \
--with-gettext=/usr/local/opt/gettext \
--with-gettext="$BREW_OPT"/gettext \
--enable-sockets \
--with-bz2=/usr/local/opt/bzip2 \
--with-bz2="$BREW_OPT"/bzip2 \
--with-openssl \
--with-gmp=/usr/local/opt/gmp \
--with-iconv=/usr/local/opt/libiconv \
--with-gmp="$BREW_OPT"/gmp \
--with-iconv="$BREW_OPT"/libiconv \
--enable-bcmath \
--enable-calendar \
--enable-ftp \
--with-pspell=/usr/local/opt/aspell \
--with-kerberos \
--enable-sysvmsg \
--with-ffi \
--enable-zend-test \

View file

@ -10,6 +10,7 @@ runs:
run: |
set -x
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/lib/i386-linux-gnu/pkgconfig"
./buildconf --force
export CFLAGS="-m32 -msse2"
export CXXFLAGS="-m32 -msse2"
@ -26,6 +27,7 @@ runs:
--with-pgsql \
--with-pdo-pgsql \
--with-pdo-sqlite \
--with-pdo-firebird \
--without-pear \
--enable-gd \
--with-jpeg \
@ -33,13 +35,10 @@ runs:
--with-freetype \
--with-xpm \
--enable-exif \
--with-zip \
--with-zlib \
--with-zlib-dir=/usr \
--enable-soap \
--enable-xmlreader \
--with-xsl \
--with-tidy \
--enable-sysvsem \
--enable-sysvshm \
--enable-shmop \
@ -55,8 +54,6 @@ runs:
--enable-bcmath \
--enable-calendar \
--enable-ftp \
--with-pspell=/usr \
--with-kerberos \
--enable-sysvmsg \
--with-ffi \
--enable-zend-test \

View file

@ -31,12 +31,12 @@ runs:
--enable-gd \
--with-jpeg \
--with-webp \
${{ inputs.asan == 'false' && '--with-avif' || '' }} \
--with-freetype \
--with-xpm \
--enable-exif \
--with-zip \
--with-zlib \
--with-zlib-dir=/usr \
--enable-soap \
--enable-xmlreader \
--with-xsl \
@ -45,7 +45,7 @@ runs:
--enable-sysvshm \
--enable-shmop \
--enable-pcntl \
--with-readline \
--without-readline --with-libedit \
--enable-mbstring \
--with-curl \
--with-gettext \
@ -56,9 +56,7 @@ runs:
--enable-bcmath \
--enable-calendar \
--enable-ftp \
--with-pspell=/usr \
${{ inputs.skipSlow == 'false' && '--with-enchant=/usr' || '' }} \
--with-kerberos \
--enable-sysvmsg \
--with-ffi \
--enable-zend-test \
@ -77,11 +75,7 @@ runs:
--with-qdbm \
${{ inputs.skipSlow == 'false' && '--with-snmp' || '' }} \
${{ inputs.skipSlow == 'false' && '--with-unixODBC' || '' }} \
${{ inputs.skipSlow == 'false' && '--with-imap' || '' }} \
${{ inputs.skipSlow == 'false' && '--with-imap-ssl' || '' }} \
${{ inputs.skipSlow == 'false' && '--with-pdo-odbc=unixODBC,/usr' || '' }} \
$([ -d "/opt/oracle/instantclient" ] && echo '--with-pdo-oci=shared,instantclient,/opt/oracle/instantclient') \
$([ -d "/opt/oracle/instantclient" ] && echo '--with-oci8=shared,instantclient,/opt/oracle/instantclient') \
--with-config-file-path=/etc \
--with-config-file-scan-dir=/etc/php.d \
${{ inputs.skipSlow == 'false' && '--with-pdo-firebird' || '' }} \

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 \
@ -82,6 +89,7 @@ runs:
--enable-intl \
--with-mhash \
--with-sodium \
--enable-werror \
--with-config-file-path=/etc \
--with-config-file-scan-dir=/etc/php.d \
${{ inputs.configurationParameters }}
@ -105,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

@ -0,0 +1,10 @@
name: Install
runs:
using: composite
steps:
- shell: bash
run: |
set -x
sudo make install
sudo mkdir -p /etc/php.d
sudo chmod 777 /etc/php.d

View file

@ -1,30 +0,0 @@
name: Create Oracle container
runs:
using: composite
steps:
- shell: bash
run: |
set -x
docker run \
-e "ORACLE_PASSWORD=pass" \
-p 1521:1521 \
--name oracle \
-h oracle \
-d gvenzl/oracle-xe:slim
mkdir /opt/oracle
wget -nv https://download.oracle.com/otn_software/linux/instantclient/2114000/instantclient-basiclite-linux.x64-21.14.0.0.0dbru.zip
unzip instantclient-basiclite-linux.x64-21.14.0.0.0dbru.zip && rm instantclient-basiclite-linux.x64-21.14.0.0.0dbru.zip
wget -nv https://download.oracle.com/otn_software/linux/instantclient/2114000/instantclient-sdk-linux.x64-21.14.0.0.0dbru.zip
unzip instantclient-sdk-linux.x64-21.14.0.0.0dbru.zip && rm instantclient-sdk-linux.x64-21.14.0.0.0dbru.zip
mv instantclient_*_* /opt/oracle/instantclient
# interferes with libldap2 headers
rm /opt/oracle/instantclient/sdk/include/ldap.h
# fix debug build warning: zend_signal: handler was replaced for signal (2) after startup
echo DISABLE_INTERRUPT=on > /opt/oracle/instantclient/network/admin/sqlnet.ora
sudo sh -c 'echo /opt/oracle/instantclient >/etc/ld.so.conf.d/oracle-instantclient.conf && ldconfig'
sudo mkdir -p /etc/php.d
sudo chmod 777 /etc/php.d
echo extension=oci8.so > /etc/php.d/oci8.ini
echo extension=pdo_oci.so > /etc/php.d/pdo_oci.ini

View file

@ -19,9 +19,3 @@ runs:
sudo cp ext/snmp/tests/snmpd.conf /etc/snmp
sudo cp ext/snmp/tests/bigtest /etc/snmp
sudo service snmpd restart
sudo groupadd -g 5000 vmail
sudo useradd -m -d /var/vmail -s /bin/false -u 5000 -g vmail vmail
sudo cp ext/imap/tests/setup/dovecot.conf /etc/dovecot/dovecot.conf
sudo cp ext/imap/tests/setup/dovecotpass /etc/dovecot/dovecotpass
sudo service dovecot restart

25
.github/actions/test-alpine/action.yml vendored Normal file
View file

@ -0,0 +1,25 @@
name: Test
inputs:
runTestsParameters:
default: ''
required: false
jitType:
default: 'disable'
required: false
runs:
using: composite
steps:
- shell: bash
run: |
set -x
export SKIP_IO_CAPTURE_TESTS=1
export STACK_LIMIT_DEFAULTS_CHECK=1
sapi/cli/php run-tests.php -P -q ${{ inputs.runTestsParameters }} \
-d opcache.jit=${{ inputs.jitType }} \
-d opcache.jit_buffer_size=64M \
-j$(nproc) \
-g FAIL,BORK,LEAK,XLEAK \
--no-progress \
--show-diff \
--show-slow 1000 \
--set-timeout 120

View file

@ -25,16 +25,16 @@ runs:
export PDO_DBLIB_TEST_DSN="dblib:host=127.0.0.1;dbname=master;version=7.0"
export PDO_DBLIB_TEST_USER="pdo_test"
export PDO_DBLIB_TEST_PASS="password"
export PHP_OCI8_TEST_USER="system"
export PHP_OCI8_TEST_PASS="pass"
export PHP_OCI8_TEST_DB="localhost/XEPDB1"
export PDO_OCI_TEST_USER="system"
export PDO_OCI_TEST_PASS="pass"
export PDO_OCI_TEST_DSN="oci:dbname=localhost/XEPDB1;charset=AL32UTF8"
export PGSQL_TEST_CONNSTR="host=localhost dbname=test port=5432 user=postgres password=postgres"
if [[ -z "$PDO_PGSQL_TEST_DSN" ]]; then
export PDO_PGSQL_TEST_DSN="pgsql:host=localhost port=5432 dbname=test user=postgres password=postgres"
fi
export PDO_FIREBIRD_TEST_DATABASE=test.fdb
if [[ -z "$PDO_FIREBIRD_TEST_DSN" ]]; then
export PDO_FIREBIRD_TEST_DSN=firebird:dbname=localhost:test.fdb
fi
export PDO_FIREBIRD_TEST_PASS=test
export PDO_FIREBIRD_TEST_USER=test
export ODBC_TEST_USER="odbc_test"
export ODBC_TEST_PASS="password"
export ODBC_TEST_DSN="Driver={ODBC Driver 17 for SQL Server};Server=127.0.0.1;Database=odbc;uid=$ODBC_TEST_USER;pwd=$ODBC_TEST_PASS"
@ -43,7 +43,8 @@ runs:
export STACK_LIMIT_DEFAULTS_CHECK=1
sapi/cli/php run-tests.php -P -q ${{ inputs.runTestsParameters }} \
-d opcache.jit=${{ inputs.jitType }} \
-d opcache.jit_buffer_size=16M \
-d opcache.protect_memory=1 \
-d opcache.jit_buffer_size=64M \
${{ inputs.idleCpu == 'true' && '-j$(($(/usr/bin/nproc) - 1))' || '-j$(/usr/bin/nproc)' }} \
-g FAIL,BORK,LEAK,XLEAK \
--no-progress \

View file

@ -17,7 +17,8 @@ runs:
export STACK_LIMIT_DEFAULTS_CHECK=1
sapi/cli/php run-tests.php -P -q ${{ inputs.runTestsParameters }} \
-d opcache.jit=${{ inputs.jitType }} \
-d opcache.jit_buffer_size=16M \
-d opcache.protect_memory=1 \
-d opcache.jit_buffer_size=64M \
-j$(($(sysctl -n hw.ncpu) - 1)) \
-g FAIL,BORK,LEAK,XLEAK \
--no-progress \

View file

@ -4,13 +4,13 @@ runs:
steps:
- shell: bash
run: |
set -x
[[ "$OSTYPE" == "darwin"* ]] && export PATH="/usr/local/opt/bison/bin:$PATH"
set -ex
[[ "$OSTYPE" == "darwin"* ]] && export PATH="$(brew --prefix)/opt/bison/bin:$PATH"
scripts/dev/credits
scripts/dev/genfiles
scripts/gdb/debug_gdb_scripts_gen.php
Zend/zend_vm_gen.php
ext/tokenizer/tokenizer_data_gen.php
build/gen_stub.php -f
build/gen_stub.php --generate-optimizer-info
build/gen_stub.php -f --generate-optimizer-info --verify
# Use the -a flag for a bug in git 2.46.0, which doesn't consider changed -diff files.
git add . -N && git diff -a --exit-code

517
.github/labeler.yml vendored
View file

@ -1,326 +1,501 @@
"Category: Engine":
- Zend/*
- changed-files:
- any-glob-to-any-file:
- Zend/*
"Category: Optimizer":
- Zend/Optimizer/**/*
- changed-files:
- any-glob-to-any-file:
- Zend/Optimizer/**/*
"Category: Build System":
- '**/*.m4'
- '**/*.w32'
- build/**/*
- buildconf
- buildconf.bat
- configure.ac
- scripts/**/*
- win32/build/**/*
- changed-files:
- any-glob-to-any-file:
- '**/*.m4'
- '**/*.w32'
- build/**/*
- buildconf
- buildconf.bat
- configure.ac
- scripts/**/*
- win32/build/**/*
"Extension: bcmath":
- ext/bcmath/**/*
- changed-files:
- any-glob-to-any-file:
- ext/bcmath/**/*
"Extension: bz2":
- ext/bz2/**/*
- changed-files:
- any-glob-to-any-file:
- ext/bz2/**/*
"Extension: calendar":
- ext/calendar/**/*
- changed-files:
- any-glob-to-any-file:
- ext/calendar/**/*
"Extension: com_dotnet":
- ext/com_dotnet/**/*
- changed-files:
- any-glob-to-any-file:
- ext/com_dotnet/**/*
"Extension: ctype":
- ext/ctype/**/*
- changed-files:
- any-glob-to-any-file:
- ext/ctype/**/*
"Extension: curl":
- ext/curl/**/*
- changed-files:
- any-glob-to-any-file:
- ext/curl/**/*
"Extension: date":
- ext/date/**/*
- changed-files:
- any-glob-to-any-file:
- ext/date/**/*
"Extension: dba":
- ext/dba/**/*
- changed-files:
- any-glob-to-any-file:
- ext/dba/**/*
"Extension: dom":
- ext/dom/**/*
- changed-files:
- any-glob-to-any-file:
- ext/dom/**/*
"Extension: enchant":
- ext/enchant/**/*
- changed-files:
- any-glob-to-any-file:
- ext/enchant/**/*
"Extension: exif":
- ext/exif/**/*
- changed-files:
- any-glob-to-any-file:
- ext/exif/**/*
"Extension: ffi":
- ext/ffi/**/*
- changed-files:
- any-glob-to-any-file:
- ext/ffi/**/*
"Extension: fileinfo":
- ext/fileinfo/**/*
- changed-files:
- any-glob-to-any-file:
- ext/fileinfo/**/*
"Extension: filter":
- ext/filter/**/*
- changed-files:
- any-glob-to-any-file:
- ext/filter/**/*
"Extension: ftp":
- ext/ftp/**/*
- changed-files:
- any-glob-to-any-file:
- ext/ftp/**/*
"Extension: gd":
- ext/gd/**/*
- changed-files:
- any-glob-to-any-file:
- ext/gd/**/*
"Extension: gettext":
- ext/gettext/**/*
- changed-files:
- any-glob-to-any-file:
- ext/gettext/**/*
"Extension: gmp":
- ext/gmp/**/*
- changed-files:
- any-glob-to-any-file:
- ext/gmp/**/*
"Extension: hash":
- ext/hash/**/*
- changed-files:
- any-glob-to-any-file:
- ext/hash/**/*
"Extension: iconv":
- ext/iconv/**/*
"Extension: imap":
- ext/imap/**/*
- changed-files:
- any-glob-to-any-file:
- ext/iconv/**/*
"Extension: intl":
- ext/intl/**/*
- changed-files:
- any-glob-to-any-file:
- ext/intl/**/*
"Extension: json":
- ext/json/**/*
- changed-files:
- any-glob-to-any-file:
- ext/json/**/*
"Extension: ldap":
- ext/ldap/**/*
- changed-files:
- any-glob-to-any-file:
- ext/ldap/**/*
"Extension: libxml":
- ext/libxml/**/*
- changed-files:
- any-glob-to-any-file:
- ext/libxml/**/*
"Extension: mbstring":
- ext/mbstring/**/*
- changed-files:
- any-glob-to-any-file:
- ext/mbstring/**/*
"Extension: mysqli":
- ext/mysqli/**/*
- changed-files:
- any-glob-to-any-file:
- ext/mysqli/**/*
"Extension: mysqlnd":
- ext/mysqlnd/**/*
"Extension: oci8":
- ext/oci8/**/*
- changed-files:
- any-glob-to-any-file:
- ext/mysqlnd/**/*
"Extension: odbc":
- ext/odbc/**/*
- changed-files:
- any-glob-to-any-file:
- ext/odbc/**/*
"Extension: opcache":
- ext/opcache/**/*
- changed-files:
- any-glob-to-any-file:
- ext/opcache/**/*
"Extension: openssl":
- ext/openssl/**/*
- changed-files:
- any-glob-to-any-file:
- ext/openssl/**/*
"Extension: pcntl":
- ext/pcntl/**/*
- changed-files:
- any-glob-to-any-file:
- ext/pcntl/**/*
"Extension: pcre":
- ext/pcre/**/*
- changed-files:
- any-glob-to-any-file:
- ext/pcre/**/*
"Extension: pdo (core)":
- ext/pdo/**/*
- changed-files:
- any-glob-to-any-file:
- ext/pdo/**/*
"Extension: pdo_dblib":
- ext/pdo_dblib/**/*
- changed-files:
- any-glob-to-any-file:
- ext/pdo_dblib/**/*
"Extension: pdo_firebird":
- ext/pdo_firebird/**/*
- changed-files:
- any-glob-to-any-file:
- ext/pdo_firebird/**/*
"Extension: pdo_mysql":
- ext/pdo_mysql/**/*
"Extension: pdo_oci":
- ext/pdo_oci/**/*
- changed-files:
- any-glob-to-any-file:
- ext/pdo_mysql/**/*
"Extension: pdo_odbc":
- ext/pdo_odbc/**/*
- changed-files:
- any-glob-to-any-file:
- ext/pdo_odbc/**/*
"Extension: pdo_pgsql":
- ext/pdo_pgsql/**/*
- changed-files:
- any-glob-to-any-file:
- ext/pdo_pgsql/**/*
"Extension: pdo_sqlite":
- ext/pdo_sqlite/**/*
- changed-files:
- any-glob-to-any-file:
- ext/pdo_sqlite/**/*
"Extension: pgsql":
- ext/pgsql/**/*
- changed-files:
- any-glob-to-any-file:
- ext/pgsql/**/*
"Extension: phar":
- ext/phar/**/*
- changed-files:
- any-glob-to-any-file:
- ext/phar/**/*
"Extension: posix":
- ext/posix/**/*
"Extension: pspell":
- ext/pspell/**/*
- changed-files:
- any-glob-to-any-file:
- ext/posix/**/*
"Extension: random":
- ext/random/**/*
- changed-files:
- any-glob-to-any-file:
- ext/random/**/*
"Extension: readline":
- ext/readline/**/*
- changed-files:
- any-glob-to-any-file:
- ext/readline/**/*
"Extension: reflection":
- ext/reflection/**/*
- changed-files:
- any-glob-to-any-file:
- ext/reflection/**/*
"Extension: session":
- ext/session/**/*
- changed-files:
- any-glob-to-any-file:
- ext/session/**/*
"Extension: shmop":
- ext/shmop/**/*
- changed-files:
- any-glob-to-any-file:
- ext/shmop/**/*
"Extension: simplexml":
- ext/simplexml/**/*
- changed-files:
- any-glob-to-any-file:
- ext/simplexml/**/*
"Extension: snmp":
- ext/snmp/**/*
- changed-files:
- any-glob-to-any-file:
- ext/snmp/**/*
"Extension: soap":
- ext/soap/**/*
- changed-files:
- any-glob-to-any-file:
- ext/soap/**/*
"Extension: sockets":
- ext/sockets/**/*
- changed-files:
- any-glob-to-any-file:
- ext/sockets/**/*
"Extension: sodium":
- ext/sodium/**/*
- changed-files:
- any-glob-to-any-file:
- ext/sodium/**/*
"Extension: spl":
- ext/spl/**/*
- changed-files:
- any-glob-to-any-file:
- ext/spl/**/*
"Extension: sqlite3":
- ext/sqlite3/**/*
- changed-files:
- any-glob-to-any-file:
- ext/sqlite3/**/*
"Extension: standard":
- ext/standard/**/*
- changed-files:
- any-glob-to-any-file:
- ext/standard/**/*
"Extension: sysvmsg":
- ext/sysvmsg/**/*
- changed-files:
- any-glob-to-any-file:
- ext/sysvmsg/**/*
"Extension: sysvsem":
- ext/sysvsem/**/*
- changed-files:
- any-glob-to-any-file:
- ext/sysvsem/**/*
"Extension: sysvshm":
- ext/sysvshm/**/*
- changed-files:
- any-glob-to-any-file:
- ext/sysvshm/**/*
"Extension: tidy":
- ext/tidy/**/*
- changed-files:
- any-glob-to-any-file:
- ext/tidy/**/*
"Extension: tokenizer":
- ext/tokenizer/**/*
- changed-files:
- any-glob-to-any-file:
- ext/tokenizer/**/*
"Extension: uri":
- changed-files:
- any-glob-to-any-file:
- ext/uri/**/*
"Extension: xml":
- ext/xml/**/*
- changed-files:
- any-glob-to-any-file:
- ext/xml/**/*
"Extension: xmlreader":
- ext/xmlreader/**/*
- changed-files:
- any-glob-to-any-file:
- ext/xmlreader/**/*
"Extension: xmlwriter":
- ext/xmlwriter/**/*
- changed-files:
- any-glob-to-any-file:
- ext/xmlwriter/**/*
"Extension: xsl":
- ext/xsl/**/*
- changed-files:
- any-glob-to-any-file:
- ext/xsl/**/*
"Extension: zend_test":
- ext/zend_test/**/*
- changed-files:
- any-glob-to-any-file:
- ext/zend_test/**/*
"Extension: zip":
- ext/zip/**/*
- changed-files:
- any-glob-to-any-file:
- ext/zip/**/*
"Extension: zlib":
- ext/zlib/**/*
- changed-files:
- any-glob-to-any-file:
- ext/zlib/**/*
"SAPI: apache2handler":
- sapi/apache2handler/**/*
- changed-files:
- any-glob-to-any-file:
- sapi/apache2handler/**/*
"SAPI: cgi":
- sapi/cgi/**/*
- changed-files:
- any-glob-to-any-file:
- sapi/cgi/**/*
"SAPI: cli":
- sapi/cli/**/*
- changed-files:
- any-glob-to-any-file:
- sapi/cli/**/*
"SAPI: fpm":
- sapi/fpm/**/*
- changed-files:
- any-glob-to-any-file:
- sapi/fpm/**/*
"SAPI: fuzzer":
- sapi/fuzzer/**/*
- changed-files:
- any-glob-to-any-file:
- sapi/fuzzer/**/*
"SAPI: litespeed":
- sapi/litespeed/**/*
- changed-files:
- any-glob-to-any-file:
- sapi/litespeed/**/*
"SAPI: phpdbg":
- sapi/phpdbg/**/*
- changed-files:
- any-glob-to-any-file:
- sapi/phpdbg/**/*
"ABI break":
- 'TSRM/*.h'
- 'Zend/*.h'
- 'Zend/Optimizer/zend_call_graph.h'
- 'Zend/Optimizer/zend_cfg.h'
- 'Zend/Optimizer/zend_dump.h'
- 'Zend/Optimizer/zend_func_info.h'
- 'Zend/Optimizer/zend_inference.h'
- 'Zend/Optimizer/zend_optimizer.h'
- 'Zend/Optimizer/zend_ssa.h'
- 'ext/date/lib/timelib.h'
- 'ext/date/lib/timelib_config.h'
- 'ext/date/php_date.h'
- 'ext/filter/php_filter.h'
- 'ext/hash/php_hash.h'
- 'ext/hash/php_hash_adler32.h'
- 'ext/hash/php_hash_crc32.h'
- 'ext/hash/php_hash_gost.h'
- 'ext/hash/php_hash_haval.h'
- 'ext/hash/php_hash_md.h'
- 'ext/hash/php_hash_murmur.h'
- 'ext/hash/php_hash_ripemd.h'
- 'ext/hash/php_hash_sha.h'
- 'ext/hash/php_hash_sha3.h'
- 'ext/hash/php_hash_snefru.h'
- 'ext/hash/php_hash_tiger.h'
- 'ext/hash/php_hash_whirlpool.h'
- 'ext/hash/php_hash_xxhash.h'
- 'ext/json/php_json.h'
- 'ext/json/php_json_parser.h'
- 'ext/json/php_json_scanner.h'
- 'ext/mbstring/libmbfl/config.h'
- 'ext/mbstring/libmbfl/mbfl/eaw_table.h'
- 'ext/mbstring/libmbfl/mbfl/mbfilter.h'
- 'ext/mbstring/libmbfl/mbfl/mbfilter_8bit.h'
- 'ext/mbstring/libmbfl/mbfl/mbfilter_pass.h'
- 'ext/mbstring/libmbfl/mbfl/mbfilter_wchar.h'
- 'ext/mbstring/libmbfl/mbfl/mbfl_consts.h'
- 'ext/mbstring/libmbfl/mbfl/mbfl_convert.h'
- 'ext/mbstring/libmbfl/mbfl/mbfl_defs.h'
- 'ext/mbstring/libmbfl/mbfl/mbfl_encoding.h'
- 'ext/mbstring/libmbfl/mbfl/mbfl_filter_output.h'
- 'ext/mbstring/libmbfl/mbfl/mbfl_language.h'
- 'ext/mbstring/libmbfl/mbfl/mbfl_memory_device.h'
- 'ext/mbstring/libmbfl/mbfl/mbfl_string.h'
- 'ext/mbstring/mbstring.h'
- 'ext/mysqli/php_mysqli_structs.h'
- 'ext/mysqlnd/*.h'
- 'ext/pcre/pcre2lib/*.h'
- 'ext/pcre/php_pcre.h'
- 'ext/pdo/php_pdo.h'
- 'ext/pdo/php_pdo_driver.h'
- 'ext/pdo/php_pdo_error.h'
- 'ext/random/php_random.h'
- 'ext/session/mod_files.h'
- 'ext/session/mod_mm.h'
- 'ext/session/mod_user.h'
- 'ext/session/php_session.h'
- 'ext/sockets/php_sockets.h'
- 'ext/sockets/windows_common.h'
- 'ext/spl/php_spl.h'
- 'ext/spl/spl_array.h'
- 'ext/spl/spl_directory.h'
- 'ext/spl/spl_dllist.h'
- 'ext/spl/spl_engine.h'
- 'ext/spl/spl_exceptions.h'
- 'ext/spl/spl_fixedarray.h'
- 'ext/spl/spl_functions.h'
- 'ext/spl/spl_heap.h'
- 'ext/spl/spl_iterators.h'
- 'ext/spl/spl_observer.h'
- 'ext/standard/*.h'
- 'main/*.h'
- 'main/streams/*.h'
- 'sapi/embed/php_embed.h'
- 'win32/*.h'
- changed-files:
- any-glob-to-any-file:
- 'TSRM/*.h'
- 'Zend/*.h'
- 'Zend/Optimizer/zend_call_graph.h'
- 'Zend/Optimizer/zend_cfg.h'
- 'Zend/Optimizer/zend_dfg.h'
- 'Zend/Optimizer/zend_dump.h'
- 'Zend/Optimizer/zend_func_info.h'
- 'Zend/Optimizer/zend_inference.h'
- 'Zend/Optimizer/zend_optimizer.h'
- 'Zend/Optimizer/zend_ssa.h'
- 'Zend/Optimizer/zend_worklist.h'
- 'ext/curl/php_curl.h'
- 'ext/date/lib/timelib.h'
- 'ext/date/lib/timelib_config.h'
- 'ext/date/php_date.h'
- 'ext/dom/dom_ce.h'
- 'ext/dom/namespace_compat.h'
- 'ext/dom/xml_common.h'
- 'ext/dom/xpath_callbacks.h'
- 'ext/filter/php_filter.h'
- 'ext/gd/libgd/*.h'
- 'ext/gd/php_gd.h'
- 'ext/gmp/php_gmp_int.h'
- 'ext/hash/php_hash.h'
- 'ext/hash/php_hash_adler32.h'
- 'ext/hash/php_hash_crc32.h'
- 'ext/hash/php_hash_fnv.h'
- 'ext/hash/php_hash_gost.h'
- 'ext/hash/php_hash_haval.h'
- 'ext/hash/php_hash_joaat.h'
- 'ext/hash/php_hash_md.h'
- 'ext/hash/php_hash_murmur.h'
- 'ext/hash/php_hash_ripemd.h'
- 'ext/hash/php_hash_sha.h'
- 'ext/hash/php_hash_sha3.h'
- 'ext/hash/php_hash_snefru.h'
- 'ext/hash/php_hash_tiger.h'
- 'ext/hash/php_hash_whirlpool.h'
- 'ext/hash/php_hash_xxhash.h'
- 'ext/hash/xxhash/xxhash.h'
- 'ext/iconv/php_iconv.h'
- 'ext/json/php_json.h'
- 'ext/json/php_json_parser.h'
- 'ext/json/php_json_scanner.h'
- 'ext/libxml/php_libxml.h'
- 'ext/mbstring/libmbfl/config.h'
- 'ext/mbstring/libmbfl/mbfl/eaw_table.h'
- 'ext/mbstring/libmbfl/mbfl/mbfilter.h'
- 'ext/mbstring/libmbfl/mbfl/mbfilter_8bit.h'
- 'ext/mbstring/libmbfl/mbfl/mbfilter_pass.h'
- 'ext/mbstring/libmbfl/mbfl/mbfilter_wchar.h'
- 'ext/mbstring/libmbfl/mbfl/mbfl_consts.h'
- 'ext/mbstring/libmbfl/mbfl/mbfl_convert.h'
- 'ext/mbstring/libmbfl/mbfl/mbfl_defs.h'
- 'ext/mbstring/libmbfl/mbfl/mbfl_encoding.h'
- 'ext/mbstring/libmbfl/mbfl/mbfl_filter_output.h'
- 'ext/mbstring/libmbfl/mbfl/mbfl_language.h'
- 'ext/mbstring/libmbfl/mbfl/mbfl_memory_device.h'
- 'ext/mbstring/libmbfl/mbfl/mbfl_string.h'
- 'ext/mbstring/mbstring.h'
- 'ext/mbstring/php_mbregex.h'
- 'ext/mbstring/php_onig_compat.h'
- 'ext/mysqli/mysqli_mysqlnd.h'
- 'ext/mysqli/php_mysqli_structs.h'
- 'ext/mysqlnd/*.h'
- 'ext/pcre/pcre2lib/*.h'
- 'ext/pcre/php_pcre.h'
- 'ext/pdo/pdo_sql_parser.h'
- 'ext/pdo/php_pdo.h'
- 'ext/pdo/php_pdo_driver.h'
- 'ext/pdo/php_pdo_error.h'
- 'ext/random/php_random.h'
- 'ext/random/php_random_csprng.h'
- 'ext/random/php_random_uint128.h'
- 'ext/session/mod_files.h'
- 'ext/session/mod_mm.h'
- 'ext/session/mod_user.h'
- 'ext/session/php_session.h'
- 'ext/simplexml/php_simplexml.h'
- 'ext/simplexml/php_simplexml_exports.h'
- 'ext/sockets/php_sockets.h'
- 'ext/sockets/windows_common.h'
- 'ext/sodium/php_libsodium.h'
- 'ext/spl/php_spl.h'
- 'ext/spl/spl_array.h'
- 'ext/spl/spl_directory.h'
- 'ext/spl/spl_dllist.h'
- 'ext/spl/spl_exceptions.h'
- 'ext/spl/spl_fixedarray.h'
- 'ext/spl/spl_functions.h'
- 'ext/spl/spl_heap.h'
- 'ext/spl/spl_iterators.h'
- 'ext/spl/spl_observer.h'
- 'ext/standard/*.h'
- 'ext/xml/expat_compat.h'
- 'ext/xml/php_xml.h'
- 'main/*.h'
- 'main/streams/*.h'
- 'sapi/cli/cli.h'
- 'sapi/embed/php_embed.h'
- 'win32/*.h'

View file

@ -1,3 +1,4 @@
leak:acommon::DictInfoList::elements
leak:timer_create
leak:netsnmp_init_mib_internals
leak:isc_attach_database

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

@ -1,5 +1,3 @@
@echo off
if /i "%GITHUB_ACTIONS%" neq "True" (
echo for CI only
exit /b 3

View file

@ -25,18 +25,17 @@ if %errorlevel% neq 0 exit /b 3
if "%THREAD_SAFE%" equ "0" set ADD_CONF=%ADD_CONF% --disable-zts
if "%INTRINSICS%" neq "" set ADD_CONF=%ADD_CONF% --enable-native-intrinsics=%INTRINSICS%
if "%ASAN%" equ "1" set ADD_CONF=%ADD_CONF% --enable-sanitizer --enable-debug-pack
rem Some undefined behavior is reported on 32-bit, this should be fixed
if "%PLATFORM%" == "x86" (
set CFLAGS=/W1
) else (
set CFLAGS=/W1 /WX
)
rem C4018: comparison: signed/unsigned mismatch
rem C4146: unary minus operator applied to unsigned type
rem C4244: type conversion, possible loss of data
rem C4267: 'size_t' type conversion, possible loss of data
set CFLAGS=/W3 /WX /wd4018 /wd4146 /wd4244 /wd4267
cmd /c configure.bat ^
--enable-snapshot-build ^
--disable-debug-pack ^
--enable-com-dotnet=shared ^
--without-analyzer ^
--enable-object-out-dir=%PHP_BUILD_OBJ_DIR% ^
--with-php-build=%DEPS_DIR% ^
@ -46,5 +45,7 @@ if %errorlevel% neq 0 exit /b 3
nmake /NOLOGO
if %errorlevel% neq 0 exit /b 3
nmake /NOLOGO comtest.dll
if %errorlevel% neq 0 exit /b 3
exit /b 0

View file

@ -3,6 +3,6 @@
for /f "usebackq tokens=3" %%i in (`findstr PHP_MAJOR_VERSION main\php_version.h`) do set BRANCH=%%i
for /f "usebackq tokens=3" %%i in (`findstr PHP_MINOR_VERSION main\php_version.h`) do set BRANCH=%BRANCH%.%%i
if /i "%BRANCH%" equ "8.4" (
if /i "%BRANCH%" equ "8.5" (
set BRANCH=master
)

View file

@ -1,5 +1,3 @@
@echo off
if /i "%GITHUB_ACTIONS%" neq "True" (
echo for CI only
exit /b 3

View file

@ -1,5 +1,3 @@
@echo off
if /i "%GITHUB_ACTIONS%" neq "True" (
echo for CI only
exit /b 3
@ -53,19 +51,22 @@ set PDOTEST_DSN=odbc:%ODBC_TEST_DSN%
rem setup Firebird related exts
if "%PLATFORM%" == "x64" (
set PHP_FIREBIRD_DOWNLOAD_URL=https://github.com/FirebirdSQL/firebird/releases/download/v3.0.9/Firebird-3.0.9.33560-0_x64.zip
set PHP_FIREBIRD_DOWNLOAD_URL=https://github.com/FirebirdSQL/firebird/releases/download/v4.0.4/Firebird-4.0.4.3010-0-x64.zip
) else (
set PHP_FIREBIRD_DOWNLOAD_URL=https://github.com/FirebirdSQL/firebird/releases/download/v3.0.9/Firebird-3.0.9.33560-0_Win32.zip
set PHP_FIREBIRD_DOWNLOAD_URL=https://github.com/FirebirdSQL/firebird/releases/download/v4.0.4/Firebird-4.0.4.3010-0-Win32.zip
)
curl -sLo Firebird.zip %PHP_FIREBIRD_DOWNLOAD_URL%
7z x -oC:\Firebird Firebird.zip
set PDO_FIREBIRD_TEST_DATABASE=C:\test.fdb
set PDO_FIREBIRD_TEST_DSN=firebird:dbname=%PDO_FIREBIRD_TEST_DATABASE%
set PDO_FIREBIRD_TEST_DSN=firebird:dbname=127.0.0.1:%PDO_FIREBIRD_TEST_DATABASE%
set PDO_FIREBIRD_TEST_USER=SYSDBA
set PDO_FIREBIRD_TEST_PASS=phpfi
echo create user %PDO_FIREBIRD_TEST_USER% password '%PDO_FIREBIRD_TEST_PASS%';> C:\Firebird\create_user.sql
echo commit;>> C:\Firebird\create_user.sql
echo create database '%PDO_FIREBIRD_TEST_DATABASE%' user '%PDO_FIREBIRD_TEST_USER%' password '%PDO_FIREBIRD_TEST_PASS%';> C:\Firebird\setup.sql
C:\Firebird\instsvc.exe install -n TestInstance
C:\Firebird\isql -q -i C:\Firebird\setup.sql
C:\Firebird\isql -q -i C:\Firebird\create_user.sql -user sysdba %PDO_FIREBIRD_TEST_DATABASE%
C:\Firebird\instsvc.exe start -n TestInstance
if %errorlevel% neq 0 exit /b 3
path C:\Firebird;%PATH%
@ -90,9 +91,7 @@ set OPENSSL_CONF=
rem set SSLEAY_CONF=
rem prepare for OPcache
if "%OPCACHE%" equ "1" set OPCACHE_OPTS=-d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.protect_memory=1 -d opcache.jit_buffer_size=16M
rem work-around for failing to dl(mysqli) with OPcache (https://github.com/php/php-src/issues/8508)
if "%OPCACHE%" equ "1" set OPCACHE_OPTS=%OPCACHE_OPTS% -d extension=mysqli
if "%OPCACHE%" equ "1" set OPCACHE_OPTS=-d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.protect_memory=1 -d opcache.jit_buffer_size=64M -d opcache.jit=tracing
rem prepare for enchant
mkdir %~d0\usr\local\lib\enchant-2
@ -110,6 +109,7 @@ popd
rem prepare for snmp
set MIBDIRS=%DEPS_DIR%\share\mibs
sed -i "s/exec HexTest .*/exec HexTest cscript\.exe \/nologo %GITHUB_WORKSPACE:\=\/%\/ext\/snmp\/tests\/bigtest\.js/g" %GITHUB_WORKSPACE%\ext\snmp\tests\snmpd.conf
start %DEPS_DIR%\bin\snmpd.exe -C -c %GITHUB_WORKSPACE%\ext\snmp\tests\snmpd.conf -Ln
set PHP_BUILD_DIR=%PHP_BUILD_OBJ_DIR%\Release
@ -119,37 +119,42 @@ rem prepare for mail
curl -sLo hMailServer.exe https://www.hmailserver.com/download_file/?downloadid=271
hMailServer.exe /verysilent
cd %APPVEYOR_BUILD_FOLDER%
%PHP_BUILD_DIR%\php.exe -dextension_dir=%PHP_BUILD_DIR% -dextension=com_dotnet appveyor\setup_hmailserver.php
%PHP_BUILD_DIR%\php.exe -dextension_dir=%PHP_BUILD_DIR% -dextension=com_dotnet .github\setup_hmailserver.php
rem prepare for com_dotnet
nmake register_comtest
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
rem remove ext dlls for which tests are not supported
for %%i in (ldap oci8_12c pdo_oci) do (
for %%i in (ldap) do (
del %PHP_BUILD_DIR%\php_%%i.dll
)
rem reduce excessive stack reserve for testing
editbin /stack:8388608 %PHP_BUILD_DIR%\php.exe
editbin /stack:8388608 %PHP_BUILD_DIR%\php-cgi.exe
set TEST_PHPDBG_EXECUTABLE=%PHP_BUILD_DIR%\phpdbg.exe
copy /-y %DEPS_DIR%\bin\*.dll %PHP_BUILD_DIR%\*
if "%ASAN%" equ "1" set ASAN_OPTS=--asan
mkdir c:\tests_tmp
nmake test TESTS="%OPCACHE_OPTS% -g FAIL,BORK,LEAK,XLEAK --no-progress -q --offline --show-diff --show-slow 1000 --set-timeout 120 --temp-source c:\tests_tmp --temp-target c:\tests_tmp --bless %PARALLEL%"
nmake test TESTS="%OPCACHE_OPTS% -g FAIL,BORK,LEAK,XLEAK %ASAN_OPTS% --no-progress -q --offline --show-diff --show-slow 1000 --set-timeout 120 --temp-source c:\tests_tmp --temp-target c:\tests_tmp %PARALLEL%"
set EXIT_CODE=%errorlevel%
nmake unregister_comtest
taskkill /f /im snmpd.exe
if %EXIT_CODE% GEQ 1 (
git checkout ext\pgsql\tests\config.inc
git diff > bless_tests.patch
)
exit /b %EXIT_CODE%

25
.github/setup_hmailserver.php vendored Normal file
View file

@ -0,0 +1,25 @@
<?php
/** If required change these values to make the test runs */
const IMAP_MAIL_DOMAIN = 'example.com';
const IMAP_MAILBOX_PASSWORD = 'p4ssw0rd';
/** Tests require 4 valid userids */
const IMAP_USERS = ["webmaster", "info", "admin", "foo"];
$hmail = new COM("hMailServer.Application");
$hmail->authenticate("Administrator", "");
$domain = $hmail->Domains->Add();
$domain->Name = IMAP_MAIL_DOMAIN;
$domain->Active = true;
$domain->Save();
$accounts = $domain->accounts();
foreach (IMAP_USERS as $user) {
$account = $accounts->Add();
$account->Address = "$user@" . IMAP_MAIL_DOMAIN;
$account->Password = IMAP_MAILBOX_PASSWORD;
$account->Active = true;
$account->Save();
}

View file

@ -9,7 +9,7 @@ permissions:
jobs:
build:
if: github.repository_owner == 'php'
if: github.repository == 'php/php-src'
runs-on: ubuntu-latest
permissions:
issues: write

View file

@ -9,13 +9,13 @@ permissions:
jobs:
stale:
if: github.repository_owner == 'php'
if: github.repository == 'php/php-src'
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v6
- uses: actions/stale@v9
with:
days-before-close: 14
days-before-stale: 90

View file

@ -9,13 +9,13 @@ permissions:
jobs:
stale:
if: github.repository_owner == 'php'
if: github.repository == 'php/php-src'
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v6
- uses: actions/stale@v9
with:
days-before-close: 7
days-before-stale: 60

30
.github/workflows/docs.yml vendored Normal file
View file

@ -0,0 +1,30 @@
name: Docs
on:
push:
branches:
- master
paths:
- docs/**
pull_request:
paths:
- docs/**
jobs:
pages:
runs-on: ubuntu-22.04
permissions:
pages: write
id-token: write
if: github.repository == 'php/php-src'
steps:
- name: git checkout
uses: actions/checkout@v5
- name: Install dependencies
run: pip install -r docs/requirements.txt
- name: Check formatting
run: make -C docs check-formatting
- name: Publish
if: github.event_name == 'push'
uses: sphinx-notes/pages@v3
with:
checkout: false
documentation_path: docs/source

View file

@ -12,6 +12,6 @@ jobs:
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v4
- uses: actions/labeler@v5
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"

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

@ -10,15 +10,12 @@ on:
- CONTRIBUTING.md
- CODING_STANDARDS.md
- .cirrus.yml
- .travis.yml
- travis/**
- .circleci/**
branches:
- PHP-7.4
- PHP-8.0
- PHP-8.1
- PHP-8.2
- PHP-8.3
- PHP-8.4
- master
pull_request:
paths-ignore:
@ -30,8 +27,6 @@ on:
- CONTRIBUTING.md
- CODING_STANDARDS.md
- .cirrus.yml
- .travis.yml
- travis/**
- .circleci/**
branches:
- '**'
@ -63,6 +58,15 @@ jobs:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: test
firebird:
image: jacobalberty/firebird
ports:
- 3050:3050
env:
ISC_PASSWORD: test
FIREBIRD_DATABASE: test.fdb
FIREBIRD_USER: test
FIREBIRD_PASSWORD: test
strategy:
fail-fast: false
matrix:
@ -74,10 +78,11 @@ jobs:
zts: true
asan: true
name: "LINUX_X64_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}${{ matrix.asan && '_ASAN' || '' }}"
runs-on: ubuntu-${{ !matrix.asan && '22' || '24' }}.04
runs-on: ubuntu-24.04
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
@ -91,9 +96,6 @@ jobs:
- name: Create MSSQL container
if: ${{ !matrix.asan }}
uses: ./.github/actions/setup-mssql
- name: Create Oracle container
if: ${{ !matrix.asan }}
uses: ./.github/actions/setup-oracle
- name: Setup Caddy server
uses: ./.github/actions/setup-caddy
- name: ccache
@ -111,7 +113,7 @@ jobs:
configurationParameters: >-
--${{ matrix.debug && 'enable' || 'disable' }}-debug
--${{ matrix.zts && 'enable' || 'disable' }}-zts
${{ matrix.asan && 'CFLAGS="-fsanitize=undefined,address -fno-sanitize=function -DZEND_TRACK_ARENA_ALLOC" LDFLAGS="-fsanitize=undefined,address -fno-sanitize=function" CC=clang CXX=clang++ --disable-opcache-jit' || '' }}
${{ matrix.asan && 'CFLAGS="-fsanitize=undefined,address -fno-sanitize=function -DZEND_TRACK_ARENA_ALLOC" LDFLAGS="-fsanitize=undefined,address -fno-sanitize=function" CC=clang CXX=clang++' || '' }}
skipSlow: ${{ matrix.asan }}
- name: make
run: make -j$(/usr/bin/nproc) >/dev/null
@ -123,12 +125,11 @@ jobs:
- name: Test
if: matrix.asan == false
uses: ./.github/actions/test-linux
- name: Test ${{ matrix.asan && 'OpCache' || 'Tracing JIT' }}
- name: Test Tracing JIT
uses: ./.github/actions/test-linux
with:
jitType: ${{ matrix.asan && 'disable' || 'tracing' }}
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
@ -138,12 +139,14 @@ jobs:
if: github.repository == 'php/php-src' || github.event_name == 'pull_request'
name: LINUX_X32_DEBUG_ZTS
runs-on: ubuntu-latest
timeout-minutes: 50
container:
image: ubuntu:22.04
image: ubuntu:24.04
env:
MYSQL_TEST_HOST: mysql
PDO_MYSQL_TEST_DSN: mysql:host=mysql;dbname=test
PDO_MYSQL_TEST_HOST: mysql
PDO_FIREBIRD_TEST_DSN: firebird:dbname=firebird:test.fdb
services:
mysql:
image: mysql:8.3
@ -152,9 +155,18 @@ jobs:
env:
MYSQL_DATABASE: test
MYSQL_ROOT_PASSWORD: root
firebird:
image: jacobalberty/firebird
ports:
- 3050:3050
env:
ISC_PASSWORD: test
FIREBIRD_DATABASE: test.fdb
FIREBIRD_USER: test
FIREBIRD_PASSWORD: test
steps:
- name: git checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: apt
uses: ./.github/actions/apt-x32
- name: ccache
@ -177,20 +189,27 @@ 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'
runs-on: macos-13
strategy:
fail-fast: false
matrix:
include:
- 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
uses: hendrikmuhs/ccache-action@v1.2
with:
key: "${{github.job}}-${{hashFiles('main/php_version.h')}}"
key: "${{github.job}}-${{matrix.os}}-${{hashFiles('main/php_version.h')}}"
append-timestamp: false
save: ${{ github.event_name != 'pull_request' }}
- name: ./configure
@ -199,7 +218,7 @@ jobs:
configurationParameters: --enable-debug --disable-zts
- name: make
run: |-
export PATH="/usr/local/opt/bison/bin:$PATH"
export PATH="$(brew --prefix)/opt/bison/bin:$PATH"
make -j$(sysctl -n hw.logicalcpu) >/dev/null
- name: make install
run: sudo make install
@ -208,21 +227,20 @@ jobs:
with:
jitType: tracing
runTestsParameters: >-
-d zend_extension=opcache.so
-d opcache.enable_cli=1
-d opcache.protect_memory=1
- name: Verify generated files are up to date
uses: ./.github/actions/verify-generated-files
WINDOWS:
if: github.repository == 'php/php-src' || github.event_name == 'pull_request'
name: WINDOWS_X64_ZTS
runs-on: windows-2022
timeout-minutes: 50
env:
PHP_BUILD_CACHE_BASE_DIR: C:\build-cache
PHP_BUILD_OBJ_DIR: C:\obj
PHP_BUILD_CACHE_SDK_DIR: C:\build-cache\sdk
PHP_BUILD_SDK_BRANCH: php-sdk-2.3.0
PHP_BUILD_CRT: vs16
PHP_BUILD_CRT: vs17
PLATFORM: x64
THREAD_SAFE: "1"
INTRINSICS: AVX2
@ -232,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
@ -242,12 +260,17 @@ jobs:
BENCHMARKING:
name: BENCHMARKING
if: github.repository == 'php/php-src' || github.event_name == 'pull_request'
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
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
# and other operations, so we disable it during benchmarking.
- name: Disable ASLR
run: echo 0 | sudo tee /proc/sys/kernel/randomize_va_space
- name: apt
run: |
set -x
@ -273,7 +296,6 @@ jobs:
./configure \
--disable-debug \
--enable-mbstring \
--enable-opcache \
--enable-option-checking=fatal \
--enable-sockets \
--enable-werror \
@ -293,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
@ -305,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 }}
@ -336,12 +357,18 @@ jobs:
${{ github.sha }} \
$(git merge-base ${{ github.event.pull_request.base.sha }} ${{ github.sha }}) \
> $GITHUB_STEP_SUMMARY
- uses: actions/upload-artifact@v4
with:
name: profiles
path: ${{ github.workspace }}/benchmark/profiles
retention-days: 30
FREEBSD:
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

@ -0,0 +1,300 @@
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' || 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
sudo apt-get update
sudo apt-get install gpg
wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
gpg --no-default-keyring --keyring /usr/share/keyrings/hashicorp-archive-keyring.gpg --fingerprint
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update -y
sudo apt-get install -y terraform=1.5.7-*
- name: Checkout benchmark suite
uses: actions/checkout@v5
with:
repository: 'kocsismate/php-version-benchmarks'
ref: 'main'
fetch-depth: 1
path: 'php-version-benchmarks'
- name: Checkout php-src (benchmarked version)
uses: actions/checkout@v5
with:
repository: '${{ env.REPOSITORY }}'
ref: '${{ env.COMMIT }}'
fetch-depth: 100
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
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: Setup infra config
run: |
set -e
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
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_${{ env.ID }}/ && git --no-pager log --until="$YESTERDAY" -n 1 --pretty='%H')"
fi
cat << EOF > ./php-version-benchmarks/config/php/previous.ini
PHP_NAME="PHP - previous ${{ env.BRANCH }}"
PHP_ID=php_previous
PHP_REPO=https://github.com/${{ env.REPOSITORY }}.git
PHP_BRANCH=${{ env.BRANCH }}
PHP_COMMIT=$LAST_RESULT_SHA
PHP_OPCACHE=1
PHP_JIT=0
EOF
- name: Setup PHP config - benchmarked PHP version
run: |
set -e
cat << EOF > ./php-version-benchmarks/config/php/this.ini
PHP_NAME="PHP - ${{ env.BRANCH }}"
PHP_ID=php_${{ env.ID }}
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
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
cp ./php-version-benchmarks/config/test/5_bench.php.ini.dist ./php-version-benchmarks/config/test/5_bench.php.ini
cp ./php-version-benchmarks/config/test/6_micro_bench.php.ini.dist ./php-version-benchmarks/config/test/6_micro_bench.php.ini
- 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
cd ./php-version-benchmarks/docs/results
git pull --autostash
if [ -e ".git/MERGE_HEAD" ]; then
echo "Merging, can't proceed"
exit 1
fi
git add .
if git diff --cached --quiet; then
exit 1
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: |
set -ex
rm -rf ./php-version-benchmarks/tmp/
rm -f ./php-version-benchmarks/build/infrastructure/config/*.tfvars
rm -rf ./php-version-benchmarks/build/infrastructure/aws/.terraform/
rm -f ./php-version-benchmarks/build/infrastructure/aws/.terraform.lock.hcl
rm -f ./php-version-benchmarks/build/infrastructure/aws/aws.tfplan
rm -f ./php-version-benchmarks/build/infrastructure/aws/terraform.tfstate
rm -f ./php-version-benchmarks/build/infrastructure/aws/terraform.tfstate.backup
rm -f ./php-version-benchmarks/config/infra/aws/*.ini

View file

@ -10,7 +10,7 @@ permissions:
jobs:
build:
if: "github.repository_owner == 'php' && contains(github.event.issue.labels.*.name, 'Status: Needs Feedback') && github.event.issue.user.login == github.event.sender.login"
if: "github.repository == 'php/php-src' && contains(github.event.issue.labels.*.name, 'Status: Needs Feedback') && github.event.issue.user.login == github.event.sender.login"
runs-on: ubuntu-latest
permissions:
issues: write

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

21
.gitignore vendored
View file

@ -81,8 +81,7 @@ Makefile
Makefile.fragments
Makefile.objects
# Directories for shared object files and headers generated by `./configure`
include/
# Directories for shared object files generated by `./configure`
libs/
modules/
@ -132,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
@ -141,7 +141,7 @@ php
# ------------------------------------------------------------------------------
/ext/json/json_scanner.c
/ext/json/php_json_scanner_defs.h
/ext/pdo/pdo_sql_parser.c
/ext/pdo*/*_sql_parser.c
/ext/phar/phar_path_check.c
/ext/standard/url_scanner_ex.c
/ext/standard/var_unserializer.c
@ -171,6 +171,7 @@ php
# ------------------------------------------------------------------------------
# Miscellaneous extensions files
/ext/fileinfo/libmagic.orig/
/ext/opcache/jit/zend_jit_x86.c
/ext/opcache/jit/zend_jit_arm64.c
/ext/opcache/minilua
@ -237,6 +238,7 @@ php
**/tests/**/*.exp
**/tests/**/*.log
**/tests/**/*.sh
**/tests/**/*.stdin
# Generated by some test cases
**/tests/**/*.db
@ -260,7 +262,7 @@ phpt.*
tmp-php.ini
# ------------------------------------------------------------------------------
# Generated by GCC's gcov and LCOV via build/Makefile.gcov and gcov.php.net
# Generated by GCC's gcov and LCOV via build/Makefile.gcov
# ------------------------------------------------------------------------------
*.gcda
*.gcno
@ -272,6 +274,7 @@ tmp-php.ini
# ------------------------------------------------------------------------------
# Archives generated during the PHP release process
# ------------------------------------------------------------------------------
/*.manifest
/*.tar.gz
/*.tar.bz2
/*.tar.xz
@ -282,8 +285,6 @@ tmp-php.ini
# ------------------------------------------------------------------------------
# Generated by `./configure --enable-dtrace` for using DTrace framework
# ------------------------------------------------------------------------------
/ext/oci8/oci8_dtrace_gen.h
/ext/oci8/oci8_dtrace_gen.h.bak
/Zend/zend_dtrace_gen.h
/Zend/zend_dtrace_gen.h.bak
@ -294,6 +295,13 @@ tmp-php.ini
/junit.out.xml
/.ccache/
# ------------------------------------------------------------------------------
# Editor configuration directories
# ------------------------------------------------------------------------------
/.idea/
/.vscode/
/.zed/
# ------------------------------------------------------------------------------
# Additional test build files
# ------------------------------------------------------------------------------
@ -306,5 +314,6 @@ tmp-php.ini
!/ext/fileinfo/libmagic/config.h
!/ext/fileinfo/libmagic.patch
!/ext/fileinfo/magicdata.patch
!/ext/lexbor/patches/*.patch
!/ext/pcre/pcre2lib/config.h
!/win32/build/Makefile

View file

@ -1,92 +0,0 @@
git:
quiet: true
dist: focal
language: c
os: linux
addons:
apt:
packages:
- locales
- language-pack-de
- re2c
- ccache
- mysql-server
- libaspell-dev
- libbz2-dev
- libcurl4-gnutls-dev
- libenchant-dev
- libfreetype6-dev
- libgmp-dev
- libicu-dev
- libjpeg-dev
- libkrb5-dev
- libonig-dev
- libpng-dev
- libpq-dev
- libpspell-dev
- libsasl2-dev
- libsqlite3-dev
- libsodium-dev
- libtidy-dev
- libwebp-dev
- libxml2-dev
- libxpm-dev
- libxslt1-dev
- libzip-dev
services:
- mysql
- postgresql
notifications:
email:
on_failure: change
irc:
template:
- "%{repository}#%{build_number} (%{branch} - %{commit} : %{author}): %{message} - Change view : %{compare_url} - Build details : %{build_url}"
channels:
- "irc.efnet.org#php.pecl"
on_success: change
on_failure: always
cache:
apt: true
ccache: true
env:
global:
- MYSQL_TEST_HOST=127.0.0.1
- MYSQL_TEST_USER=travis
- PDO_MYSQL_TEST_DSN="mysql:host=127.0.0.1;dbname=test"
- PDO_MYSQL_TEST_USER=travis
- PDO_MYSQL_TEST_PASS=
- PDO_MYSQL_TEST_HOST=127.0.0.1
- PDO_PGSQL_TEST_DSN="pgsql:host=localhost port=5432 dbname=test user=postgres password="
- REPORT_EXIT_STATUS=1
jobs:
include:
- env: ENABLE_ZTS=1 ENABLE_DEBUG=1 S390X=1
arch: s390x
before_script:
- ccache --version
- ccache --zero-stats
- export USE_CCACHE=1
# Enable IPv6
- sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6'
# Compile PHP
- travis_wait ./travis/compile.sh
# Setup Extensions
- ./travis/setup-mysql.sh
- ./travis/setup-pgsql.sh
# Run PHPs run-tests.php
script:
- ./travis/test.sh -d opcache.jit_buffer_size=16M -d opcache.jit=tracing
- sapi/cli/php -d extension_dir=`pwd`/modules -r 'dl("zend_test");'
after_success:
- ccache --show-stats

View file

@ -9,9 +9,10 @@ rewritten to comply with these rules.
1. Document your code in source files and the manual. (tm)
1. PHP is implemented in C99. The optional fixed-width integers from
1. PHP is implemented in C11.
For instance, the optional fixed-width integers from
stdint.h (int8_t, int16_t, int32_t, int64_t and their unsigned
counterparts) must be available.
counterparts) are supposed to be available.
1. Functions that are given pointers to resources should not free them.
@ -55,11 +56,6 @@ rewritten to comply with these rules.
the source. Although the `PHP_*` macros are mostly aliased to the `ZEND_*`
macros it gives a better understanding on what kind of macro you're calling.
1. When commenting out code using a `#if` statement, do NOT use `0` only.
Instead, use `"<git username here>_0"`. For example, `#if FOO_0`,
where `FOO` is your git user `foo`. This allows easier tracking of why
code was commented out, especially in bundled libraries.
1. Do not define functions that are not available. For instance, if a library is
missing a function, do not define the PHP version of the function, and do
not raise a run-time error about the function not existing. End users should
@ -152,62 +148,74 @@ rewritten to comply with these rules.
1. Method names follow the *studlyCaps* (also referred to as *bumpy case* or
*camel caps*) naming convention, with care taken to minimize the letter
count. The initial letter of the name is lowercase, and each letter that
starts a new `word` is capitalized:
Good:
```php
connect()
getData()
buildSomeWidget()
```
Bad:
```php
get_Data()
buildsomewidget()
getI()
```
starts a new "word" is capitalized.
1. Class names should be descriptive nouns in *PascalCase* and as short as
possible. Each word in the class name should start with a capital letter,
without underscore delimiters. The class name should be prefixed with the
name of the "parent set" (e.g. the name of the extension) if no namespaces
are used. Abbreviations and acronyms as well as initialisms should be
avoided wherever possible, unless they are much more widely used than the
long form (e.g. HTTP or URL). Abbreviations start with a capital letter
followed by lowercase letters, whereas acronyms and initialisms are written
according to their standard notation. Usage of acronyms and initialisms is
not allowed if they are not widely adopted and recognized as such.
are used.
Good:
1. Abbreviations and acronyms as well as initialisms should be avoided wherever
possible, unless they are much more widely used than the long form (e.g. HTTP
or URL). Abbreviations, acronyms, and initialisms should be treated like
regular words, thus they should be written with an uppercase first character,
followed by lowercase characters.
1. Diverging from this policy is allowed to keep internal consistency within a
single extension, if the name follows an established, language-agnostic
standard, or for other reasons, if those reasons are properly justified
and voted on as part of the RFC process.
Good method names:
```php
connect()
getData()
buildSomeWidget()
performHttpRequest()
```
Bad method names:
```php
get_Data()
buildsomewidget()
getI()
performHTTPRequest()
```
Good class names:
```php
Curl
CurlResponse
HTTPStatusCode
URL
BTreeMap // B-tree Map
Id // Identifier
ID // Identity Document
HttpStatusCode
Url
BtreeMap // B-tree Map
UserId // User Identifier
Char // Character
Intl // Internationalization
Radar // Radio Detecting and Ranging
Ssl\Certificate
Ssl\Crl // Certificate Revocation List
Ssl\CrlUrl
```
Bad:
Bad class names:
```php
curl
curl_response
HttpStatusCode
Url
BtreeMap
ID // Identifier
HTTPStatusCode
URL
BTreeMap
UserID // User Identifier
CHAR
INTL
RADAR // Radio Detecting and Ranging
SSL\Certificate
SSL\CRL
SSL\CRLURL
```
## Internal function naming conventions

View file

@ -32,6 +32,12 @@ had several contributions accepted, commit privileges are often quickly granted.
PHP welcomes pull requests to [add tests](#writing-tests), fix bugs and to
implement RFCs. Please be sure to include tests as appropriate!
By submitting a pull request, you certify that you have the necessary rights
to submit the work, that the work does not violate any third-party rights
(including those of your employer, if applicable), and that you license your
contribution under the PHP License or under another license if explicitly
accepted by the PHP project maintainers.
If you are fixing a bug, then please submit your PR against the lowest actively
supported branch of PHP that the bug affects (only green branches on
[the supported version page](https://www.php.net/supported-versions.php) are
@ -131,12 +137,8 @@ should be credited, the `Co-authored-by` tag in the commit message may be used.
## Writing documentation
There are two ways to contribute to the PHP manual. You can edit the manual and
send patches anonymously via [the online editor](https://edit.php.net/), or you
can check the XML source out from Subversion and edit that and build it
[per the instructions on the documentation site](http://doc.php.net/tutorial/).
Patches created that way should be sent to the
[documentation mailing list](mailto:phpdoc@lists.php.net).
Editing the manual is done by checking out the XML sources using Git and editing
and building it [per the instructions on the documentation site](http://doc.php.net/tutorial/).
## Getting help
@ -206,6 +208,9 @@ locations.
├─ libmbfl/ # Forked and maintained in php-src
├─ unicode_data.h # Generated by `ext/mbstring/ucgendat/ucgendat.php`
└─ ...
└─ opcache/
└─ jit/
└─ ir/ # Bundled part of IR framework https://github.com/dstogov/ir
└─ pcre/
├─ pcre2lib/ # https://www.pcre.org/
└─ ...
@ -239,7 +244,6 @@ locations.
└─ ...
├─ scripts/ # php-config, phpize and internal development scripts
├─ tests/ # Core features tests
├─ travis/ # Travis CI service files
└─ win32/ # Windows build system files
├─ cp_enc_map.c # Generated by `win32/cp_enc_map_gen.exe`
└─ ...
@ -352,10 +356,12 @@ Currently, we have the following branches in use:
| Branch | |
| --------- | --------- |
| master | Active development branch for PHP 8.3, which is open for backwards incompatible changes and major internal API changes. |
| PHP-8.2 | Is used to release the PHP 8.2.x series. This is a current stable version and is open for bugfixes only. |
| PHP-8.1 | Is used to release the PHP 8.1.x series. This is a current stable version and is open for bugfixes only. |
| PHP-8.0 | Is used to release the PHP 8.0.x series. This is an old stable version and is open for security fixes only. |
| master | Active development branch for PHP 8.5, which is open for backwards incompatible changes and major internal API changes. |
| PHP-8.4 | Is used to release the PHP 8.4.x series. This is a current stable version and is open for bugfixes only. |
| PHP-8.3 | Is used to release the PHP 8.3.x series. This is a current stable version and is open for bugfixes only. |
| PHP-8.2 | Is used to release the PHP 8.2.x series. This is an old stable version and is open for security fixes only. |
| PHP-8.1 | Is used to release the PHP 8.1.x series. This is an old stable version and is open for security fixes only. |
| PHP-8.0 | This branch is closed. |
| PHP-7.4 | This branch is closed. |
| PHP-7.3 | This branch is closed. |
| PHP-7.2 | This branch is closed. |

View file

@ -93,14 +93,9 @@ MAINTENANCE: Maintained
STATUS: Working
SINCE: 5.3
-------------------------------------------------------------------------------
EXTENSION: oci8
PRIMARY MAINTAINER: Christopher Jones <sixd@php.net> (2007 - 2017)
Antony Dovgal <tony2001@php.net> (2003 - 2009)
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: odbc
PRIMARY MAINTAINER: Daniel R. Kalowsky <kalowsky@php.net> (2000 - 2004)
Calvin Buckley <calvin@cmpct.info> (2024 - )
MAINTENANCE: Maintained
STATUS: Working
COMMENT: Working
@ -134,14 +129,8 @@ STATUS: Working
SINCE: 5.1
-------------------------------------------------------------------------------
EXTENSION: pdo_odbc
PRIMARY MAINTAINER: Unknown
MAINTENANCE: Odd fixes
STATUS: Working
SINCE: 5.1
-------------------------------------------------------------------------------
EXTENSION: pdo_oci
PRIMARY MAINTAINER: Christopher Jones <sixd@php.net> (2007 - 2017)
MAINTENANCE: Odd fixes
PRIMARY MAINTAINER: Calvin Buckley <calvin@cmpct.info> (2024 - )
MAINTENANCE: Maintained
STATUS: Working
SINCE: 5.1
-------------------------------------------------------------------------------
@ -206,6 +195,13 @@ PRIMARY MAINTAINER: Thies C. Arntzen <thies@thieso.net> (1999 - 2002)
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: lexbor
PRIMARY MAINTAINER: Niels Dossche <nielsdos@php.net> (2025 - 2025)
Mate Kocsis <kocsismate@php.net> (2025 - 2025)
MAINTENANCE: Maintained
STATUS: Working
SINCE: 8.5
-------------------------------------------------------------------------------
EXTENSION: libxml
PRIMARY MAINTAINER: Rob Richards <rrichards@php.net> (2003 - 2009)
Christian Stocker <chregu@php.net> (2004 - 2011)
@ -242,6 +238,7 @@ SINCE: 5.0
-------------------------------------------------------------------------------
EXTENSION: bcmath
PRIMARY MAINTAINER: Andi Gutmans <andi@php.net> (2000 - 2004)
Saki Takamachi <saki@php.net> (2024 - 2025)
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
@ -358,14 +355,6 @@ MAINTENANCE: Maintained
STATUS: Working
SINCE: 5.3
-------------------------------------------------------------------------------
EXTENSION: imap
PRIMARY MAINTAINER: Chuck Hagenbuch <chuck@horde.org> (1999 - 2004)
Ilia Alshanetsky <iliaa@php.net> (2002 - 2010)
Pierre-Alain Joye <pajoye@php.net> (2008 - 2010)
Bishop Bettini <bishop@php.net> (2018 - 2019)
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: json
PRIMARY MAINTAINER: Jakub Zelenka <bukka@php.net> (2014 - 2018)
MAINTENANCE: Maintained
@ -383,7 +372,8 @@ STATUS: Working
EXTENSION: mbstring
PRIMARY MAINTAINER: Rui Hirokawa <hirokawa@php.net> (2001 - 2013)
Nikita Popov <nikic@php.net> (2017 - 2020)
Alex Dowad <alexinbeijing@gmail.com> (2021 - 2022)
Alex Dowad <alexinbeijing@gmail.com> (2021 - 2024)
Yuya Hamada <youkidearitai@gmail.com> (2024 - 2024)
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
@ -428,15 +418,9 @@ PRIMARY MAINTAINER: Kristian Köhntopp <kris@koehntopp.de> (2000 - 2000)
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: pspell
PRIMARY MAINTAINER: Vlad Krupin <phpdevel@echospace.com> (2000 - 2004)
MAINTENANCE: Unknown
STATUS: Working
SINCE: 4.0.2
-------------------------------------------------------------------------------
EXTENSION: random
PRIMARY MAINTAINER Go Kudo <zeriyoshi@php.net> (2022 - 2022)
Tim Düsterhus <timwolla@php.net> (2022 - 2023)
PRIMARY MAINTAINER Go Kudo <zeriyoshi@php.net> (2022 - 2024)
Tim Düsterhus <timwolla@php.net> (2022 - 2025)
MAINTENANCE: Maintained
STATUS: Working
SINCE: 8.2.0
@ -450,6 +434,7 @@ EXTENSION: reflection
PRIMARY MAINTAINER: Marcus Börger <helly@php.net> (2003 - 2009)
Johannes Schlüter <johannes@php.net> (2006 - 2014)
Nikita Popov <nikic@php.net> (2019 - 2020)
Daniel Scherzer <daniel.e.scherzer@gmail.com> (2025 - 2025)
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
@ -519,6 +504,12 @@ PRIMARY MAINTAINER: Andrei Zmievski <andrei@php.net> (2002 - 2002)
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: uri
PRIMARY MAINTAINER Máté Kocsis <kocsismate@php.net> (2025 - 2025)
MAINTENANCE: Maintained
STATUS: Working
SINCE: 8.5.0
-------------------------------------------------------------------------------
EXTENSION: zip
PRIMARY MAINTAINER: Pierre-Alain Joye <pajoye@php.net> (2006 - 2011)
Remi Collet <remi@php.net> (2013-2020)

2526
NEWS

File diff suppressed because it is too large Load diff

View file

@ -17,7 +17,9 @@
17. ext/mbstring/ucgendat portions based on the ucgendat.c from the OpenLDAP
18. avifinfo (ext/standard/libavifinfo) see ext/standard/libavifinfo/LICENSE
19. xxHash (ext/hash/xxhash)
20. Lexbor (ext/lexbor/lexbor) see ext/lexbor/LICENSE
21. Portions of libcperciva (ext/hash/hash_sha_{ni,sse2}.c) see the header in the source file
22. uriparser (ext/uri/uriparser) see ext/uri/uriparser/COPYING
3. pcre2lib (ext/pcre)

View file

@ -1,5 +1,5 @@
<div align="center">
<a href="https://php.net">
<a href="https://www.php.net">
<img
alt="PHP"
src="https://www.php.net/images/logos/new-php-logo.svg"
@ -15,12 +15,11 @@ blog to the most popular websites in the world. PHP is distributed under the
[PHP License v3.01](LICENSE).
[![Push](https://github.com/php/php-src/actions/workflows/push.yml/badge.svg)](https://github.com/php/php-src/actions/workflows/push.yml)
[![Build status](https://travis-ci.com/php/php-src.svg?branch=master)](https://travis-ci.com/github/php/php-src)
[![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/php.svg)](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:php)
[![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/php.svg)](https://issues.oss-fuzz.com/issues?q=project:php)
## Documentation
The PHP manual is available at [php.net/docs](https://php.net/docs).
The PHP manual is available at [php.net/docs](https://www.php.net/docs).
## Installation
@ -32,7 +31,7 @@ For Windows, the PHP binaries can be obtained from
[windows.php.net](https://windows.php.net). After extracting the archive the
`*.exe` files are ready to use.
For other systems, see the [installation chapter](https://php.net/install).
For other systems, see the [installation chapter](https://www.php.net/install).
### Building PHP source code
@ -43,28 +42,50 @@ a default build, you will additionally need libxml2 and libsqlite3.
On Ubuntu, you can install these using:
sudo apt install -y pkg-config build-essential autoconf bison re2c \
libxml2-dev libsqlite3-dev
```shell
sudo apt install -y pkg-config build-essential autoconf bison re2c libxml2-dev libsqlite3-dev
```
On Fedora, you can install these using:
sudo dnf install re2c bison autoconf make libtool ccache libxml2-devel sqlite-devel
```shell
sudo dnf install re2c bison autoconf make libtool ccache libxml2-devel sqlite-devel
```
On MacOS, you can install these using `brew`:
```shell
brew install autoconf bison re2c iconv libxml2 sqlite
```
or with `MacPorts`:
```shell
sudo port install autoconf bison re2c libiconv libxml2 sqlite3
```
Generate configure:
./buildconf
```shell
./buildconf
```
Configure your build. `--enable-debug` is recommended for development, see
`./configure --help` for a full list of options.
# For development
./configure --enable-debug
# For production
./configure
```shell
# For development
./configure --enable-debug
# For production
./configure
```
Build PHP. To speed up the build, specify the maximum number of jobs using `-j`:
Build PHP. To speed up the build, specify the maximum number of jobs using the
`-j` argument:
make -j4
```shell
make -j4
```
The number of jobs should usually match the number of available cores, which
can be determined using `nproc`.
@ -75,13 +96,21 @@ PHP ships with an extensive test suite, the command `make test` is used after
successful compilation of the sources to run this test suite.
It is possible to run tests using multiple cores by setting `-jN` in
`TEST_PHP_ARGS`:
`TEST_PHP_ARGS` or `TESTS`:
make TEST_PHP_ARGS=-j4 test
```shell
make TEST_PHP_ARGS=-j4 test
```
Shall run `make test` with a maximum of 4 concurrent jobs: Generally the maximum
number of jobs should not exceed the number of cores available.
Use the `TEST_PHP_ARGS` or `TESTS` variable to test only specific directories:
```shell
make TESTS=tests/lang/ test
```
The [qa.php.net](https://qa.php.net) site provides more detailed info about
testing and quality assurance.
@ -89,9 +118,11 @@ testing and quality assurance.
After a successful build (and test), PHP may be installed with:
make install
```shell
make install
```
Depending on your permissions and prefix, `make install` may need super user
Depending on your permissions and prefix, `make install` may need superuser
permissions.
## PHP extensions
@ -131,10 +162,11 @@ contribute:
- [Contributing to PHP](/CONTRIBUTING.md)
- [PHP coding standards](/CODING_STANDARDS.md)
- [Internal documentation](https://php.github.io/php-src/)
- [Mailing list rules](/docs/mailinglist-rules.md)
- [PHP release process](/docs/release-process.md)
## Credits
For the list of people who've put work into PHP, please see the
[PHP credits page](https://php.net/credits.php).
[PHP credits page](https://www.php.net/credits.php).

View file

@ -576,6 +576,27 @@ void ts_free_id(ts_rsrc_id id)
TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Successfully freed resource id %d", id));
}/*}}}*/
TSRM_API void ts_apply_for_id(ts_rsrc_id id, void (*cb)(void *))
{
int rsrc_id = TSRM_UNSHUFFLE_RSRC_ID(id);
tsrm_mutex_lock(tsmm_mutex);
if (tsrm_tls_table && resource_types_table) {
for (int i = 0; i < tsrm_tls_table_size; i++) {
tsrm_tls_entry *p = tsrm_tls_table[i];
while (p) {
if (p->count > rsrc_id && p->storage[rsrc_id]) {
cb(p->storage[rsrc_id]);
}
p = p->next;
}
}
}
tsrm_mutex_unlock(tsmm_mutex);
}
/*
* Utility Functions
@ -756,14 +777,16 @@ TSRM_API size_t tsrm_get_ls_cache_tcb_offset(void)
// TODO: Implement support for fast JIT ZTS code ???
return 0;
#elif defined(__x86_64__) && defined(__GNUC__) && !defined(__FreeBSD__) && \
!defined(__OpenBSD__) && !defined(__MUSL__) && !defined(__HAIKU__)
!defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(__MUSL__) && \
!defined(__HAIKU__) && !defined(__CYGWIN__)
size_t ret;
asm ("movq _tsrm_ls_cache@gottpoff(%%rip),%0"
: "=r" (ret));
return ret;
#elif defined(__i386__) && defined(__GNUC__) && !defined(__FreeBSD__) && \
!defined(__OpenBSD__) && !defined(__MUSL__) && !defined(__HAIKU__)
!defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(__MUSL__) && \
!defined(__HAIKU__) && !defined(__CYGWIN__)
size_t ret;
asm ("leal _tsrm_ls_cache@ntpoff,%0"

View file

@ -13,11 +13,11 @@
#ifndef TSRM_H
#define TSRM_H
#if !defined(__CYGWIN__) && defined(WIN32)
#if !defined(__CYGWIN__) && defined(_WIN32)
# define TSRM_WIN32
# include "Zend/zend_config.w32.h"
# include <Zend/zend_config.w32.h>
#else
# include "main/php_config.h"
# include <main/php_config.h>
#endif
#include <stdint.h>
@ -104,6 +104,9 @@ TSRM_API void ts_free_thread(void);
/* deallocates all occurrences of a given id */
TSRM_API void ts_free_id(ts_rsrc_id id);
/* Runs a callback on all resources of the given id.
* The caller is responsible for ensuring the underlying resources don't data-race. */
TSRM_API void ts_apply_for_id(ts_rsrc_id id, void (*cb)(void *));
/* Debug support */
#define TSRM_ERROR_LEVEL_ERROR 1
@ -149,7 +152,7 @@ TSRM_API bool tsrm_is_managed_thread(void);
# define __has_attribute(x) 0
#endif
#if !__has_attribute(tls_model) || defined(__FreeBSD__) || defined(__MUSL__) || defined(__HAIKU__)
#if !__has_attribute(tls_model) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__MUSL__) || defined(__HAIKU__)
# define TSRM_TLS_MODEL_ATTR
# define TSRM_TLS_MODEL_DEFAULT
#elif __PIC__

View file

@ -31,12 +31,6 @@ dnl
dnl Set some magic defines to achieve POSIX threads conformance.
dnl
AC_DEFUN([PTHREADS_FLAGS],[
if test -z "$host_alias" && test -n "$host"; then
host_alias=$host
fi
if test -z "$host_alias"; then
AC_MSG_ERROR(host_alias is not set. Make sure to run config.guess)
fi
case $host_alias in
*solaris*)
PTHREAD_FLAGS="-D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT";;
@ -46,8 +40,6 @@ AC_DEFUN([PTHREADS_FLAGS],[
PTHREAD_FLAGS=-D_REENTRANT;;
*aix*)
PTHREAD_FLAGS=-D_THREAD_SAFE;;
*irix*)
PTHREAD_FLAGS=-D_POSIX_THREAD_SAFE_FUNCTIONS;;
*hpux*)
PTHREAD_FLAGS=-D_REENTRANT;;
*sco*)
@ -134,7 +126,7 @@ if test "$pthreads_working" != "yes"; then
fi
])
if test "x$ac_cv_pthreads_cflags" != "x" -o "x$ac_cv_pthreads_lib" != "x"; then
if test "x$ac_cv_pthreads_cflags" != "x" || test "x$ac_cv_pthreads_lib" != "x"; then
pthreads_working="yes"
fi
])

View file

@ -1,17 +0,0 @@
dnl This file contains TSRM specific autoconf macros.
dnl
dnl TSRM_CHECK_PTHREADS
dnl
AC_DEFUN([TSRM_CHECK_PTHREADS],[
PTHREADS_CHECK
if test "$pthreads_working" != "yes"; then
AC_MSG_ERROR(Your system seems to lack POSIX threads.)
fi
AC_DEFINE(PTHREADS, 1, Whether to use Pthreads)
AC_MSG_CHECKING(for POSIX threads)
AC_MSG_RESULT(yes)
])

View file

@ -481,12 +481,13 @@ TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd,
return NULL;
}
cmd = (char*)malloc(strlen(command)+strlen(TWG(comspec))+sizeof(" /s /c ")+2);
size_t cmd_buffer_size = strlen(command) + strlen(TWG(comspec)) + sizeof(" /s /c ") + 2;
cmd = malloc(cmd_buffer_size);
if (!cmd) {
return NULL;
}
sprintf(cmd, "%s /s /c \"%s\"", TWG(comspec), command);
snprintf(cmd, cmd_buffer_size, "%s /s /c \"%s\"", TWG(comspec), command);
cmdw = php_win32_cp_any_to_w(cmd);
if (!cmdw) {
free(cmd);
@ -635,7 +636,7 @@ TSRM_API int shmget(key_t key, size_t size, int flags)
{/*{{{*/
shm_pair *shm;
char shm_segment[sizeof(SEGMENT_PREFIX INT_MIN_AS_STRING)];
HANDLE shm_handle = NULL, info_handle = NULL;
HANDLE shm_handle = NULL;
BOOL created = FALSE;
if (key != IPC_PRIVATE) {

1393
UPGRADING

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
PHP 8.3 INTERNALS UPGRADE NOTES
PHP 8.5 INTERNALS UPGRADE NOTES
1. Internal API changes
@ -14,157 +14,158 @@ PHP 8.3 INTERNALS UPGRADE NOTES
1. Internal API changes
========================
* zend_class_entry now possesses a default_object_handlers field, which
provides a default object handler when create_object() is not overriding it.
* Custom Fiber implementations have to initialize EG(stack_limit) and
EG(stack_base).
* EG(opline_before_exception) may now be null if the VM throws an exception
before executing any opline.
* Many C header files have been cleaned up and include dependencies
have been reduced. Many headers which used to be always included by
Zend headers (e.g. "errno.h") are no longer implied, and this may
break the build of third-party extensions which relied on this
implementation detail. Those extensions may need to add the missing
#include lines.
* Since version 8, PHP requires a C99 compiler. Configure-time checks
for C99 features have been removed and therefore macro definitions
from php_config.h have disappeared. Do not use those feature
macros.
* Internal class aliases created during request time can now exist in
the class table. zend_register_class_alias_ex() will not increase
the refcount for class aliases and the cleanup function takes this
into account.
* The return types of the following functions have been changed from
`bool` to `zend_result`:
- zend_fiber_init_context()
* The fast_add_function() has been removed, use add_function() that will
call the static inline add_function_fast() instead.
* The order of members of zend_op_array, zend_ssa_var, zend_ssa_var_info,
zend_executor_globals and php_core_globals have changed to improve
struct packing which reduces their size.
* Many calls to zend_assign_to_variable have been replaced with
zend_assign_to_variable_ex which allows delaying the releasing of the old
variable value. This avoids side-effects through destructors between the
assignment of the variable and the assignment to the result zval in the VM
(i.e. it may free the new value). See GH-10168 for details.
* The return types of the following functions were changed from int to
zend_result:
- open_file_for_scanning
- php_rfc1867_callback
- virtual_chdir
- zend_execute_scripts
- zend_get_module_started
- zend_handle_undef_args
- zend_list_delete
- zend_multibyte_parse_encoding_list
- zend_multibyte_set_internal_encoding
- zend_parse_ini_file
- zend_parse_ini_string
- zend_set_user_opcode_handler
- zend_ssa_inference
* Removed unused macros PHP_FNV1_32A_INIT and PHP_FNV1A_64_INIT. See GH-11114.
* ext/standard/hrtime.h was moved to Zend/zend_hrtime.h
* The prefix of the PHP_HRTIME_ macros was changed to ZEND_HRTIME_
* The HRTIME_AVAILABLE macro was renamed to ZEND_HRTIME_AVAILABLE
* The php_hrtime_current() function was renamed to zend_hrtime()
* _php_stream_dirent now has an extra d_type field that is used to store the
directory entry type. This can be used to avoid additional stat calls for
types when the type is already known.
* The misspelled ZEND_CGG_DIAGNOSTIC_IGNORED_(START|END) macros are deprecated.
Use ZEND_DIAGNOSTIC_IGNORED_(START|END) instead. These macros now also support
Clang.
- Core
. PG(arg_separator).input and PG(arg_separator).output are now `zend_string*`
instead of `char*`.
. DL_LOAD now doesn't use RTLD_DEEPBIND deepbind anymore on platforms
where dlmopen with LM_ID_NEWLM is available:
this means shared library symbol isolation (if needed) must be enabled on
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
a value to a non-reference zval.
. Added zval_ptr_safe_dtor() to safely destroy a zval when a destructor
could interfere.
. zend_get_callable_name() now returns the name of the underlying function
for fake closures.
. Added smart_string_append_printf() matching smart_str_append_printf() for
char* instead of zend_string*-based smart strings.
. Added php_build_provider() to retrieve the value of PHP_BUILD_PROVIDER at
runtime.
. Removed the cache_slot argument of zend_check_user_type_slow() because
now it only relies on the CE cache.
. Added ZEND_NONSTRING attribute macro for character arrays that do not
represent strings. This allows to silence the GCC 15.x
`-Wunterminated-string-initialization` warning.
. Added the zend_update_exception_properties() function for instantiating
Exception child classes. It updates the $message, $code, and $previous
properties.
. zend_exception_get_default() was removed, use zend_ce_exception directly.
. zend_get_error_exception() was removed, use zend_ce_error_exception
directly.
. ZEND_IS_XDIGIT() macro was removed because it was unused and its name
did not match its actual behavior.
. The following zend_string-related legacy aliases were removed:
* IS_INTERNED() - use ZSTR_IS_INTERNED()
* STR_EMPTY_ALLOC() - use ZSTR_EMPTY_ALLOC()
* _STR_HEADER_SIZE - use _ZSTR_HEADER_SIZE
* STR_ALLOCA_ALLOC() - use ZSTR_ALLOCA_ALLOC()
* STR_ALLOCA_INIT() - use ZSTR_ALLOCA_INIT()
* STR_ALLOCA_FREE() - use ZSTR_ALLOCA_FREE()
. zend_register_constant() now returns a pointer to the added constant
on success and NULL on failure instead of SUCCESS/FAILURE.
The specialized registration methods that previously had void returns
also return pointers to the added constants:
* zend_register_bool_constant()
* zend_register_null_constant()
* zend_register_long_constant()
* zend_register_double_constant()
* 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
========================
* PHP_EXTRA_VERSION can be passed to configure script to control custom PHP
build versions: ./configure PHP_EXTRA_VERSION="-acme"
- Abstract
. Preprocessor macro SIZEOF_PTRDIFF_T has been removed.
. Preprocessor macro SIZEOF_INTMAX_T has been removed.
* LDFLAGS are not unset anymore allowing them to be adjusted e.g.
LDFLAGS="..." ./configure
- Windows build system changes
. SAPI() and ADD_SOURCES() now support the optional `duplicate_sources`
parameter. If truthy, no rules to build the object files are generated.
This allows to build additional variants of SAPIs (e.g. a DLL and EXE)
without duplicate build rules. It is up to the SAPI maintainers to ensure
that appropriate build rules are created.
* Removed the HAVE_DEV_URANDOM compile time check. HAVE_DEV_URANDOM will
now never be defined. Any checks relying on HAVE_DEV_URANDOM should be
removed. Even with HAVE_DEV_URANDOM it was not guaranteed that
/dev/urandom is actually available at run time and thus a runtime
check needs to happen in all cases.
- Unix build system changes
. 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).
. Autoconf macro PHP_CHECK_SIZEOF is obsolete (use AC_CHECK_SIZEOF).
. Autoconf macro PHP_DEF_HAVE has been removed (use AC_DEFINE).
. Autoconf macro PHP_OUTPUT has been removed (use AC_CONFIG_FILES).
. Autoconf macro PHP_TEST_BUILD has been removed (use AC_* macros).
. Preprocessor macro HAVE_PTRDIFF_T has been removed.
. Preprocessor macro HAVE_INTMAX_T has been removed.
. Preprocessor macro HAVE_SSIZE_T has been removed.
. Preprocessor macro SIZEOF_SSIZE_T has been removed.
========================
3. Module changes
========================
a. ext/json
- A new function php_json_validate_ex has been added to check if the
provided C string is valid for the given depth and options.
- ext/gd
. The gdImageScale*() and gdImageRotate*() helpers are now internal in the
bundled libgd, like they have been in external libgd as of gd-2.1.1.
b. ext/standard
- The PHPAPI php_url_encode_hash_ex() function has had its signature change
from:
PHPAPI void php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
const char *num_prefix, size_t num_prefix_len,
const char *key_prefix, size_t key_prefix_len,
const char *key_suffix, size_t key_suffix_len,
zval *type, const char *arg_sep, int enc_type);
to:
PHPAPI void php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
const char *num_prefix, size_t num_prefix_len,
const zend_string *key_prefix,
zval *type, const zend_string *arg_sep, int enc_type);
The change to use zend_string prevent the computation of the arg_sep
length at each call. The key_suffix parameter was dropped as it was a
constant value and depended on the key_prefix parameter to not be NULL.
- ext/json
. php_json_encode_serializable_object() now assumes `EG(active)`,
if not a bailout is caused. Therefore a minor BC break exists if the
`PHP_JSON_PARTIAL_OUTPUT_ON_ERROR` option is in use.
However, this situation is highly unlikely.
c. ext/mysqlnd
- The function mysqlnd_shutdown and its corresponding internal methods
mysqlnd_command::shutdown & mysqlnd_conn_data::shutdown have been removed.
These functions are deprecated by MySQL in favour of SHUTDOWN SQL statement.
- ext/libxml
. The refcount APIs now return an `unsigned int` instead of an `int`.
. Removed php_libxml_xmlCheckUTF8(). Use xmlCheckUTF8() from libxml instead.
d. ext/pcre
- The function pcre_get_compiled_regex_ex has been removed.
Use pcre_get_compiled_regex instead.
- ext/pdo
. Added `php_pdo_stmt_valid_db_obj_handle()` to check if the database object
is still valid. This is useful when a GC cycle is collected and the
database object can be destroyed prior to destroying the statement.
e. ext/spl
- The PHPAPI spl_iterator_apply() function now returns zend_result instead of int.
There are no functional changes.
- The field _spl_filesystem_object->is_recursive has been removed.
f. ext/dom
- A new function dom_get_doc_props_read_only() is added to gather the document
properties in a read-only way. This function avoids allocation when there are
no document properties changed yet.
- The node list returned by DOMNode::getElementsByTagName() and
DOMNode::getElementsByTagNameNS() now caches the length and the last requested item.
This means that the length and the last requested item are not recalculated
when the node list is iterated over multiple times.
If you do not use the internal PHP dom APIs to modify the document, you need to
manually invalidate the cache using php_libxml_invalidate_node_list_cache_from_doc().
Furthermore, the following internal APIs were added to handle the cache:
. php_dom_is_cache_tag_stale_from_doc_ptr()
. php_dom_is_cache_tag_stale_from_node()
. php_dom_mark_cache_tag_up_to_date_from_node()
- The function dom_get_elements_by_tag_name_ns_raw() has an additional parameter to indicate
the base node of the node list. This function also no longer accepts -1 as the index argument.
- The function dom_namednode_iter() has additional arguments to avoid recomputing the length of
the strings.
- The functions dom_parent_node_prepend(), dom_parent_node_append(), dom_parent_node_after(), and
dom_parent_node_before() now use an uint32_t argument for the number of nodes instead of int.
- There is now a helper function php_dom_get_content_into_zval() to get the contents of a node.
This avoids allocation if possible.
- The function dom_set_old_ns() has been moved into ext/libxml as php_libxml_set_old_ns() and
is now publicly exposed as an API.
g. ext/libxml
- Two new functions: php_libxml_invalidate_node_list_cache_from_doc() and
php_libxml_invalidate_node_list_cache() were added to invalidate the cache of a node list.
- ext/standard
. Added php_url_decode_ex() and php_raw_url_decode_ex() that unlike their
non-ex counterparts do not work in-place.
. 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 that may execute in alternative stacks have to set EG(stack_limit) and
EG(stack_base)
- 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

@ -6,7 +6,7 @@ $(builddir)/zend_language_scanner.lo: $(srcdir)/zend_language_parser.h
$(builddir)/zend_ini_scanner.lo: $(srcdir)/zend_ini_parser.h
$(srcdir)/zend_language_scanner.c $(srcdir)/zend_language_scanner_defs.h: $(srcdir)/zend_language_scanner.l
@(cd $(top_srcdir); $(RE2C) $(RE2C_FLAGS) --no-generation-date --case-inverted -cbdFt Zend/zend_language_scanner_defs.h -oZend/zend_language_scanner.c Zend/zend_language_scanner.l)
@(cd $(top_srcdir); $(RE2C) $(RE2C_FLAGS) --case-inverted -cbdFt Zend/zend_language_scanner_defs.h -oZend/zend_language_scanner.c Zend/zend_language_scanner.l)
$(srcdir)/zend_language_parser.h: $(srcdir)/zend_language_parser.c
$(srcdir)/zend_language_parser.c: $(srcdir)/zend_language_parser.y
@ -23,10 +23,10 @@ $(srcdir)/zend_language_parser.c: $(srcdir)/zend_language_parser.y
$(srcdir)/zend_ini_parser.h: $(srcdir)/zend_ini_parser.c
$(srcdir)/zend_ini_parser.c: $(srcdir)/zend_ini_parser.y
$(YACC) $(YFLAGS) -v -d $(srcdir)/zend_ini_parser.y -o $@
@$(YACC) $(YFLAGS) -v -d $(srcdir)/zend_ini_parser.y -o $@
$(srcdir)/zend_ini_scanner.c: $(srcdir)/zend_ini_scanner.l
@(cd $(top_srcdir); $(RE2C) $(RE2C_FLAGS) --no-generation-date --case-inverted -cbdFt Zend/zend_ini_scanner_defs.h -oZend/zend_ini_scanner.c Zend/zend_ini_scanner.l)
@(cd $(top_srcdir); $(RE2C) $(RE2C_FLAGS) --case-inverted -cbdFt Zend/zend_ini_scanner_defs.h -oZend/zend_ini_scanner.c Zend/zend_ini_scanner.l)
# Use an intermediate target to indicate that zend_vm_gen.php produces both files
# at the same time, rather than the same recipe applying for two different targets.

View file

@ -274,7 +274,9 @@ static void zend_optimize_block(zend_basic_block *block, zend_op_array *op_array
* If it's not local, then the other blocks successors must also eventually either FREE or consume the temporary,
* hence removing the temporary is not safe in the general case, especially when other consumers are not FREE.
* A FREE may not be removed without also removing the source's result, because otherwise that would cause a memory leak. */
if (opline->op1_type == IS_TMP_VAR) {
if (opline->extended_value == ZEND_FREE_VOID_CAST) {
/* Keep the ZEND_FREE opcode alive. */
} else if (opline->op1_type == IS_TMP_VAR) {
src = VAR_SOURCE(opline->op1);
if (src) {
switch (src->opcode) {
@ -418,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:
@ -468,7 +478,67 @@ static void zend_optimize_block(zend_basic_block *block, zend_op_array *op_array
goto optimize_bool;
}
break;
case ZEND_IS_IDENTICAL:
if (opline->op1_type == IS_CONST &&
opline->op2_type == IS_CONST) {
goto optimize_constant_binary_op;
}
if (opline->op1_type == IS_CONST &&
(Z_TYPE(ZEND_OP1_LITERAL(opline)) <= IS_TRUE && Z_TYPE(ZEND_OP1_LITERAL(opline)) >= IS_NULL)) {
/* IS_IDENTICAL(TRUE, T) => TYPE_CHECK(T, TRUE)
* IS_IDENTICAL(FALSE, T) => TYPE_CHECK(T, FALSE)
* IS_IDENTICAL(NULL, T) => TYPE_CHECK(T, NULL)
*/
opline->opcode = ZEND_TYPE_CHECK;
opline->extended_value = (1 << Z_TYPE(ZEND_OP1_LITERAL(opline)));
COPY_NODE(opline->op1, opline->op2);
SET_UNUSED(opline->op2);
++(*opt_count);
goto optimize_type_check;
} else if (opline->op2_type == IS_CONST &&
(Z_TYPE(ZEND_OP2_LITERAL(opline)) <= IS_TRUE && Z_TYPE(ZEND_OP2_LITERAL(opline)) >= IS_NULL)) {
/* IS_IDENTICAL(T, TRUE) => TYPE_CHECK(T, TRUE)
* IS_IDENTICAL(T, FALSE) => TYPE_CHECK(T, FALSE)
* IS_IDENTICAL(T, NULL) => TYPE_CHECK(T, NULL)
*/
opline->opcode = ZEND_TYPE_CHECK;
opline->extended_value = (1 << Z_TYPE(ZEND_OP2_LITERAL(opline)));
SET_UNUSED(opline->op2);
++(*opt_count);
goto optimize_type_check;
}
break;
case ZEND_TYPE_CHECK:
optimize_type_check:
if (opline->extended_value == (1 << IS_TRUE) || opline->extended_value == (1 << IS_FALSE)) {
if (opline->op1_type == IS_TMP_VAR &&
!zend_bitset_in(used_ext, VAR_NUM(opline->op1.var))) {
src = VAR_SOURCE(opline->op1);
if (src) {
switch (src->opcode) {
case ZEND_BOOL:
case ZEND_BOOL_NOT:
/* T = BOOL(X) + TYPE_CHECK(T, TRUE) -> BOOL(X), NOP
* T = BOOL(X) + TYPE_CHECK(T, FALSE) -> BOOL_NOT(X), NOP
* T = BOOL_NOT(X) + TYPE_CHECK(T, TRUE) -> BOOL_NOT(X), NOP
* T = BOOL_NOT(X) + TYPE_CHECK(T, FALSE) -> BOOL(X), NOP
*/
src->opcode =
((src->opcode == ZEND_BOOL) == (opline->extended_value == (1 << IS_TRUE))) ?
ZEND_BOOL : ZEND_BOOL_NOT;
COPY_NODE(src->result, opline->result);
SET_VAR_SOURCE(src);
MAKE_NOP(opline);
++(*opt_count);
break;
}
}
}
}
break;
case ZEND_BOOL:
case ZEND_BOOL_NOT:
optimize_bool:
@ -801,7 +871,6 @@ static void zend_optimize_block(zend_basic_block *block, zend_op_array *op_array
case ZEND_SR:
case ZEND_IS_SMALLER:
case ZEND_IS_SMALLER_OR_EQUAL:
case ZEND_IS_IDENTICAL:
case ZEND_IS_NOT_IDENTICAL:
case ZEND_BOOL_XOR:
case ZEND_BW_OR:
@ -868,7 +937,6 @@ optimize_const_unary_op:
break;
case ZEND_RETURN:
case ZEND_EXIT:
if (opline->op1_type == IS_TMP_VAR) {
src = VAR_SOURCE(opline->op1);
if (src && src->opcode == ZEND_QM_ASSIGN) {
@ -1017,6 +1085,7 @@ static void assemble_code_blocks(zend_cfg *cfg, zend_op_array *op_array, zend_op
case ZEND_ASSERT_CHECK:
case ZEND_JMP_NULL:
case ZEND_BIND_INIT_STATIC_OR_JMP:
case ZEND_JMP_FRAMELESS:
ZEND_SET_OP_JMP_ADDR(opline, opline->op2, new_opcodes + blocks[b->successors[0]].start);
break;
case ZEND_CATCH:
@ -1220,8 +1289,7 @@ static void zend_jmp_optimization(zend_basic_block *block, zend_op_array *op_arr
target = op_array->opcodes + target_block->start;
if ((target->opcode == ZEND_RETURN ||
target->opcode == ZEND_RETURN_BY_REF ||
target->opcode == ZEND_GENERATOR_RETURN ||
target->opcode == ZEND_EXIT) &&
target->opcode == ZEND_GENERATOR_RETURN) &&
!(op_array->fn_flags & ZEND_ACC_HAS_FINALLY_BLOCK)) {
/* JMP L, L: RETURN to immediate RETURN */
*last_op = *target;

View file

@ -43,50 +43,6 @@ typedef struct _literal_info {
info[n].num_related = (related); \
} while (0)
static size_t type_num_classes(const zend_op_array *op_array, uint32_t arg_num)
{
zend_arg_info *arg_info;
if (arg_num > 0) {
if (!(op_array->fn_flags & ZEND_ACC_HAS_TYPE_HINTS)) {
return 0;
}
if (EXPECTED(arg_num <= op_array->num_args)) {
arg_info = &op_array->arg_info[arg_num-1];
} else if (UNEXPECTED(op_array->fn_flags & ZEND_ACC_VARIADIC)) {
arg_info = &op_array->arg_info[op_array->num_args];
} else {
return 0;
}
} else {
arg_info = op_array->arg_info - 1;
}
if (ZEND_TYPE_IS_COMPLEX(arg_info->type)) {
if (ZEND_TYPE_HAS_LIST(arg_info->type)) {
/* Intersection types cannot have nested list types */
if (ZEND_TYPE_IS_INTERSECTION(arg_info->type)) {
return ZEND_TYPE_LIST(arg_info->type)->num_types;
}
ZEND_ASSERT(ZEND_TYPE_IS_UNION(arg_info->type));
size_t count = 0;
zend_type *list_type;
ZEND_TYPE_LIST_FOREACH(ZEND_TYPE_LIST(arg_info->type), list_type) {
if (ZEND_TYPE_IS_INTERSECTION(*list_type)) {
count += ZEND_TYPE_LIST(*list_type)->num_types;
} else {
ZEND_ASSERT(!ZEND_TYPE_HAS_LIST(*list_type));
count += 1;
}
} ZEND_TYPE_LIST_FOREACH_END();
return count;
}
return 1;
}
return 0;
}
static uint32_t add_static_slot(HashTable *hash,
zend_op_array *op_array,
uint32_t op1,
@ -165,7 +121,7 @@ void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx
HashTable hash;
zend_string *key = NULL;
void *checkpoint = zend_arena_checkpoint(ctx->arena);
int *const_slot, *class_slot, *func_slot, *bind_var_slot, *property_slot, *method_slot;
int *const_slot, *class_slot, *func_slot, *bind_var_slot, *property_slot, *method_slot, *jmp_slot;
if (op_array->last_literal) {
info = (literal_info*)zend_arena_calloc(&ctx->arena, op_array->last_literal, sizeof(literal_info));
@ -175,6 +131,9 @@ void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx
end = opline + op_array->last;
while (opline < end) {
switch (opline->opcode) {
case ZEND_JMP_FRAMELESS:
LITERAL_INFO(opline->op1.constant, 1);
break;
case ZEND_INIT_FCALL_BY_NAME:
LITERAL_INFO(opline->op2.constant, 2);
break;
@ -197,6 +156,9 @@ void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx
LITERAL_INFO(opline->op2.constant, 2);
}
break;
case ZEND_INIT_PARENT_PROPERTY_HOOK_CALL:
LITERAL_INFO(opline->op1.constant, 1);
break;
case ZEND_CATCH:
LITERAL_INFO(opline->op1.constant, 2);
break;
@ -477,13 +439,14 @@ void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx
zend_hash_clean(&hash);
op_array->last_literal = j;
const_slot = zend_arena_alloc(&ctx->arena, j * 6 * sizeof(int));
memset(const_slot, -1, j * 6 * sizeof(int));
const_slot = zend_arena_alloc(&ctx->arena, j * 7 * sizeof(int));
memset(const_slot, -1, j * 7 * sizeof(int));
class_slot = const_slot + j;
func_slot = class_slot + j;
bind_var_slot = func_slot + j;
property_slot = bind_var_slot + j;
method_slot = property_slot + j;
jmp_slot = method_slot + j;
/* Update opcodes to use new literals table */
cache_size = zend_op_array_extension_handles * sizeof(void*);
@ -497,26 +460,6 @@ void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx
opline->op2.constant = map[opline->op2.constant];
}
switch (opline->opcode) {
case ZEND_RECV_INIT:
case ZEND_RECV:
case ZEND_RECV_VARIADIC:
{
size_t num_classes = type_num_classes(op_array, opline->op1.num);
if (num_classes) {
opline->extended_value = cache_size;
cache_size += num_classes * sizeof(void *);
}
break;
}
case ZEND_VERIFY_RETURN_TYPE:
{
size_t num_classes = type_num_classes(op_array, 0);
if (num_classes) {
opline->op2.num = cache_size;
cache_size += num_classes * sizeof(void *);
}
break;
}
case ZEND_ASSIGN_STATIC_PROP_OP:
if (opline->op1_type == IS_CONST) {
// op1 static property
@ -773,6 +716,16 @@ void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx
opline->extended_value = cache_size;
cache_size += sizeof(void *);
break;
case ZEND_JMP_FRAMELESS:
// op1 func
if (jmp_slot[opline->op1.constant] >= 0) {
opline->extended_value = jmp_slot[opline->op1.constant];
} else {
opline->extended_value = cache_size;
cache_size += sizeof(void *);
jmp_slot[opline->op1.constant] = opline->extended_value;
}
break;
case ZEND_SEND_VAL:
case ZEND_SEND_VAL_EX:
case ZEND_SEND_VAR:

View file

@ -80,7 +80,6 @@ static inline bool may_have_side_effects(
case ZEND_IS_IDENTICAL:
case ZEND_IS_NOT_IDENTICAL:
case ZEND_QM_ASSIGN:
case ZEND_FREE:
case ZEND_FE_FREE:
case ZEND_TYPE_CHECK:
case ZEND_DEFINED:
@ -127,6 +126,8 @@ static inline bool may_have_side_effects(
case ZEND_ARRAY_KEY_EXISTS:
/* No side effects */
return 0;
case ZEND_FREE:
return opline->extended_value == ZEND_FREE_VOID_CAST;
case ZEND_ADD_ARRAY_ELEMENT:
/* TODO: We can't free two vars. Keep instruction alive. <?php [0, "$a" => "$b"]; */
if ((opline->op1_type & (IS_VAR|IS_TMP_VAR)) && (opline->op2_type & (IS_VAR|IS_TMP_VAR))) {
@ -146,6 +147,7 @@ static inline bool may_have_side_effects(
case ZEND_ASSERT_CHECK:
case ZEND_JMP_NULL:
case ZEND_BIND_INIT_STATIC_OR_JMP:
case ZEND_JMP_FRAMELESS:
/* For our purposes a jumps and branches are side effects. */
return 1;
case ZEND_BEGIN_SILENCE:
@ -167,6 +169,10 @@ static inline bool may_have_side_effects(
case ZEND_DO_FCALL_BY_NAME:
case ZEND_DO_ICALL:
case ZEND_DO_UCALL:
case ZEND_FRAMELESS_ICALL_0:
case ZEND_FRAMELESS_ICALL_1:
case ZEND_FRAMELESS_ICALL_2:
case ZEND_FRAMELESS_ICALL_3:
/* For now assume all calls have side effects */
return 1;
case ZEND_RECV:

View file

@ -254,7 +254,7 @@ static void zend_ssa_remove_nops(zend_op_array *op_array, zend_ssa *ssa, zend_op
free_alloca(shiftlist, use_heap);
}
static bool safe_instanceof(zend_class_entry *ce1, zend_class_entry *ce2) {
static bool safe_instanceof(const zend_class_entry *ce1, const zend_class_entry *ce2) {
if (ce1 == ce2) {
return 1;
}
@ -267,9 +267,9 @@ static bool safe_instanceof(zend_class_entry *ce1, zend_class_entry *ce2) {
static inline bool can_elide_list_type(
const zend_script *script, const zend_op_array *op_array,
const zend_ssa_var_info *use_info, zend_type type)
const zend_ssa_var_info *use_info, const zend_type type)
{
zend_type *single_type;
const zend_type *single_type;
/* For intersection: result==false is failure, default is success.
* For union: result==true is success, default is failure. */
bool is_intersection = ZEND_TYPE_IS_INTERSECTION(type);
@ -280,7 +280,7 @@ static inline bool can_elide_list_type(
}
if (ZEND_TYPE_HAS_NAME(*single_type)) {
zend_string *lcname = zend_string_tolower(ZEND_TYPE_NAME(*single_type));
zend_class_entry *ce = zend_optimizer_get_class_entry(script, op_array, lcname);
const zend_class_entry *ce = zend_optimizer_get_class_entry(script, op_array, lcname);
zend_string_release(lcname);
bool result = ce && safe_instanceof(use_info->ce, ce);
if (result == !is_intersection) {
@ -325,6 +325,19 @@ static bool opline_supports_assign_contraction(
return 0;
}
/* Frameless calls override the return value, but the return value may overlap with the arguments. */
switch (opline->opcode) {
case ZEND_FRAMELESS_ICALL_3:
if ((opline + 1)->op1_type == IS_CV && (opline + 1)->op1.var == cv_var) return 0;
ZEND_FALLTHROUGH;
case ZEND_FRAMELESS_ICALL_2:
if (opline->op2_type == IS_CV && opline->op2.var == cv_var) return 0;
ZEND_FALLTHROUGH;
case ZEND_FRAMELESS_ICALL_1:
if (opline->op1_type == IS_CV && opline->op1.var == cv_var) return 0;
return 1;
}
if (opline->opcode == ZEND_DO_ICALL || opline->opcode == ZEND_DO_UCALL
|| opline->opcode == ZEND_DO_FCALL || opline->opcode == ZEND_DO_FCALL_BY_NAME) {
/* Function calls may dtor the return value after it has already been written -- allow
@ -394,40 +407,28 @@ int zend_dfa_optimize_calls(zend_op_array *op_array, zend_ssa *ssa)
zend_call_info *call_info = func_info->callee_info;
do {
if (call_info->caller_call_opline
&& call_info->caller_call_opline->opcode == ZEND_DO_ICALL
&& call_info->callee_func
&& zend_string_equals_literal(call_info->callee_func->common.function_name, "in_array")
&& (call_info->caller_init_opline->extended_value == 2
|| (call_info->caller_init_opline->extended_value == 3
&& (call_info->caller_call_opline - 1)->opcode == ZEND_SEND_VAL
&& (call_info->caller_call_opline - 1)->op1_type == IS_CONST))) {
zend_op *op = call_info->caller_init_opline;
if ((op->opcode == ZEND_FRAMELESS_ICALL_2
|| (op->opcode == ZEND_FRAMELESS_ICALL_3 && (op + 1)->op1_type == IS_CONST))
&& call_info->callee_func
&& zend_string_equals_literal_ci(call_info->callee_func->common.function_name, "in_array")) {
zend_op *send_array;
zend_op *send_needly;
bool strict = 0;
bool has_opdata = op->opcode == ZEND_FRAMELESS_ICALL_3;
ZEND_ASSERT(!call_info->is_prototype);
if (call_info->caller_init_opline->extended_value == 2) {
send_array = call_info->caller_call_opline - 1;
send_needly = call_info->caller_call_opline - 2;
} else {
if (zend_is_true(CT_CONSTANT_EX(op_array, (call_info->caller_call_opline - 1)->op1.constant))) {
if (has_opdata) {
if (zend_is_true(CT_CONSTANT_EX(op_array, (op + 1)->op1.constant))) {
strict = 1;
}
send_array = call_info->caller_call_opline - 2;
send_needly = call_info->caller_call_opline - 3;
}
if (send_array->opcode == ZEND_SEND_VAL
&& send_array->op1_type == IS_CONST
&& Z_TYPE_P(CT_CONSTANT_EX(op_array, send_array->op1.constant)) == IS_ARRAY
&& (send_needly->opcode == ZEND_SEND_VAL
|| send_needly->opcode == ZEND_SEND_VAR)
) {
if (op->op2_type == IS_CONST
&& Z_TYPE_P(CT_CONSTANT_EX(op_array, op->op2.constant)) == IS_ARRAY) {
bool ok = 1;
HashTable *src = Z_ARRVAL_P(CT_CONSTANT_EX(op_array, send_array->op1.constant));
HashTable *src = Z_ARRVAL_P(CT_CONSTANT_EX(op_array, op->op2.constant));
HashTable *dst;
zval *val, tmp;
zend_ulong idx;
@ -458,59 +459,15 @@ int zend_dfa_optimize_calls(zend_op_array *op_array, zend_ssa *ssa)
}
if (ok) {
uint32_t op_num = send_needly - op_array->opcodes;
zend_ssa_op *ssa_op = ssa->ops + op_num;
if (ssa_op->op1_use >= 0) {
/* Reconstruct SSA */
int var_num = ssa_op->op1_use;
zend_ssa_var *var = ssa->vars + var_num;
ZEND_ASSERT(ssa_op->op1_def < 0);
zend_ssa_unlink_use_chain(ssa, op_num, ssa_op->op1_use);
ssa_op->op1_use = -1;
ssa_op->op1_use_chain = -1;
op_num = call_info->caller_call_opline - op_array->opcodes;
ssa_op = ssa->ops + op_num;
ssa_op->op1_use = var_num;
ssa_op->op1_use_chain = var->use_chain;
var->use_chain = op_num;
}
ZVAL_ARR(&tmp, dst);
/* Update opcode */
call_info->caller_call_opline->opcode = ZEND_IN_ARRAY;
call_info->caller_call_opline->extended_value = strict;
call_info->caller_call_opline->op1_type = send_needly->op1_type;
call_info->caller_call_opline->op1.num = send_needly->op1.num;
call_info->caller_call_opline->op2_type = IS_CONST;
call_info->caller_call_opline->op2.constant = zend_optimizer_add_literal(op_array, &tmp);
if (call_info->caller_init_opline->extended_value == 3) {
MAKE_NOP(call_info->caller_call_opline - 1);
}
MAKE_NOP(call_info->caller_init_opline);
MAKE_NOP(send_needly);
MAKE_NOP(send_array);
removed_ops++;
op_num = call_info->caller_call_opline - op_array->opcodes;
ssa_op = ssa->ops + op_num;
if (ssa_op->result_def >= 0) {
int var = ssa_op->result_def;
int use = ssa->vars[var].use_chain;
/* If the result is used only in a JMPZ/JMPNZ, replace result type with
* IS_TMP_VAR, which will enable use of smart branches. Don't do this
* in other cases, as not all opcodes support both VAR and TMP. */
if (ssa->vars[var].phi_use_chain == NULL
&& ssa->ops[use].op1_use == var
&& ssa->ops[use].op1_use_chain == -1
&& (op_array->opcodes[use].opcode == ZEND_JMPZ
|| op_array->opcodes[use].opcode == ZEND_JMPNZ)) {
call_info->caller_call_opline->result_type = IS_TMP_VAR;
op_array->opcodes[use].op1_type = IS_TMP_VAR;
}
op->opcode = ZEND_IN_ARRAY;
op->extended_value = strict;
op->op2.constant = zend_optimizer_add_literal(op_array, &tmp);
if (has_opdata) {
MAKE_NOP(op + 1);
removed_ops++;
}
}
}
@ -653,6 +610,7 @@ static void zend_ssa_replace_control_link(zend_op_array *op_array, zend_ssa *ssa
case ZEND_ASSERT_CHECK:
case ZEND_JMP_NULL:
case ZEND_BIND_INIT_STATIC_OR_JMP:
case ZEND_JMP_FRAMELESS:
if (ZEND_OP2_JMP_ADDR(opline) == op_array->opcodes + old->start) {
ZEND_SET_OP_JMP_ADDR(opline, opline->op2, op_array->opcodes + dst->start);
}
@ -1007,7 +965,7 @@ optimize_nop:
static bool zend_dfa_try_to_replace_result(zend_op_array *op_array, zend_ssa *ssa, int def, int cv_var)
{
int result_var = ssa->ops[def].result_def;
int cv = EX_NUM_TO_VAR(ssa->vars[cv_var].var);
uint32_t cv = EX_NUM_TO_VAR(ssa->vars[cv_var].var);
if (result_var >= 0
&& !(ssa->var_info[cv_var].type & MAY_BE_REF)

View file

@ -48,6 +48,7 @@ static void zend_delete_call_instructions(zend_op_array *op_array, zend_op *opli
case ZEND_INIT_STATIC_METHOD_CALL:
case ZEND_INIT_METHOD_CALL:
case ZEND_INIT_FCALL:
case ZEND_INIT_PARENT_PROPERTY_HOOK_CALL:
if (call == 0) {
MAKE_NOP(opline);
return;
@ -77,8 +78,10 @@ static void zend_delete_call_instructions(zend_op_array *op_array, zend_op *opli
static void zend_try_inline_call(zend_op_array *op_array, zend_op *fcall, zend_op *opline, zend_function *func)
{
const uint32_t no_discard = RETURN_VALUE_USED(opline) ? 0 : ZEND_ACC_NODISCARD;
if (func->type == ZEND_USER_FUNCTION
&& !(func->op_array.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_HAS_TYPE_HINTS))
&& !(func->op_array.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_HAS_TYPE_HINTS|ZEND_ACC_DEPRECATED|no_discard))
/* TODO: function copied from trait may be inconsistent ??? */
&& !(func->op_array.fn_flags & (ZEND_ACC_TRAIT_CLONE))
&& fcall->extended_value >= func->op_array.required_num_args
@ -169,12 +172,15 @@ void zend_optimize_func_calls(zend_op_array *op_array, zend_optimizer_ctx *ctx)
case ZEND_INIT_METHOD_CALL:
case ZEND_INIT_FCALL:
case ZEND_NEW:
case ZEND_INIT_PARENT_PROPERTY_HOOK_CALL:
/* The argument passing optimizations are valid for prototypes as well,
* as inheritance cannot change between ref <-> non-ref arguments. */
call_stack[call].func = zend_optimizer_get_called_func(
ctx->script, op_array, opline, &call_stack[call].is_prototype);
call_stack[call].try_inline =
!call_stack[call].is_prototype && opline->opcode != ZEND_NEW;
!call_stack[call].is_prototype
&& opline->opcode != ZEND_NEW
&& opline->opcode != ZEND_INIT_PARENT_PROPERTY_HOOK_CALL;
ZEND_FALLTHROUGH;
case ZEND_INIT_DYNAMIC_CALL:
case ZEND_INIT_USER_CALL:
@ -198,26 +204,31 @@ void zend_optimize_func_calls(zend_op_array *op_array, zend_optimizer_ctx *ctx)
fcall->op1.num = zend_vm_calc_used_stack(fcall->extended_value, call_stack[call].func);
literal_dtor(&ZEND_OP2_LITERAL(fcall));
fcall->op2.constant = fcall->op2.constant + 1;
if (opline->opcode != ZEND_CALLABLE_CONVERT) {
opline->opcode = zend_get_call_op(fcall, call_stack[call].func);
}
} else if (fcall->opcode == ZEND_INIT_NS_FCALL_BY_NAME) {
fcall->opcode = ZEND_INIT_FCALL;
fcall->op1.num = zend_vm_calc_used_stack(fcall->extended_value, call_stack[call].func);
literal_dtor(&op_array->literals[fcall->op2.constant]);
literal_dtor(&op_array->literals[fcall->op2.constant + 2]);
fcall->op2.constant = fcall->op2.constant + 1;
if (opline->opcode != ZEND_CALLABLE_CONVERT) {
opline->opcode = zend_get_call_op(fcall, call_stack[call].func);
}
} else if (fcall->opcode == ZEND_INIT_STATIC_METHOD_CALL
|| fcall->opcode == ZEND_INIT_METHOD_CALL
|| fcall->opcode == ZEND_INIT_PARENT_PROPERTY_HOOK_CALL
|| fcall->opcode == ZEND_NEW) {
/* We don't have specialized opcodes for this, do nothing */
} else {
ZEND_UNREACHABLE();
}
/* If the INIT opcode changed the DO opcode can also change to
* a more optimized one.
*
* At this point we also know whether or not the result of
* the DO opcode is used, allowing to optimize calls to
* ZEND_ACC_NODISCARD functions. */
if (opline->opcode != ZEND_CALLABLE_CONVERT) {
opline->opcode = zend_get_call_op(fcall, call_stack[call].func, !RESULT_UNUSED(opline));
}
if ((ZEND_OPTIMIZER_PASS_16 & ctx->optimization_level)
&& call_stack[call].try_inline
&& opline->opcode != ZEND_CALLABLE_CONVERT) {

View file

@ -161,33 +161,26 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx)
}
break;
case ZEND_FETCH_CLASS_CONSTANT:
if (opline->op2_type == IS_CONST &&
Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING) {
zend_class_entry *ce = zend_optimizer_get_class_entry_from_op1(
ctx->script, op_array, opline);
if (ce) {
zend_class_constant *cc = zend_hash_find_ptr(
&ce->constants_table, Z_STR(ZEND_OP2_LITERAL(opline)));
if (cc && !(ZEND_CLASS_CONST_FLAGS(cc) & ZEND_ACC_DEPRECATED) && (ZEND_CLASS_CONST_FLAGS(cc) & ZEND_ACC_PPP_MASK) == ZEND_ACC_PUBLIC && !(ce->ce_flags & ZEND_ACC_TRAIT)) {
zval *c = &cc->value;
if (Z_TYPE_P(c) == IS_CONSTANT_AST) {
zend_ast *ast = Z_ASTVAL_P(c);
if (ast->kind != ZEND_AST_CONSTANT
|| !zend_optimizer_get_persistent_constant(zend_ast_get_constant_name(ast), &result, 1)
|| Z_TYPE(result) == IS_CONSTANT_AST) {
break;
}
} else {
ZVAL_COPY_OR_DUP(&result, c);
}
replace_by_const_or_qm_assign(op_array, opline, &result);
}
}
case ZEND_FETCH_CLASS_CONSTANT: {
bool is_prototype;
const zend_class_constant *cc = zend_fetch_class_const_info(ctx->script, op_array, opline, &is_prototype);
if (!cc || is_prototype) {
break;
}
const zval *c = &cc->value;
if (Z_TYPE_P(c) == IS_CONSTANT_AST) {
zend_ast *ast = Z_ASTVAL_P(c);
if (ast->kind != ZEND_AST_CONSTANT
|| !zend_optimizer_get_persistent_constant(zend_ast_get_constant_name(ast), &result, 1)
|| Z_TYPE(result) == IS_CONSTANT_AST) {
break;
}
} else {
ZVAL_COPY_OR_DUP(&result, c);
}
replace_by_const_or_qm_assign(op_array, opline, &result);
break;
}
case ZEND_DO_ICALL: {
zend_op *send1_opline = opline - 1;
@ -322,7 +315,7 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx)
case ZEND_JMPZ:
case ZEND_JMPNZ:
if (opline->op1_type == IS_CONST) {
int should_jmp = zend_is_true(&ZEND_OP1_LITERAL(opline));
bool should_jmp = zend_is_true(&ZEND_OP1_LITERAL(opline));
if (opline->opcode == ZEND_JMPZ) {
should_jmp = !should_jmp;
@ -344,7 +337,6 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx)
case ZEND_RETURN:
case ZEND_RETURN_BY_REF:
case ZEND_GENERATOR_RETURN:
case ZEND_EXIT:
case ZEND_THROW:
case ZEND_MATCH_ERROR:
case ZEND_CATCH:
@ -361,6 +353,7 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx)
case ZEND_JMP_NULL:
case ZEND_VERIFY_NEVER_TYPE:
case ZEND_BIND_INIT_STATIC_OR_JMP:
case ZEND_JMP_FRAMELESS:
collect_constants = 0;
break;
}

View file

@ -88,8 +88,7 @@ void zend_optimizer_pass3(zend_op_array *op_array, zend_optimizer_ctx *ctx)
MAKE_NOP(opline);
} else if ((target->opcode == ZEND_RETURN ||
target->opcode == ZEND_RETURN_BY_REF ||
target->opcode == ZEND_GENERATOR_RETURN ||
target->opcode == ZEND_EXIT) &&
target->opcode == ZEND_GENERATOR_RETURN) &&
!(op_array->fn_flags & ZEND_ACC_HAS_FINALLY_BLOCK)) {
/* JMP L, L: RETURN to immediate RETURN */
*opline = *target;

View file

@ -789,14 +789,10 @@ static bool can_ct_eval_func_call(zend_function *func, zend_string *name, uint32
/* The functions chosen here are simple to implement and either likely to affect a branch,
* or just happened to be commonly used with constant operands in WP (need to test other
* applications as well, of course). */
static inline zend_result ct_eval_func_call(
zend_op_array *op_array, zval *result, zend_string *name, uint32_t num_args, zval **args) {
static inline zend_result ct_eval_func_call_ex(
zend_op_array *op_array, zval *result, zend_function *func, uint32_t num_args, zval **args) {
uint32_t i;
zend_function *func = zend_hash_find_ptr(CG(function_table), name);
if (!func || func->type != ZEND_INTERNAL_FUNCTION) {
return FAILURE;
}
zend_string *name = func->common.function_name;
if (num_args == 1 && Z_TYPE_P(args[0]) == IS_STRING &&
zend_optimizer_eval_special_func_call(result, name, Z_STR_P(args[0])) == SUCCESS) {
return SUCCESS;
@ -855,6 +851,15 @@ static inline zend_result ct_eval_func_call(
return retval;
}
static inline zend_result ct_eval_func_call(
zend_op_array *op_array, zval *result, zend_string *name, uint32_t num_args, zval **args) {
zend_function *func = zend_hash_find_ptr(CG(function_table), name);
if (!func || func->type != ZEND_INTERNAL_FUNCTION) {
return FAILURE;
}
return ct_eval_func_call_ex(op_array, result, func, num_args, args);
}
#define SET_RESULT(op, zv) do { \
if (ssa_op->op##_def >= 0) { \
set_value(scdf, ctx, ssa_op->op##_def, zv); \
@ -1708,6 +1713,51 @@ static void sccp_visit_instr(scdf_ctx *scdf, zend_op *opline, zend_ssa_op *ssa_o
SET_RESULT_BOT(result);
break;
}
case ZEND_FRAMELESS_ICALL_0:
case ZEND_FRAMELESS_ICALL_1:
case ZEND_FRAMELESS_ICALL_2:
case ZEND_FRAMELESS_ICALL_3: {
/* We already know it can't be evaluated, don't bother checking again */
if (ssa_op->result_def < 0 || IS_BOT(&ctx->values[ssa_op->result_def])) {
break;
}
zval *args[3] = {NULL};
zend_function *func = ZEND_FLF_FUNC(opline);
uint32_t num_args = ZEND_FLF_NUM_ARGS(opline->opcode);
switch (num_args) {
case 3: {
zend_op *op_data = opline + 1;
args[2] = get_op1_value(ctx, op_data, &ctx->scdf.ssa->ops[op_data - ctx->scdf.op_array->opcodes]);
ZEND_FALLTHROUGH;
}
case 2:
args[1] = get_op2_value(ctx, opline, &ctx->scdf.ssa->ops[opline - ctx->scdf.op_array->opcodes]);
ZEND_FALLTHROUGH;
case 1:
args[0] = get_op1_value(ctx, opline, &ctx->scdf.ssa->ops[opline - ctx->scdf.op_array->opcodes]);
break;
}
for (uint32_t i = 0; i < num_args; i++) {
if (!args[i]) {
SET_RESULT_BOT(result);
return;
} else if (IS_BOT(args[i]) || IS_PARTIAL_ARRAY(args[i])) {
SET_RESULT_BOT(result);
return;
} else if (IS_TOP(args[i])) {
return;
}
}
if (ct_eval_func_call_ex(scdf->op_array, &zv, func, num_args, args) == SUCCESS) {
SET_RESULT(result, &zv);
zval_ptr_dtor_nogc(&zv);
break;
}
SET_RESULT_BOT(result);
break;
}
default:
{
/* If we have no explicit implementation return BOT */
@ -2155,7 +2205,13 @@ static int try_remove_definition(sccp_ctx *ctx, int var_num, zend_ssa_var *var,
if (opline->opcode == ZEND_DO_ICALL) {
removed_ops = remove_call(ctx, opline, ssa_op) - 1;
} else {
bool has_op_data = opline->opcode == ZEND_FRAMELESS_ICALL_3;
zend_ssa_remove_instr(ssa, opline, ssa_op);
removed_ops++;
if (has_op_data) {
zend_ssa_remove_instr(ssa, opline + 1, ssa_op + 1);
removed_ops++;
}
}
ssa_op->result_def = var_num;
opline->opcode = ZEND_QM_ASSIGN;
@ -2191,8 +2247,13 @@ static int try_remove_definition(sccp_ctx *ctx, int var_num, zend_ssa_var *var,
if (opline->opcode == ZEND_DO_ICALL) {
removed_ops = remove_call(ctx, opline, ssa_op);
} else {
bool has_op_data = opline->opcode == ZEND_FRAMELESS_ICALL_3;
zend_ssa_remove_instr(ssa, opline, ssa_op);
removed_ops++;
if (has_op_data) {
zend_ssa_remove_instr(ssa, opline + 1, ssa_op + 1);
removed_ops++;
}
}
}
} else if (ssa_op->op1_def == var_num) {

View file

@ -61,6 +61,7 @@ ZEND_API void zend_analyze_calls(zend_arena **arena, zend_script *script, uint32
case ZEND_INIT_FCALL:
case ZEND_INIT_METHOD_CALL:
case ZEND_INIT_STATIC_METHOD_CALL:
case ZEND_INIT_PARENT_PROPERTY_HOOK_CALL:
call_stack[call] = call_info;
func = zend_optimizer_get_called_func(
script, op_array, opline, &is_prototype);
@ -73,11 +74,13 @@ ZEND_API void zend_analyze_calls(zend_arena **arena, zend_script *script, uint32
call_info->num_args = opline->extended_value;
call_info->next_callee = func_info->callee_info;
call_info->is_prototype = is_prototype;
call_info->is_frameless = false;
func_info->callee_info = call_info;
if (build_flags & ZEND_CALL_TREE) {
call_info->next_caller = NULL;
} else if (func->type == ZEND_INTERNAL_FUNCTION) {
} else if (func->type == ZEND_INTERNAL_FUNCTION
|| func->op_array.filename != script->filename) {
call_info->next_caller = NULL;
} else {
zend_func_info *callee_func_info = ZEND_FUNC_INFO(&func->op_array);
@ -102,6 +105,24 @@ ZEND_API void zend_analyze_calls(zend_arena **arena, zend_script *script, uint32
call_info = NULL;
call++;
break;
case ZEND_FRAMELESS_ICALL_0:
case ZEND_FRAMELESS_ICALL_1:
case ZEND_FRAMELESS_ICALL_2:
case ZEND_FRAMELESS_ICALL_3: {
func = ZEND_FLF_FUNC(opline);
zend_call_info *call_info = zend_arena_calloc(arena, 1, sizeof(zend_call_info));
call_info->caller_op_array = op_array;
call_info->caller_init_opline = opline;
call_info->caller_call_opline = NULL;
call_info->callee_func = func;
call_info->num_args = ZEND_FLF_NUM_ARGS(opline->opcode);
call_info->next_callee = func_info->callee_info;
call_info->is_prototype = false;
call_info->is_frameless = true;
call_info->next_caller = NULL;
func_info->callee_info = call_info;
break;
}
case ZEND_DO_FCALL:
case ZEND_DO_ICALL:
case ZEND_DO_UCALL:
@ -142,10 +163,6 @@ ZEND_API void zend_analyze_calls(zend_arena **arena, zend_script *script, uint32
call_info->send_unpack = 1;
}
break;
case ZEND_EXIT:
/* In this case the DO_CALL opcode may have been dropped
* and caller_call_opline will be NULL. */
break;
}
opline++;
}
@ -260,9 +277,11 @@ ZEND_API zend_call_info **zend_build_call_map(zend_arena **arena, zend_func_info
if (call->caller_call_opline) {
map[call->caller_call_opline - op_array->opcodes] = call;
}
for (i = 0; i < call->num_args; i++) {
if (call->arg_info[i].opline) {
map[call->arg_info[i].opline - op_array->opcodes] = call;
if (!call->is_frameless) {
for (i = 0; i < call->num_args; i++) {
if (call->arg_info[i].opline) {
map[call->arg_info[i].opline - op_array->opcodes] = call;
}
}
}
}

View file

@ -38,6 +38,7 @@ struct _zend_call_info {
bool send_unpack; /* Parameters passed by SEND_UNPACK or SEND_ARRAY */
bool named_args; /* Function has named arguments */
bool is_prototype; /* An overridden child method may be called */
bool is_frameless; /* A frameless function sends arguments through operands */
int num_args; /* Number of arguments, excluding named and variadic arguments */
zend_send_arg_info arg_info[1];
};

View file

@ -28,13 +28,20 @@ static void zend_mark_reachable(zend_op *opcodes, zend_cfg *cfg, zend_basic_bloc
{
zend_basic_block *blocks = cfg->blocks;
while (1) {
zend_worklist work;
ALLOCA_FLAG(list_use_heap)
ZEND_WORKLIST_ALLOCA(&work, cfg->blocks_count, list_use_heap);
zend_worklist_push(&work, b - cfg->blocks);
while (zend_worklist_len(&work)) {
int i;
b = cfg->blocks + zend_worklist_pop(&work);
b->flags |= ZEND_BB_REACHABLE;
if (b->successors_count == 0) {
b->flags |= ZEND_BB_EXIT;
return;
continue;
}
for (i = 0; i < b->successors_count; i++) {
@ -86,22 +93,14 @@ static void zend_mark_reachable(zend_op *opcodes, zend_cfg *cfg, zend_basic_bloc
succ->flags |= ZEND_BB_FOLLOW;
}
if (i == b->successors_count - 1) {
/* Tail call optimization */
if (succ->flags & ZEND_BB_REACHABLE) {
return;
}
b = succ;
break;
} else {
/* Recursively check reachability */
if (!(succ->flags & ZEND_BB_REACHABLE)) {
zend_mark_reachable(opcodes, cfg, succ);
}
/* Check reachability of successor */
if (!(succ->flags & ZEND_BB_REACHABLE)) {
zend_worklist_push(&work, succ - cfg->blocks);
}
}
}
ZEND_WORKLIST_FREE_ALLOCA(&work, list_use_heap);
}
/* }}} */
@ -307,7 +306,6 @@ ZEND_API void zend_build_cfg(zend_arena **arena, const zend_op_array *op_array,
}
break;
case ZEND_MATCH_ERROR:
case ZEND_EXIT:
case ZEND_THROW:
/* Don't treat THROW as terminator if it's used in expression context,
* as we may lose live ranges when eliminating unreachable code. */
@ -374,6 +372,7 @@ ZEND_API void zend_build_cfg(zend_arena **arena, const zend_op_array *op_array,
case ZEND_ASSERT_CHECK:
case ZEND_JMP_NULL:
case ZEND_BIND_INIT_STATIC_OR_JMP:
case ZEND_JMP_FRAMELESS:
BB_START(OP_JMP_ADDR(opline, opline->op2) - op_array->opcodes);
BB_START(i + 1);
break;
@ -510,7 +509,6 @@ ZEND_API void zend_build_cfg(zend_arena **arena, const zend_op_array *op_array,
case ZEND_RETURN:
case ZEND_RETURN_BY_REF:
case ZEND_GENERATOR_RETURN:
case ZEND_EXIT:
case ZEND_THROW:
case ZEND_MATCH_ERROR:
case ZEND_VERIFY_NEVER_TYPE:
@ -528,6 +526,7 @@ ZEND_API void zend_build_cfg(zend_arena **arena, const zend_op_array *op_array,
case ZEND_ASSERT_CHECK:
case ZEND_JMP_NULL:
case ZEND_BIND_INIT_STATIC_OR_JMP:
case ZEND_JMP_FRAMELESS:
block->successors_count = 2;
block->successors[0] = block_map[OP_JMP_ADDR(opline, opline->op2) - op_array->opcodes];
block->successors[1] = j + 1;

View file

@ -122,6 +122,7 @@ add_op1_def:
}
break;
case ZEND_ASSIGN_STATIC_PROP_OP:
case ZEND_FRAMELESS_ICALL_3:
next = opline + 1;
if (next->op1_type & (IS_CV|IS_VAR|IS_TMP_VAR)) {
var_num = EX_VAR_TO_NUM(next->op1.var);

View file

@ -23,7 +23,7 @@
#include "zend_func_info.h"
#include "zend_call_graph.h"
#include "zend_dump.h"
#include "ext/standard/php_string.h"
#include "zend_smart_str.h"
void zend_dump_ht(HashTable *ht)
{
@ -66,13 +66,27 @@ void zend_dump_const(const zval *zv)
case IS_DOUBLE:
fprintf(stderr, " float(%g)", Z_DVAL_P(zv));
break;
case IS_STRING:;
zend_string *escaped_string = php_addcslashes(Z_STR_P(zv), "\"\\", 2);
case IS_STRING: {
smart_str escaped_string = {0};
smart_str_append_escaped(&escaped_string, Z_STRVAL_P(zv), Z_STRLEN_P(zv));
smart_str_0(&escaped_string);
fprintf(stderr, " string(\"%s\")", ZSTR_VAL(escaped_string));
fprintf(stderr, " string(\"");
zend_string_release(escaped_string);
/* Also escape '"' */
for (size_t i = 0; i < ZSTR_LEN(escaped_string.s); i++) {
if (ZSTR_VAL(escaped_string.s)[i] == '"') {
fprintf(stderr, "\\\"");
} else {
putc(ZSTR_VAL(escaped_string.s)[i], stderr);
}
}
fprintf(stderr, "\")");
smart_str_free_ex(&escaped_string, false);
break;
}
case IS_ARRAY:
fprintf(stderr, " array(...)");
break;
@ -137,7 +151,7 @@ static void zend_dump_unused_op(const zend_op *opline, znode_op op, uint32_t fla
}
}
ZEND_API void zend_dump_var(const zend_op_array *op_array, uint8_t var_type, int var_num)
ZEND_API void zend_dump_var(const zend_op_array *op_array, uint8_t var_type, uint32_t var_num)
{
if (var_type == IS_CV && var_num < op_array->last_var) {
fprintf(stderr, "CV%d($%s)", var_num, op_array->vars[var_num]->val);
@ -366,7 +380,7 @@ static void zend_dump_ssa_var_info(const zend_ssa *ssa, int ssa_var_num, uint32_
dump_flags);
}
ZEND_API void zend_dump_ssa_var(const zend_op_array *op_array, const zend_ssa *ssa, int ssa_var_num, uint8_t var_type, int var_num, uint32_t dump_flags)
ZEND_API void zend_dump_ssa_var(const zend_op_array *op_array, const zend_ssa *ssa, int ssa_var_num, uint8_t var_type, uint32_t var_num, uint32_t dump_flags)
{
if (ssa_var_num >= 0) {
fprintf(stderr, "#%d.", ssa_var_num);
@ -463,6 +477,11 @@ ZEND_API void zend_dump_op(const zend_op_array *op_array, const zend_basic_block
fprintf(stderr, "OP_%d", (int)opline->opcode);
}
if (ZEND_OP_IS_FRAMELESS_ICALL(opline->opcode)) {
zend_function *func = ZEND_FLF_FUNC(opline);
fprintf(stderr, "(%s)", ZSTR_VAL(func->common.function_name));
}
if (ZEND_VM_EXT_NUM == (flags & ZEND_VM_EXT_MASK)) {
fprintf(stderr, " %u", opline->extended_value);
} else if (ZEND_VM_EXT_OP == (flags & ZEND_VM_EXT_MASK)) {
@ -924,7 +943,6 @@ void zend_dump_op_array_name(const zend_op_array *op_array)
ZEND_API void zend_dump_op_array(const zend_op_array *op_array, uint32_t dump_flags, const char *msg, const void *data)
{
int i;
const zend_cfg *cfg = NULL;
const zend_ssa *ssa = NULL;
zend_func_info *func_info = NULL;
@ -1010,7 +1028,7 @@ ZEND_API void zend_dump_op_array(const zend_op_array *op_array, uint32_t dump_fl
}
if (ssa && ssa->var_info) {
for (i = 0; i < op_array->last_var; i++) {
for (uint32_t i = 0; i < op_array->last_var; i++) {
fprintf(stderr, " ; ");
zend_dump_ssa_var(op_array, ssa, i, IS_CV, i, dump_flags);
fprintf(stderr, "\n");
@ -1038,7 +1056,7 @@ ZEND_API void zend_dump_op_array(const zend_op_array *op_array, uint32_t dump_fl
}
if (op_array->last_live_range && (dump_flags & ZEND_DUMP_LIVE_RANGES)) {
fprintf(stderr, "LIVE RANGES:\n");
for (i = 0; i < op_array->last_live_range; i++) {
for (int i = 0; i < op_array->last_live_range; i++) {
fprintf(stderr,
" %u: %04u - %04u ",
EX_VAR_TO_NUM(op_array->live_range[i].var & ~ZEND_LIVE_MASK),
@ -1065,7 +1083,7 @@ ZEND_API void zend_dump_op_array(const zend_op_array *op_array, uint32_t dump_fl
}
if (op_array->last_try_catch) {
fprintf(stderr, "EXCEPTION TABLE:\n");
for (i = 0; i < op_array->last_try_catch; i++) {
for (int i = 0; i < op_array->last_try_catch; i++) {
fprintf(stderr, " BB%u",
cfg->map[op_array->try_catch_array[i].try_op]);
if (op_array->try_catch_array[i].catch_op) {
@ -1098,7 +1116,7 @@ ZEND_API void zend_dump_op_array(const zend_op_array *op_array, uint32_t dump_fl
}
if (op_array->last_live_range && (dump_flags & ZEND_DUMP_LIVE_RANGES)) {
fprintf(stderr, "LIVE RANGES:\n");
for (i = 0; i < op_array->last_live_range; i++) {
for (int i = 0; i < op_array->last_live_range; i++) {
fprintf(stderr,
" %u: %04u - %04u ",
EX_VAR_TO_NUM(op_array->live_range[i].var & ~ZEND_LIVE_MASK),
@ -1125,7 +1143,7 @@ ZEND_API void zend_dump_op_array(const zend_op_array *op_array, uint32_t dump_fl
}
if (op_array->last_try_catch) {
fprintf(stderr, "EXCEPTION TABLE:\n");
for (i = 0; i < op_array->last_try_catch; i++) {
for (int i = 0; i < op_array->last_try_catch; i++) {
fprintf(stderr,
" %04u",
op_array->try_catch_array[i].try_op);
@ -1171,20 +1189,6 @@ void zend_dump_dominators(const zend_op_array *op_array, const zend_cfg *cfg)
}
}
void zend_dump_variables(const zend_op_array *op_array)
{
int j;
fprintf(stderr, "\nCV Variables for \"");
zend_dump_op_array_name(op_array);
fprintf(stderr, "\"\n");
for (j = 0; j < op_array->last_var; j++) {
fprintf(stderr, " ");
zend_dump_var(op_array, IS_CV, j);
fprintf(stderr, "\n");
}
}
void zend_dump_ssa_variables(const zend_op_array *op_array, const zend_ssa *ssa, uint32_t dump_flags)
{
int j;

View file

@ -39,10 +39,9 @@ ZEND_API void zend_dump_op_line(const zend_op_array *op_array, const zend_basic_
void zend_dump_dominators(const zend_op_array *op_array, const zend_cfg *cfg);
void zend_dump_dfg(const zend_op_array *op_array, const zend_cfg *cfg, const zend_dfg *dfg);
void zend_dump_phi_placement(const zend_op_array *op_array, const zend_ssa *ssa);
void zend_dump_variables(const zend_op_array *op_array);
void zend_dump_ssa_variables(const zend_op_array *op_array, const zend_ssa *ssa, uint32_t dump_flags);
ZEND_API void zend_dump_ssa_var(const zend_op_array *op_array, const zend_ssa *ssa, int ssa_var_num, uint8_t var_type, int var_num, uint32_t dump_flags);
ZEND_API void zend_dump_var(const zend_op_array *op_array, uint8_t var_type, int var_num);
ZEND_API void zend_dump_ssa_var(const zend_op_array *op_array, const zend_ssa *ssa, int ssa_var_num, uint8_t var_type, uint32_t var_num, uint32_t dump_flags);
ZEND_API void zend_dump_var(const zend_op_array *op_array, uint8_t var_type, uint32_t var_num);
void zend_dump_op_array_name(const zend_op_array *op_array);
void zend_dump_const(const zval *zv);
void zend_dump_ht(HashTable *ht);

View file

@ -51,21 +51,23 @@ typedef struct _func_info_t {
static uint32_t zend_range_info(const zend_call_info *call_info, const zend_ssa *ssa)
{
ZEND_ASSERT(!call_info->is_frameless);
if (!call_info->send_unpack
&& (call_info->num_args == 2 || call_info->num_args == 3)
&& ssa
&& !(ssa->cfg.flags & ZEND_SSA_TSSA)) {
zend_op_array *op_array = call_info->caller_op_array;
uint32_t t1 = _ssa_op1_info(op_array, ssa, call_info->arg_info[0].opline,
&ssa->ops[call_info->arg_info[0].opline - op_array->opcodes]);
ssa->ops ? &ssa->ops[call_info->arg_info[0].opline - op_array->opcodes] : NULL);
uint32_t t2 = _ssa_op1_info(op_array, ssa, call_info->arg_info[1].opline,
&ssa->ops[call_info->arg_info[1].opline - op_array->opcodes]);
ssa->ops ? &ssa->ops[call_info->arg_info[1].opline - op_array->opcodes] : NULL);
uint32_t t3 = 0;
uint32_t tmp = MAY_BE_RC1 | MAY_BE_ARRAY;
if (call_info->num_args == 3) {
t3 = _ssa_op1_info(op_array, ssa, call_info->arg_info[2].opline,
&ssa->ops[call_info->arg_info[2].opline - op_array->opcodes]);
ssa->ops ? &ssa->ops[call_info->arg_info[2].opline - op_array->opcodes] : NULL);
}
if ((t1 & MAY_BE_STRING) && (t2 & MAY_BE_STRING)) {
tmp |= MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_DOUBLE | MAY_BE_ARRAY_OF_STRING;

View file

@ -1,6 +1,7 @@
/* This is a generated file, edit the .stub.php files instead. */
static const func_info_t func_infos[] = {
F1("clone", MAY_BE_OBJECT),
F1("zend_version", MAY_BE_STRING),
FN("func_get_args", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_ANY),
F1("get_class_vars", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_ANY|MAY_BE_ARRAY_OF_REF),
@ -24,9 +25,13 @@ static const func_info_t func_infos[] = {
F1("bcmul", MAY_BE_STRING),
F1("bcdiv", MAY_BE_STRING),
F1("bcmod", MAY_BE_STRING),
F1("bcdivmod", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING),
F1("bcpowmod", MAY_BE_STRING),
F1("bcpow", MAY_BE_STRING),
F1("bcsqrt", MAY_BE_STRING),
F1("bcfloor", MAY_BE_STRING),
F1("bcceil", MAY_BE_STRING),
F1("bcround", MAY_BE_STRING),
FN("bzopen", MAY_BE_RESOURCE|MAY_BE_FALSE),
F1("bzerror", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_STRING),
F1("cal_from_jd", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_ARRAY_OF_NULL),
@ -42,6 +47,7 @@ static const func_info_t func_infos[] = {
F1("curl_multi_strerror", MAY_BE_STRING|MAY_BE_NULL),
F1("curl_share_init", MAY_BE_OBJECT),
F1("curl_share_strerror", MAY_BE_STRING|MAY_BE_NULL),
F1("curl_share_init_persistent", MAY_BE_OBJECT),
F1("curl_strerror", MAY_BE_STRING|MAY_BE_NULL),
F1("curl_version", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_ARRAY_OF_ARRAY|MAY_BE_FALSE),
F1("date", MAY_BE_STRING),
@ -74,8 +80,6 @@ static const func_info_t func_infos[] = {
F1("date_sunrise", MAY_BE_STRING|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_FALSE),
F1("date_sunset", MAY_BE_STRING|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_FALSE),
F1("date_sun_info", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_FALSE|MAY_BE_ARRAY_OF_TRUE|MAY_BE_ARRAY_OF_LONG),
FN("dba_popen", MAY_BE_RESOURCE|MAY_BE_FALSE),
FN("dba_open", MAY_BE_RESOURCE|MAY_BE_FALSE),
FN("dba_key_split", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE),
F1("dba_handlers", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_STRING),
FN("dba_list", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING),
@ -101,8 +105,6 @@ static const func_info_t func_infos[] = {
F1("imagecreatetruecolor", MAY_BE_OBJECT|MAY_BE_FALSE),
#if defined(PHP_WIN32)
F1("imagegrabwindow", MAY_BE_OBJECT|MAY_BE_FALSE),
#endif
#if defined(PHP_WIN32)
F1("imagegrabscreen", MAY_BE_OBJECT|MAY_BE_FALSE),
#endif
F1("imagerotate", MAY_BE_OBJECT|MAY_BE_FALSE),
@ -129,15 +131,11 @@ static const func_info_t func_infos[] = {
F1("imagecreatefromgd", MAY_BE_OBJECT|MAY_BE_FALSE),
F1("imagecreatefromgd2", MAY_BE_OBJECT|MAY_BE_FALSE),
F1("imagecreatefromgd2part", MAY_BE_OBJECT|MAY_BE_FALSE),
#if defined(HAVE_GD_BMP)
F1("imagecreatefrombmp", MAY_BE_OBJECT|MAY_BE_FALSE),
#endif
F1("imagecolorsforindex", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG),
F1("imagegetclip", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_LONG),
#if defined(HAVE_GD_FREETYPE)
F1("imageftbbox", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_LONG|MAY_BE_FALSE),
#endif
#if defined(HAVE_GD_FREETYPE)
F1("imagefttext", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_LONG|MAY_BE_FALSE),
#endif
F1("imagecrop", MAY_BE_OBJECT|MAY_BE_FALSE),
@ -181,11 +179,7 @@ static const func_info_t func_infos[] = {
F1("hash_hkdf", MAY_BE_STRING),
#if defined(PHP_MHASH_BC)
F1("mhash_get_hash_name", MAY_BE_STRING|MAY_BE_FALSE),
#endif
#if defined(PHP_MHASH_BC)
F1("mhash_keygen_s2k", MAY_BE_STRING|MAY_BE_FALSE),
#endif
#if defined(PHP_MHASH_BC)
F1("mhash", MAY_BE_STRING|MAY_BE_FALSE),
#endif
F1("iconv_substr", MAY_BE_STRING|MAY_BE_FALSE),
@ -238,29 +232,13 @@ static const func_info_t func_infos[] = {
F1("mb_get_info", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_ARRAY_OF_ARRAY|MAY_BE_STRING|MAY_BE_LONG|MAY_BE_FALSE|MAY_BE_NULL),
#if defined(HAVE_MBREGEX)
F1("mb_regex_encoding", MAY_BE_STRING|MAY_BE_BOOL),
#endif
#if defined(HAVE_MBREGEX)
F1("mb_ereg_replace", MAY_BE_STRING|MAY_BE_FALSE|MAY_BE_NULL),
#endif
#if defined(HAVE_MBREGEX)
F1("mb_eregi_replace", MAY_BE_STRING|MAY_BE_FALSE|MAY_BE_NULL),
#endif
#if defined(HAVE_MBREGEX)
F1("mb_ereg_replace_callback", MAY_BE_STRING|MAY_BE_FALSE|MAY_BE_NULL),
#endif
#if defined(HAVE_MBREGEX)
F1("mb_split", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE),
#endif
#if defined(HAVE_MBREGEX)
F1("mb_ereg_search_pos", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_LONG|MAY_BE_FALSE),
#endif
#if defined(HAVE_MBREGEX)
F1("mb_ereg_search_regs", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_STRING|MAY_BE_ARRAY_OF_FALSE|MAY_BE_FALSE),
#endif
#if defined(HAVE_MBREGEX)
F1("mb_ereg_search_getregs", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_STRING|MAY_BE_ARRAY_OF_FALSE|MAY_BE_FALSE),
#endif
#if defined(HAVE_MBREGEX)
F1("mb_regex_set_options", MAY_BE_STRING),
#endif
F1("mysqli_affected_rows", MAY_BE_LONG|MAY_BE_STRING),
@ -308,39 +286,6 @@ static const func_info_t func_infos[] = {
F1("mysqli_stat", MAY_BE_STRING|MAY_BE_FALSE),
F1("mysqli_store_result", MAY_BE_OBJECT|MAY_BE_FALSE),
F1("mysqli_use_result", MAY_BE_OBJECT|MAY_BE_FALSE),
FN("oci_new_connect", MAY_BE_RESOURCE|MAY_BE_FALSE),
FN("oci_connect", MAY_BE_RESOURCE|MAY_BE_FALSE),
FN("oci_pconnect", MAY_BE_RESOURCE|MAY_BE_FALSE),
F1("oci_error", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE),
FN("oci_parse", MAY_BE_RESOURCE|MAY_BE_FALSE),
FN("oci_get_implicit_resultset", MAY_BE_RESOURCE|MAY_BE_FALSE),
FN("oci_password_change", MAY_BE_RESOURCE|MAY_BE_BOOL),
FN("oci_new_cursor", MAY_BE_RESOURCE|MAY_BE_FALSE),
FN("odbc_prepare", MAY_BE_RESOURCE|MAY_BE_FALSE),
FN("odbc_exec", MAY_BE_RESOURCE|MAY_BE_FALSE),
FN("odbc_connect", MAY_BE_RESOURCE|MAY_BE_FALSE),
FN("odbc_pconnect", MAY_BE_RESOURCE|MAY_BE_FALSE),
FN("odbc_tables", MAY_BE_RESOURCE|MAY_BE_FALSE),
FN("odbc_columns", MAY_BE_RESOURCE|MAY_BE_FALSE),
FN("odbc_gettypeinfo", MAY_BE_RESOURCE|MAY_BE_FALSE),
FN("odbc_primarykeys", MAY_BE_RESOURCE|MAY_BE_FALSE),
#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) && !defined(HAVE_SOLID_35)
FN("odbc_procedurecolumns", MAY_BE_RESOURCE|MAY_BE_FALSE),
#endif
#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) && !defined(HAVE_SOLID_35)
FN("odbc_procedures", MAY_BE_RESOURCE|MAY_BE_FALSE),
#endif
#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) && !defined(HAVE_SOLID_35)
FN("odbc_foreignkeys", MAY_BE_RESOURCE|MAY_BE_FALSE),
#endif
FN("odbc_specialcolumns", MAY_BE_RESOURCE|MAY_BE_FALSE),
FN("odbc_statistics", MAY_BE_RESOURCE|MAY_BE_FALSE),
#if !defined(HAVE_DBMAKER) && !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) &&!defined(HAVE_SOLID_35)
FN("odbc_tableprivileges", MAY_BE_RESOURCE|MAY_BE_FALSE),
#endif
#if !defined(HAVE_DBMAKER) && !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) &&!defined(HAVE_SOLID_35)
FN("odbc_columnprivileges", MAY_BE_RESOURCE|MAY_BE_FALSE),
#endif
F1("opcache_get_status", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_ANY|MAY_BE_FALSE),
F1("opcache_get_configuration", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_ANY|MAY_BE_FALSE),
F1("openssl_x509_parse", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_ARRAY_OF_ARRAY|MAY_BE_FALSE),
@ -365,6 +310,7 @@ static const func_info_t func_infos[] = {
F1("pg_tty", MAY_BE_STRING),
F1("pg_host", MAY_BE_STRING),
F1("pg_version", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_ARRAY_OF_NULL),
F1("pg_jit", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_STRING|MAY_BE_ARRAY_OF_NULL),
F1("pg_parameter_status", MAY_BE_STRING|MAY_BE_FALSE),
F1("pg_query", MAY_BE_OBJECT|MAY_BE_FALSE),
F1("pg_query_params", MAY_BE_OBJECT|MAY_BE_FALSE),
@ -414,7 +360,6 @@ static const func_info_t func_infos[] = {
#if defined(HAVE_GETRLIMIT)
F1("posix_getrlimit", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE),
#endif
F1("pspell_suggest", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE),
F1("random_bytes", MAY_BE_STRING),
#if defined(HAVE_HISTORY_LIST)
F1("readline_list_history", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING),
@ -434,8 +379,6 @@ static const func_info_t func_infos[] = {
FN("sodium_crypto_kx_server_session_keys", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING),
#if defined(crypto_secretstream_xchacha20poly1305_ABYTES)
FN("sodium_crypto_secretstream_xchacha20poly1305_init_push", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING),
#endif
#if defined(crypto_secretstream_xchacha20poly1305_ABYTES)
FN("sodium_crypto_secretstream_xchacha20poly1305_pull", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE),
#endif
F1("class_implements", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE),
@ -470,7 +413,7 @@ static const func_info_t func_infos[] = {
FN("array_rand", MAY_BE_LONG|MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_STRING),
F1("base64_encode", MAY_BE_STRING),
F1("base64_decode", MAY_BE_STRING|MAY_BE_FALSE),
F1("long2ip", MAY_BE_STRING|MAY_BE_FALSE),
F1("long2ip", MAY_BE_STRING),
F1("getenv", MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE),
F1("getopt", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_STRING|MAY_BE_ARRAY_OF_ARRAY|MAY_BE_ARRAY_OF_FALSE|MAY_BE_FALSE),
#if defined(HAVE_NANOSLEEP)
@ -478,14 +421,13 @@ static const func_info_t func_infos[] = {
#endif
F1("get_current_user", MAY_BE_STRING),
FN("get_cfg_var", MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_STRING|MAY_BE_ARRAY_OF_ARRAY|MAY_BE_FALSE),
F1("error_get_last", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_NULL),
F1("error_get_last", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_ARRAY_OF_ARRAY|MAY_BE_NULL),
F1("highlight_file", MAY_BE_STRING|MAY_BE_BOOL),
F1("php_strip_whitespace", MAY_BE_STRING),
F1("highlight_string", MAY_BE_STRING|MAY_BE_BOOL),
F1("highlight_string", MAY_BE_STRING|MAY_BE_TRUE),
F1("ini_get_all", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_STRING|MAY_BE_ARRAY_OF_ARRAY|MAY_BE_ARRAY_OF_NULL|MAY_BE_FALSE),
F1("set_include_path", MAY_BE_STRING|MAY_BE_FALSE),
F1("get_include_path", MAY_BE_STRING|MAY_BE_FALSE),
F1("print_r", MAY_BE_STRING|MAY_BE_BOOL),
F1("print_r", MAY_BE_STRING|MAY_BE_TRUE),
#if defined(HAVE_GETSERVBYPORT)
F1("getservbyport", MAY_BE_STRING|MAY_BE_FALSE),
#endif
@ -518,12 +460,8 @@ static const func_info_t func_infos[] = {
F1("md5_file", MAY_BE_STRING|MAY_BE_FALSE),
F1("sha1", MAY_BE_STRING),
F1("sha1_file", MAY_BE_STRING|MAY_BE_FALSE),
#if defined(HAVE_INET_NTOP)
F1("inet_ntop", MAY_BE_STRING|MAY_BE_FALSE),
#endif
#if defined(HAVE_INET_PTON)
F1("inet_pton", MAY_BE_STRING|MAY_BE_FALSE),
#endif
F1("metaphone", MAY_BE_STRING),
F1("headers_list", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING),
F1("htmlspecialchars", MAY_BE_STRING),
@ -572,9 +510,7 @@ static const func_info_t func_infos[] = {
F1("getcwd", MAY_BE_STRING|MAY_BE_FALSE),
F1("readdir", MAY_BE_STRING|MAY_BE_FALSE),
F1("scandir", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE),
#if defined(HAVE_GLOB)
F1("glob", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE),
#endif
F1("exec", MAY_BE_STRING|MAY_BE_FALSE),
F1("system", MAY_BE_STRING|MAY_BE_FALSE),
F1("escapeshellcmd", MAY_BE_STRING),
@ -603,6 +539,7 @@ static const func_info_t func_infos[] = {
F1("fsockopen", MAY_BE_RESOURCE|MAY_BE_FALSE),
FN("pfsockopen", MAY_BE_RESOURCE|MAY_BE_FALSE),
F1("http_build_query", MAY_BE_STRING),
F1("request_parse_body", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_ARRAY),
F1("image_type_to_mime_type", MAY_BE_STRING),
F1("image_type_to_extension", MAY_BE_STRING|MAY_BE_FALSE),
F1("getimagesize", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE),
@ -624,8 +561,6 @@ static const func_info_t func_infos[] = {
F1("number_format", MAY_BE_STRING),
#if defined(HAVE_GETTIMEOFDAY)
F1("microtime", MAY_BE_STRING|MAY_BE_DOUBLE),
#endif
#if defined(HAVE_GETTIMEOFDAY)
F1("gettimeofday", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_DOUBLE),
#endif
#if defined(HAVE_GETRUSAGE)
@ -637,8 +572,6 @@ static const func_info_t func_infos[] = {
F1("password_hash", MAY_BE_STRING),
#if defined(PHP_CAN_SUPPORT_PROC_OPEN)
F1("proc_open", MAY_BE_RESOURCE|MAY_BE_FALSE),
#endif
#if defined(PHP_CAN_SUPPORT_PROC_OPEN)
F1("proc_get_status", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_FALSE|MAY_BE_ARRAY_OF_TRUE|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_STRING),
#endif
F1("quoted_printable_decode", MAY_BE_STRING),

View file

@ -543,7 +543,7 @@ ZEND_API void zend_ssa_find_false_dependencies(const zend_op_array *op_array, ze
/* }}} */
/* From "Hacker's Delight" */
zend_ulong minOR(zend_ulong a, zend_ulong b, zend_ulong c, zend_ulong d)
static zend_ulong minOR(zend_ulong a, zend_ulong b, zend_ulong c, zend_ulong d)
{
zend_ulong m, temp;
@ -567,7 +567,7 @@ zend_ulong minOR(zend_ulong a, zend_ulong b, zend_ulong c, zend_ulong d)
return a | c;
}
zend_ulong maxOR(zend_ulong a, zend_ulong b, zend_ulong c, zend_ulong d)
static zend_ulong maxOR(zend_ulong a, zend_ulong b, zend_ulong c, zend_ulong d)
{
zend_ulong m, temp;
@ -590,7 +590,7 @@ zend_ulong maxOR(zend_ulong a, zend_ulong b, zend_ulong c, zend_ulong d)
return b | d;
}
zend_ulong minAND(zend_ulong a, zend_ulong b, zend_ulong c, zend_ulong d)
static zend_ulong minAND(zend_ulong a, zend_ulong b, zend_ulong c, zend_ulong d)
{
zend_ulong m, temp;
@ -613,7 +613,7 @@ zend_ulong minAND(zend_ulong a, zend_ulong b, zend_ulong c, zend_ulong d)
return a & c;
}
zend_ulong maxAND(zend_ulong a, zend_ulong b, zend_ulong c, zend_ulong d)
static zend_ulong maxAND(zend_ulong a, zend_ulong b, zend_ulong c, zend_ulong d)
{
zend_ulong m, temp;
@ -637,16 +637,6 @@ zend_ulong maxAND(zend_ulong a, zend_ulong b, zend_ulong c, zend_ulong d)
return b & d;
}
zend_ulong minXOR(zend_ulong a, zend_ulong b, zend_ulong c, zend_ulong d)
{
return minAND(a, b, ~d, ~c) | minAND(~b, ~a, c, d);
}
zend_ulong maxXOR(zend_ulong a, zend_ulong b, zend_ulong c, zend_ulong d)
{
return maxOR(0, maxAND(a, b, ~d, ~c), 0, maxAND(~b, ~a, c, d));
}
/* Based on "Hacker's Delight" */
/*
@ -1978,6 +1968,10 @@ static uint32_t get_ssa_alias_types(zend_ssa_alias_kind alias) {
/* TODO: support for array keys and ($str . "")*/ \
__type |= MAY_BE_RCN; \
} \
if ((__type & MAY_BE_RC1) && (__type & MAY_BE_OBJECT)) {\
/* TODO: object may be captured by magic handlers */\
__type |= MAY_BE_RCN; \
} \
if (__ssa_var->alias) { \
__type |= get_ssa_alias_types(__ssa_var->alias); \
} \
@ -2003,10 +1997,15 @@ static uint32_t get_ssa_alias_types(zend_ssa_alias_kind alias) {
#define UPDATE_SSA_OBJ_TYPE(_ce, _is_instanceof, var) \
do { \
if (var >= 0) { \
if (ssa_var_info[var].ce != (_ce) || \
ssa_var_info[var].is_instanceof != (_is_instanceof)) { \
ssa_var_info[var].ce = (_ce); \
ssa_var_info[var].is_instanceof = (_is_instanceof); \
zend_class_entry *__ce = (_ce); \
bool __is_instanceof = (_is_instanceof); \
if (__ce && (__ce->ce_flags & ZEND_ACC_FINAL)) { \
__is_instanceof = false; \
} \
if (ssa_var_info[var].ce != __ce || \
ssa_var_info[var].is_instanceof != __is_instanceof) { \
ssa_var_info[var].ce = __ce; \
ssa_var_info[var].is_instanceof = __is_instanceof; \
if (update_worklist) { \
add_usages(op_array, ssa, worklist, var); \
} \
@ -2410,7 +2409,7 @@ static const zend_property_info *lookup_prop_info(const zend_class_entry *ce, ze
/* If the class is linked, reuse the precise runtime logic. */
if ((ce->ce_flags & ZEND_ACC_LINKED)
&& (!scope || (scope->ce_flags & ZEND_ACC_LINKED))) {
zend_class_entry *prev_scope = EG(fake_scope);
const zend_class_entry *prev_scope = EG(fake_scope);
EG(fake_scope) = scope;
prop_info = zend_get_property_info(ce, name, 1);
EG(fake_scope) = prev_scope;
@ -3024,7 +3023,14 @@ static zend_always_inline zend_result _zend_update_type_info(
break;
case ZEND_ASSIGN_OBJ:
if (opline->op1_type == IS_CV) {
tmp = (t1 & (MAY_BE_REF|MAY_BE_OBJECT))|MAY_BE_RC1|MAY_BE_RCN;
zend_class_entry *ce = ssa_var_info[ssa_op->op1_use].ce;
bool add_rc = (t1 & (MAY_BE_OBJECT|MAY_BE_REF)) && (!ce
|| ce->__set
/* Non-default write_property may be set within create_object. */
|| ce->create_object
|| ce->default_object_handlers->write_property != zend_std_write_property
|| ssa_var_info[ssa_op->op1_use].is_instanceof);
tmp = (t1 & (MAY_BE_REF|MAY_BE_OBJECT|MAY_BE_RC1|MAY_BE_RCN))|(add_rc ? (MAY_BE_RC1|MAY_BE_RCN) : 0);
UPDATE_SSA_TYPE(tmp, ssa_op->op1_def);
COPY_SSA_OBJ_TYPE(ssa_op->op1_use, ssa_op->op1_def);
}
@ -3157,7 +3163,7 @@ static zend_always_inline zend_result _zend_update_type_info(
}
break;
case ZEND_ASSIGN_OBJ_REF:
if (opline->op1_type == IS_CV) {
if (opline->op1_type == IS_CV && ssa_op->op1_def >= 0) {
tmp = t1;
if (tmp & MAY_BE_OBJECT) {
tmp |= MAY_BE_RC1 | MAY_BE_RCN;
@ -3348,6 +3354,12 @@ static zend_always_inline zend_result _zend_update_type_info(
}
break;
case ZEND_FETCH_CLASS_STATIC:
if (op_array->scope && (op_array->scope->ce_flags & ZEND_ACC_FINAL)) {
UPDATE_SSA_OBJ_TYPE(op_array->scope, 0, ssa_op->result_def);
} else {
UPDATE_SSA_OBJ_TYPE(NULL, 0, ssa_op->result_def);
}
break;
default:
UPDATE_SSA_OBJ_TYPE(NULL, 0, ssa_op->result_def);
break;
@ -3371,9 +3383,19 @@ static zend_always_inline zend_result _zend_update_type_info(
UPDATE_SSA_OBJ_TYPE(ce, 0, ssa_op->result_def);
} else if ((t1 & MAY_BE_CLASS) && ssa_op->op1_use >= 0 && ssa_var_info[ssa_op->op1_use].ce) {
UPDATE_SSA_OBJ_TYPE(ssa_var_info[ssa_op->op1_use].ce, ssa_var_info[ssa_op->op1_use].is_instanceof, ssa_op->result_def);
if (!ssa_var_info[ssa_op->result_def].is_instanceof) {
ce = ssa_var_info[ssa_op->op1_use].ce;
}
} else {
UPDATE_SSA_OBJ_TYPE(NULL, 0, ssa_op->result_def);
}
/* New objects without constructors cannot escape. */
if (ce
&& !ce->constructor
&& !ce->create_object
&& ce->default_object_handlers->get_constructor == zend_std_get_constructor) {
tmp &= ~MAY_BE_RCN;
}
UPDATE_SSA_TYPE(tmp, ssa_op->result_def);
break;
case ZEND_CLONE:
@ -3821,6 +3843,38 @@ static zend_always_inline zend_result _zend_update_type_info(
UPDATE_SSA_OBJ_TYPE(ce, 1, ssa_op->result_def);
}
break;
case ZEND_FRAMELESS_ICALL_1:
case ZEND_FRAMELESS_ICALL_2:
case ZEND_FRAMELESS_ICALL_3:
if (ssa_op->op1_def >= 0) {
ZEND_ASSERT(ssa_op->op1_use >= 0);
tmp = ssa->var_info[ssa_op->op1_use].type;
if (tmp & MAY_BE_RC1) {
tmp |= MAY_BE_RCN;
}
UPDATE_SSA_TYPE(tmp, ssa_op->op1_def);
}
if (ssa_op->op2_def >= 0) {
ZEND_ASSERT(ssa_op->op2_use >= 0);
tmp = ssa->var_info[ssa_op->op2_use].type;
if (tmp & MAY_BE_RC1) {
tmp |= MAY_BE_RCN;
}
UPDATE_SSA_TYPE(tmp, ssa_op->op2_def);
}
if (opline->opcode == ZEND_FRAMELESS_ICALL_3) {
zend_ssa_op *next_ssa_op = ssa_op + 1;
if (next_ssa_op->op1_def >= 0) {
ZEND_ASSERT(next_ssa_op->op1_use >= 0);
tmp = ssa->var_info[next_ssa_op->op1_use].type;
if (tmp & MAY_BE_RC1) {
tmp |= MAY_BE_RCN;
}
UPDATE_SSA_TYPE(tmp, next_ssa_op->op1_def);
}
}
ZEND_FALLTHROUGH;
case ZEND_FRAMELESS_ICALL_0:
case ZEND_DO_FCALL:
case ZEND_DO_ICALL:
case ZEND_DO_UCALL:
@ -3851,9 +3905,21 @@ static zend_always_inline zend_result _zend_update_type_info(
UPDATE_SSA_OBJ_TYPE(zend_ce_closure, /* is_instanceof */ false, ssa_op->result_def);
break;
case ZEND_FETCH_CONSTANT:
case ZEND_FETCH_CLASS_CONSTANT:
UPDATE_SSA_TYPE(MAY_BE_RC1|MAY_BE_RCN|MAY_BE_ANY|MAY_BE_ARRAY_KEY_ANY|MAY_BE_ARRAY_OF_ANY, ssa_op->result_def);
break;
case ZEND_FETCH_CLASS_CONSTANT: {
bool is_prototype;
const zend_class_constant *cc = zend_fetch_class_const_info(script, op_array, opline, &is_prototype);
if (!cc || !ZEND_TYPE_IS_SET(cc->type)) {
UPDATE_SSA_TYPE(MAY_BE_RC1|MAY_BE_RCN|MAY_BE_ANY|MAY_BE_ARRAY_KEY_ANY|MAY_BE_ARRAY_OF_ANY, ssa_op->result_def);
break;
}
UPDATE_SSA_TYPE(zend_convert_type(script, cc->type, &ce), ssa_op->result_def);
if (ce) {
UPDATE_SSA_OBJ_TYPE(ce, /* is_instanceof */ true, ssa_op->result_def);
}
break;
}
case ZEND_STRLEN:
case ZEND_COUNT:
case ZEND_FUNC_NUM_ARGS:
@ -3935,12 +4001,73 @@ static zend_always_inline zend_result _zend_update_type_info(
/* Forbidden opcodes */
ZEND_UNREACHABLE();
break;
case ZEND_FETCH_CLASS_NAME:
UPDATE_SSA_TYPE(MAY_BE_STRING|MAY_BE_RCN, ssa_op->result_def);
break;
case ZEND_ISSET_ISEMPTY_THIS:
UPDATE_SSA_TYPE(MAY_BE_BOOL, ssa_op->result_def);
break;
case ZEND_DECLARE_LAMBDA_FUNCTION:
UPDATE_SSA_TYPE(MAY_BE_OBJECT|MAY_BE_RC1|MAY_BE_RCN, ssa_op->result_def);
UPDATE_SSA_OBJ_TYPE(zend_ce_closure, /* is_instanceof */ false, ssa_op->result_def);
break;
case ZEND_PRE_DEC_STATIC_PROP:
case ZEND_PRE_INC_STATIC_PROP:
case ZEND_POST_DEC_STATIC_PROP:
case ZEND_POST_INC_STATIC_PROP: {
if (ssa_op->result_def >= 0) {
const zend_property_info *prop_info = zend_fetch_static_prop_info(script, op_array, ssa, opline);
zend_class_entry *prop_ce;
tmp = zend_fetch_prop_type(script, prop_info, &prop_ce);
/* Internal objects may result in essentially anything. */
if (tmp & MAY_BE_OBJECT) {
goto unknown_opcode;
}
tmp &= MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_STRING|MAY_BE_BOOL|MAY_BE_NULL;
if (tmp & MAY_BE_STRING) {
tmp |= MAY_BE_RC1 | MAY_BE_RCN;
}
UPDATE_SSA_TYPE(tmp, ssa_op->result_def);
}
break;
}
case ZEND_SPACESHIP:
UPDATE_SSA_TYPE(MAY_BE_LONG, ssa_op->result_def);
break;
case ZEND_FETCH_GLOBALS:
UPDATE_SSA_TYPE(MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_ANY|MAY_BE_ARRAY_OF_ANY|MAY_BE_ARRAY_OF_REF|MAY_BE_RC1|MAY_BE_RCN, ssa_op->result_def);
break;
default:
unknown_opcode:
#ifdef ZEND_DEBUG_TYPE_INFERENCE
if (ssa_op->result_def >= 0) {
switch (opline->opcode) {
case ZEND_FETCH_R:
case ZEND_FETCH_W:
case ZEND_FETCH_RW:
case ZEND_FETCH_IS:
case ZEND_FETCH_UNSET:
case ZEND_YIELD_FROM:
/* Currently unimplemented due to some assumptions in JIT. See:
* https://github.com/php/php-src/pull/13304#issuecomment-1926668141 */
case ZEND_SEPARATE:
break;
default:
fprintf(stderr, "Missing result type inference for opcode %s, line %d\n", zend_get_opcode_name(opline->opcode), opline->lineno);
break;
}
}
if (ssa_op->op1_def >= 0) {
fprintf(stderr, "Missing op1 type inference for opcode %s, line %d\n", zend_get_opcode_name(opline->opcode), opline->lineno);
}
if (ssa_op->op2_def >= 0) {
fprintf(stderr, "Missing op2 type inference for opcode %s, line %d\n", zend_get_opcode_name(opline->opcode), opline->lineno);
}
#endif
if (ssa_op->op1_def >= 0) {
tmp = MAY_BE_ANY | MAY_BE_REF | MAY_BE_RC1 | MAY_BE_RCN | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF;
UPDATE_SSA_TYPE(tmp, ssa_op->op1_def);
}
unknown_opcode:
if (ssa_op->result_def >= 0) {
tmp = MAY_BE_ANY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF;
if (opline->result_type == IS_TMP_VAR) {
@ -4878,8 +5005,6 @@ ZEND_API bool zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op
switch (opline->opcode) {
case ZEND_NOP:
case ZEND_IS_IDENTICAL:
case ZEND_IS_NOT_IDENTICAL:
case ZEND_QM_ASSIGN:
case ZEND_JMP:
case ZEND_CHECK_VAR:
@ -4901,9 +5026,14 @@ ZEND_API bool zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op
case ZEND_FUNC_NUM_ARGS:
case ZEND_FUNC_GET_ARGS:
case ZEND_COPY_TMP:
case ZEND_CASE_STRICT:
case ZEND_JMP_NULL:
case ZEND_JMP_FRAMELESS:
return 0;
case ZEND_IS_IDENTICAL:
case ZEND_IS_NOT_IDENTICAL:
case ZEND_CASE_STRICT:
/* Array to array comparison may lead to recursion. */
return (t1 & t2) & MAY_BE_ARRAY_OF_ARRAY;
case ZEND_SEND_VAR:
case ZEND_SEND_VAL:
case ZEND_SEND_REF:
@ -5054,7 +5184,7 @@ ZEND_API bool zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op
return 0;
case ZEND_ASSIGN_DIM:
if ((opline+1)->op1_type == IS_CV) {
if (_ssa_op1_info(op_array, ssa, opline+1, ssa_op+1) & MAY_BE_UNDEF) {
if (OP1_DATA_INFO() & MAY_BE_UNDEF) {
return 1;
}
}
@ -5068,7 +5198,7 @@ ZEND_API bool zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op
return 1;
}
if ((opline+1)->op1_type == IS_CV) {
if (_ssa_op1_info(op_array, ssa, opline+1, ssa_op+1) & MAY_BE_UNDEF) {
if (OP1_DATA_INFO() & MAY_BE_UNDEF) {
return 1;
}
}

View file

@ -197,13 +197,13 @@ DEFINE_SSA_OP_DEF_INFO(result)
#define OP1_INFO() (_ssa_op1_info(op_array, ssa, opline, ssa_op))
#define OP2_INFO() (_ssa_op2_info(op_array, ssa, opline, ssa_op))
#define OP1_DATA_INFO() (_ssa_op1_info(op_array, ssa, (opline+1), (ssa_op+1)))
#define OP2_DATA_INFO() (_ssa_op2_info(op_array, ssa, (opline+1), (ssa_op+1)))
#define OP1_DATA_INFO() (_ssa_op1_info(op_array, ssa, (opline+1), ssa_op ? (ssa_op+1) : NULL))
#define OP2_DATA_INFO() (_ssa_op2_info(op_array, ssa, (opline+1), ssa_op ? (ssa_op+1) : NULL))
#define RES_USE_INFO() (_ssa_result_info(op_array, ssa, opline, ssa_op))
#define OP1_DEF_INFO() (_ssa_op1_def_info(op_array, ssa, opline, ssa_op))
#define OP2_DEF_INFO() (_ssa_op2_def_info(op_array, ssa, opline, ssa_op))
#define OP1_DATA_DEF_INFO() (_ssa_op1_def_info(op_array, ssa, (opline+1), (ssa_op+1)))
#define OP2_DATA_DEF_INFO() (_ssa_op2_def_info(op_array, ssa, (opline+1), (ssa_op+1)))
#define OP1_DATA_DEF_INFO() (_ssa_op1_def_info(op_array, ssa, (opline+1), ssa_op ? (ssa_op+1) : NULL))
#define OP2_DATA_DEF_INFO() (_ssa_op2_def_info(op_array, ssa, (opline+1), ssa_op ? (ssa_op+1) : NULL))
#define RES_INFO() (_ssa_result_def_info(op_array, ssa, opline, ssa_op))
static zend_always_inline bool zend_add_will_overflow(zend_long a, zend_long b) {

View file

@ -82,31 +82,8 @@ zend_result zend_optimizer_eval_unary_op(zval *result, uint8_t opcode, zval *op1
zend_result zend_optimizer_eval_cast(zval *result, uint32_t type, zval *op1) /* {{{ */
{
switch (type) {
case IS_NULL:
ZVAL_NULL(result);
return SUCCESS;
case _IS_BOOL:
ZVAL_BOOL(result, zval_is_true(op1));
return SUCCESS;
case IS_LONG:
ZVAL_LONG(result, zval_get_long(op1));
return SUCCESS;
case IS_DOUBLE:
ZVAL_DOUBLE(result, zval_get_double(op1));
return SUCCESS;
case IS_STRING:
/* Conversion from double to string takes into account run-time
'precision' setting and cannot be evaluated at compile-time */
if (Z_TYPE_P(op1) != IS_ARRAY && Z_TYPE_P(op1) != IS_DOUBLE) {
ZVAL_STR(result, zval_get_string(op1));
return SUCCESS;
}
break;
case IS_ARRAY:
ZVAL_COPY(result, op1);
convert_to_array(result);
return SUCCESS;
if (zend_try_ct_eval_cast(result, type, op1)) {
return SUCCESS;
}
return FAILURE;
}
@ -722,6 +699,7 @@ void zend_optimizer_migrate_jump(zend_op_array *op_array, zend_op *new_opline, z
case ZEND_ASSERT_CHECK:
case ZEND_JMP_NULL:
case ZEND_BIND_INIT_STATIC_OR_JMP:
case ZEND_JMP_FRAMELESS:
ZEND_SET_OP_JMP_ADDR(new_opline, new_opline->op2, ZEND_OP2_JMP_ADDR(opline));
break;
case ZEND_FE_FETCH_R:
@ -766,6 +744,7 @@ void zend_optimizer_shift_jump(zend_op_array *op_array, zend_op *opline, uint32_
case ZEND_ASSERT_CHECK:
case ZEND_JMP_NULL:
case ZEND_BIND_INIT_STATIC_OR_JMP:
case ZEND_JMP_FRAMELESS:
ZEND_SET_OP_JMP_ADDR(opline, opline->op2, ZEND_OP2_JMP_ADDR(opline) - shiftlist[ZEND_OP2_JMP_ADDR(opline) - op_array->opcodes]);
break;
case ZEND_CATCH:
@ -792,6 +771,42 @@ void zend_optimizer_shift_jump(zend_op_array *op_array, zend_op *opline, uint32_
}
}
static bool zend_optimizer_ignore_class(zval *ce_zv, zend_string *filename)
{
zend_class_entry *ce = Z_PTR_P(ce_zv);
if (ce->ce_flags & ZEND_ACC_PRELOADED) {
Bucket *ce_bucket = (Bucket*)((uintptr_t)ce_zv - XtOffsetOf(Bucket, val));
size_t offset = ce_bucket - EG(class_table)->arData;
if (offset < EG(persistent_classes_count)) {
return false;
}
}
return ce->type == ZEND_USER_CLASS
&& (!ce->info.user.filename || ce->info.user.filename != filename);
}
static bool zend_optimizer_ignore_function(zval *fbc_zv, zend_string *filename)
{
zend_function *fbc = Z_PTR_P(fbc_zv);
if (fbc->type == ZEND_INTERNAL_FUNCTION) {
return false;
} else if (fbc->type == ZEND_USER_FUNCTION) {
if (fbc->op_array.fn_flags & ZEND_ACC_PRELOADED) {
Bucket *fbc_bucket = (Bucket*)((uintptr_t)fbc_zv - XtOffsetOf(Bucket, val));
size_t offset = fbc_bucket - EG(function_table)->arData;
if (offset < EG(persistent_functions_count)) {
return false;
}
}
return !fbc->op_array.filename || fbc->op_array.filename != filename;
} else {
ZEND_ASSERT(fbc->type == ZEND_EVAL_CODE);
return true;
}
}
zend_class_entry *zend_optimizer_get_class_entry(
const zend_script *script, const zend_op_array *op_array, zend_string *lcname) {
zend_class_entry *ce = script ? zend_hash_find_ptr(&script->class_table, lcname) : NULL;
@ -799,11 +814,9 @@ zend_class_entry *zend_optimizer_get_class_entry(
return ce;
}
ce = zend_hash_find_ptr(CG(class_table), lcname);
if (ce
&& (ce->type == ZEND_INTERNAL_CLASS
|| (op_array && ce->info.user.filename == op_array->filename))) {
return ce;
zval *ce_zv = zend_hash_find(CG(class_table), lcname);
if (ce_zv && !zend_optimizer_ignore_class(ce_zv, op_array ? op_array->filename : NULL)) {
return Z_PTR_P(ce_zv);
}
if (op_array && op_array->scope && zend_string_equals_ci(op_array->scope->name, lcname)) {
@ -822,12 +835,66 @@ zend_class_entry *zend_optimizer_get_class_entry_from_op1(
}
} else if (opline->op1_type == IS_UNUSED && op_array->scope
&& !(op_array->scope->ce_flags & ZEND_ACC_TRAIT)
&& (opline->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_SELF) {
&& ((opline->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_SELF
|| ((opline->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_STATIC
&& (op_array->scope->ce_flags & ZEND_ACC_FINAL)))) {
return op_array->scope;
}
return NULL;
}
const zend_class_constant *zend_fetch_class_const_info(
const zend_script *script, const zend_op_array *op_array, const zend_op *opline, bool *is_prototype) {
const zend_class_entry *ce = NULL;
bool is_static_reference = false;
if (!opline || !op_array || opline->op2_type != IS_CONST || Z_TYPE_P(CRT_CONSTANT(opline->op2)) != IS_STRING) {
return NULL;
}
if (opline->op1_type == IS_CONST) {
zval *op1 = CRT_CONSTANT(opline->op1);
if (Z_TYPE_P(op1) == IS_STRING) {
if (script) {
ce = zend_optimizer_get_class_entry(script, op_array, Z_STR_P(op1 + 1));
} else {
zval *ce_zv = zend_hash_find(EG(class_table), Z_STR_P(op1 + 1));
if (ce_zv && !zend_optimizer_ignore_class(ce_zv, op_array->filename)) {
ce = Z_PTR_P(ce_zv);
}
}
}
} else if (opline->op1_type == IS_UNUSED
&& op_array->scope && !(op_array->scope->ce_flags & ZEND_ACC_TRAIT)
&& !(op_array->fn_flags & ZEND_ACC_TRAIT_CLONE)) {
int fetch_type = opline->op1.num & ZEND_FETCH_CLASS_MASK;
if (fetch_type == ZEND_FETCH_CLASS_SELF) {
ce = op_array->scope;
} else if (fetch_type == ZEND_FETCH_CLASS_STATIC) {
ce = op_array->scope;
is_static_reference = true;
} else if (fetch_type == ZEND_FETCH_CLASS_PARENT) {
if (op_array->scope->ce_flags & ZEND_ACC_LINKED) {
ce = op_array->scope->parent;
}
}
}
if (!ce || (ce->ce_flags & ZEND_ACC_TRAIT)) {
return NULL;
}
zend_class_constant *const_info = zend_hash_find_ptr(&ce->constants_table, Z_STR_P(CRT_CONSTANT(opline->op2)));
if (!const_info) {
return NULL;
}
if ((ZEND_CLASS_CONST_FLAGS(const_info) & ZEND_ACC_DEPRECATED)
|| ((ZEND_CLASS_CONST_FLAGS(const_info) & ZEND_ACC_PPP_MASK) != ZEND_ACC_PUBLIC && const_info->ce != op_array->scope)) {
return NULL;
}
*is_prototype = is_static_reference
&& !(const_info->ce->ce_flags & ZEND_ACC_FINAL) && !(ZEND_CLASS_CONST_FLAGS(const_info) & ZEND_ACC_FINAL);
return const_info;
}
zend_function *zend_optimizer_get_called_func(
zend_script *script, zend_op_array *op_array, zend_op *opline, bool *is_prototype)
{
@ -837,15 +904,12 @@ zend_function *zend_optimizer_get_called_func(
{
zend_string *function_name = Z_STR_P(CRT_CONSTANT(opline->op2));
zend_function *func;
zval *func_zv;
if (script && (func = zend_hash_find_ptr(&script->function_table, function_name)) != NULL) {
return func;
} else if ((func = zend_hash_find_ptr(EG(function_table), function_name)) != NULL) {
if (func->type == ZEND_INTERNAL_FUNCTION) {
return func;
} else if (func->type == ZEND_USER_FUNCTION &&
func->op_array.filename &&
func->op_array.filename == op_array->filename) {
return func;
} else if ((func_zv = zend_hash_find(EG(function_table), function_name)) != NULL) {
if (!zend_optimizer_ignore_function(func_zv, op_array->filename)) {
return Z_PTR_P(func_zv);
}
}
break;
@ -855,15 +919,12 @@ zend_function *zend_optimizer_get_called_func(
if (opline->op2_type == IS_CONST && Z_TYPE_P(CRT_CONSTANT(opline->op2)) == IS_STRING) {
zval *function_name = CRT_CONSTANT(opline->op2) + 1;
zend_function *func;
zval *func_zv;
if (script && (func = zend_hash_find_ptr(&script->function_table, Z_STR_P(function_name)))) {
return func;
} else if ((func = zend_hash_find_ptr(EG(function_table), Z_STR_P(function_name))) != NULL) {
if (func->type == ZEND_INTERNAL_FUNCTION) {
return func;
} else if (func->type == ZEND_USER_FUNCTION &&
func->op_array.filename &&
func->op_array.filename == op_array->filename) {
return func;
} else if ((func_zv = zend_hash_find(EG(function_table), Z_STR_P(function_name))) != NULL) {
if (!zend_optimizer_ignore_function(func_zv, op_array->filename)) {
return Z_PTR_P(func_zv);
}
}
}
@ -913,6 +974,28 @@ zend_function *zend_optimizer_get_called_func(
}
}
break;
case ZEND_INIT_PARENT_PROPERTY_HOOK_CALL: {
zend_class_entry *scope = op_array->scope;
ZEND_ASSERT(scope != NULL);
if ((scope->ce_flags & ZEND_ACC_LINKED) && scope->parent) {
zend_class_entry *parent_scope = scope->parent;
zend_string *prop_name = Z_STR_P(CRT_CONSTANT(opline->op1));
zend_property_hook_kind hook_kind = opline->op2.num;
zend_property_info *prop_info = zend_get_property_info(parent_scope, prop_name, /* silent */ true);
if (prop_info
&& prop_info != ZEND_WRONG_PROPERTY_INFO
&& !(prop_info->flags & ZEND_ACC_PRIVATE)
&& prop_info->hooks) {
zend_function *fbc = prop_info->hooks[hook_kind];
if (fbc) {
*is_prototype = false;
return fbc;
}
}
}
break;
}
case ZEND_NEW:
{
zend_class_entry *ce = zend_optimizer_get_class_entry_from_op1(
@ -1159,6 +1242,7 @@ static void zend_redo_pass_two(zend_op_array *op_array)
case ZEND_ASSERT_CHECK:
case ZEND_JMP_NULL:
case ZEND_BIND_INIT_STATIC_OR_JMP:
case ZEND_JMP_FRAMELESS:
opline->op2.jmp_addr = &op_array->opcodes[opline->op2.jmp_addr - old_opcodes];
break;
case ZEND_CATCH:
@ -1280,6 +1364,7 @@ static void zend_redo_pass_two_ex(zend_op_array *op_array, zend_ssa *ssa)
case ZEND_ASSERT_CHECK:
case ZEND_JMP_NULL:
case ZEND_BIND_INIT_STATIC_OR_JMP:
case ZEND_JMP_FRAMELESS:
opline->op2.jmp_addr = &op_array->opcodes[opline->op2.jmp_addr - old_opcodes];
break;
case ZEND_CATCH:
@ -1329,6 +1414,26 @@ static void zend_redo_pass_two_ex(zend_op_array *op_array, zend_ssa *ssa)
}
break;
}
#ifdef ZEND_VERIFY_TYPE_INFERENCE
if (ssa_op->op1_use >= 0) {
opline->op1_use_type = ssa->var_info[ssa_op->op1_use].type;
}
if (ssa_op->op2_use >= 0) {
opline->op2_use_type = ssa->var_info[ssa_op->op2_use].type;
}
if (ssa_op->result_use >= 0) {
opline->result_use_type = ssa->var_info[ssa_op->result_use].type;
}
if (ssa_op->op1_def >= 0) {
opline->op1_def_type = ssa->var_info[ssa_op->op1_def].type;
}
if (ssa_op->op2_def >= 0) {
opline->op2_def_type = ssa->var_info[ssa_op->op2_def].type;
}
if (ssa_op->result_def >= 0) {
opline->result_def_type = ssa->var_info[ssa_op->result_def].type;
}
#endif
zend_vm_set_opcode_handler_ex(opline, op1_info, op2_info, res_info);
opline++;
}
@ -1444,6 +1549,19 @@ void zend_foreach_op_array(zend_script *script, zend_op_array_func_t func, void
zend_foreach_op_array_helper(op_array, func, context);
}
} ZEND_HASH_FOREACH_END();
zend_property_info *property;
ZEND_HASH_MAP_FOREACH_PTR(&ce->properties_info, property) {
zend_function **hooks = property->hooks;
if (property->ce == ce && property->hooks) {
for (uint32_t i = 0; i < ZEND_PROPERTY_HOOK_COUNT; i++) {
zend_function *hook = hooks[i];
if (hook && hook->common.scope == ce && !(hooks[i]->op_array.fn_flags & ZEND_ACC_TRAIT_CLONE)) {
zend_foreach_op_array_helper(&hooks[i]->op_array, func, context);
}
}
}
} ZEND_HASH_FOREACH_END();
} ZEND_HASH_FOREACH_END();
}

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

@ -105,6 +105,8 @@ zend_class_entry *zend_optimizer_get_class_entry(
const zend_script *script, const zend_op_array *op_array, zend_string *lcname);
zend_class_entry *zend_optimizer_get_class_entry_from_op1(
const zend_script *script, const zend_op_array *op_array, const zend_op *opline);
const zend_class_constant *zend_fetch_class_const_info(
const zend_script *script, const zend_op_array *op_array, const zend_op *opline, bool *is_prototype);
void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx);
void zend_optimizer_pass3(zend_op_array *op_array, zend_optimizer_ctx *ctx);
@ -126,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) {
@ -607,7 +608,7 @@ add_op1_def:
}
break;
case ZEND_ASSIGN_OBJ_REF:
if (opline->op1_type == IS_CV) {
if ((build_flags & ZEND_SSA_RC_INFERENCE) && opline->op1_type == IS_CV) {
ssa_ops[k].op1_def = ssa_vars_count;
var[EX_VAR_TO_NUM(opline->op1.var)] = ssa_vars_count;
ssa_vars_count++;
@ -766,6 +767,35 @@ add_op1_def:
//NEW_SSA_VAR(opline->op1.var)
}
break;
case ZEND_FRAMELESS_ICALL_1:
case ZEND_FRAMELESS_ICALL_2:
case ZEND_FRAMELESS_ICALL_3: {
if ((build_flags & ZEND_SSA_RC_INFERENCE) && opline->op1_type == IS_CV) {
ssa_ops[k].op1_def = ssa_vars_count;
var[EX_VAR_TO_NUM(opline->op1.var)] = ssa_vars_count;
ssa_vars_count++;
//NEW_SSA_VAR(opline->op1.var)
}
if ((build_flags & ZEND_SSA_RC_INFERENCE) && opline->op2_type == IS_CV) {
ssa_ops[k].op2_def = ssa_vars_count;
var[EX_VAR_TO_NUM(opline->op2.var)] = ssa_vars_count;
ssa_vars_count++;
//NEW_SSA_VAR(opline->op2.var)
}
if (opline->opcode == ZEND_FRAMELESS_ICALL_3) {
next = opline + 1;
if (next->op1_type & (IS_CV|IS_VAR|IS_TMP_VAR)) {
ssa_ops[k + 1].op1_use = var[EX_VAR_TO_NUM(next->op1.var)];
//USE_SSA_VAR(op_array->last_var + next->op1.var);
if ((build_flags & ZEND_SSA_RC_INFERENCE) && next->op1_type == IS_CV) {
ssa_ops[k + 1].op1_def = ssa_vars_count;
var[EX_VAR_TO_NUM(next->op1.var)] = ssa_vars_count;
ssa_vars_count++;
//NEW_SSA_VAR(next->op1.var)
}
}
}
}
default:
break;
}
@ -787,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;
@ -795,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;
@ -887,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

@ -67,7 +67,7 @@ struct _zend_ssa_phi {
int var; /* Original CV, VAR or TMP variable index */
int ssa_var; /* SSA variable index */
int block; /* current BB index */
bool has_range_constraint : 1;
bool has_range_constraint;
zend_ssa_phi **use_chains;
zend_ssa_phi *sym_use_chain;
int *sources; /* Array of SSA IDs that produce this var.
@ -112,8 +112,8 @@ typedef struct _zend_ssa_var {
zend_ssa_phi *definition_phi; /* phi that defines this value */
zend_ssa_phi *phi_use_chain; /* uses of this value in Phi, linked through use_chain */
zend_ssa_phi *sym_use_chain; /* uses of this value in Pi constraints */
unsigned int no_val : 1; /* value doesn't matter (used as op1 in ZEND_ASSIGN) */
unsigned int scc_entry : 1;
bool no_val : 1; /* value doesn't matter (used as op1 in ZEND_ASSIGN) */
bool scc_entry : 1;
unsigned int alias : 2; /* value may be changed indirectly */
unsigned int escape_state : 2;
} zend_ssa_var;

View file

@ -4,13 +4,12 @@ dnl
dnl ZEND_CHECK_FLOAT_PRECISION
dnl
dnl x87 floating point internal precision control checks
dnl See: http://wiki.php.net/rfc/rounding
dnl See: https://wiki.php.net/rfc/rounding
dnl
AC_DEFUN([ZEND_CHECK_FLOAT_PRECISION],[
AC_MSG_CHECKING([for usable _FPU_SETCW])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <fpu_control.h>
]],[[
AC_DEFUN([ZEND_CHECK_FLOAT_PRECISION], [dnl
AC_CACHE_CHECK([for usable _FPU_SETCW],
[php_cv_have__fpu_setcw],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <fpu_control.h>], [dnl
fpu_control_t fpu_oldcw, fpu_cw;
volatile double result;
double a = 2877.0;
@ -21,18 +20,17 @@ AC_DEFUN([ZEND_CHECK_FLOAT_PRECISION],[
_FPU_SETCW(fpu_cw);
result = a / b;
_FPU_SETCW(fpu_oldcw);
]])],[ac_cfp_have__fpu_setcw=yes],[ac_cfp_have__fpu_setcw=no])
if test "$ac_cfp_have__fpu_setcw" = "yes" ; then
AC_DEFINE(HAVE__FPU_SETCW, 1, [whether _FPU_SETCW is present and usable])
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
(void)result;
])],
[php_cv_have__fpu_setcw=yes],
[php_cv_have__fpu_setcw=no])])
AS_VAR_IF([php_cv_have__fpu_setcw], [yes],
[AC_DEFINE([HAVE__FPU_SETCW], [1],
[Define to 1 if _FPU_SETCW is present and usable.])])
AC_MSG_CHECKING([for usable fpsetprec])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <machine/ieeefp.h>
]],[[
AC_CACHE_CHECK([for usable fpsetprec],
[php_cv_have_fpsetprec],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <machine/ieeefp.h>], [dnl
fp_prec_t fpu_oldprec;
volatile double result;
double a = 2877.0;
@ -42,18 +40,17 @@ AC_DEFUN([ZEND_CHECK_FLOAT_PRECISION],[
fpsetprec(FP_PD);
result = a / b;
fpsetprec(fpu_oldprec);
]])], [ac_cfp_have_fpsetprec=yes], [ac_cfp_have_fpsetprec=no])
if test "$ac_cfp_have_fpsetprec" = "yes" ; then
AC_DEFINE(HAVE_FPSETPREC, 1, [whether fpsetprec is present and usable])
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
(void)result;
])],
[php_cv_have_fpsetprec=yes],
[php_cv_have_fpsetprec=no])])
AS_VAR_IF([php_cv_have_fpsetprec], [yes],
[AC_DEFINE([HAVE_FPSETPREC], [1],
[Define to 1 if fpsetprec is present and usable.])])
AC_MSG_CHECKING([for usable _controlfp])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <float.h>
]],[[
AC_CACHE_CHECK([for usable _controlfp],
[php_cv_have__controlfp],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <float.h>], [dnl
unsigned int fpu_oldcw;
volatile double result;
double a = 2877.0;
@ -63,18 +60,17 @@ AC_DEFUN([ZEND_CHECK_FLOAT_PRECISION],[
_controlfp(_PC_53, _MCW_PC);
result = a / b;
_controlfp(fpu_oldcw, _MCW_PC);
]])], [ac_cfp_have__controlfp=yes], [ac_cfp_have__controlfp=no])
if test "$ac_cfp_have__controlfp" = "yes" ; then
AC_DEFINE(HAVE__CONTROLFP, 1, [whether _controlfp is present usable])
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
(void)result;
])],
[php_cv_have__controlfp=yes],
[php_cv_have__controlfp=no])])
AS_VAR_IF([php_cv_have__controlfp], [yes],
[AC_DEFINE([HAVE__CONTROLFP], [1],
[Define to 1 if _controlfp is present and usable.])])
AC_MSG_CHECKING([for usable _controlfp_s])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <float.h>
]],[[
AC_CACHE_CHECK([for usable _controlfp_s],
[php_cv_have__controlfp_s],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <float.h>], [dnl
unsigned int fpu_oldcw, fpu_cw;
volatile double result;
double a = 2877.0;
@ -85,18 +81,17 @@ AC_DEFUN([ZEND_CHECK_FLOAT_PRECISION],[
_controlfp_s(&fpu_cw, _PC_53, _MCW_PC);
result = a / b;
_controlfp_s(&fpu_cw, fpu_oldcw, _MCW_PC);
]])], [ac_cfp_have__controlfp_s=yes], [ac_cfp_have__controlfp_s=no])
if test "$ac_cfp_have__controlfp_s" = "yes" ; then
AC_DEFINE(HAVE__CONTROLFP_S, 1, [whether _controlfp_s is present and usable])
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
(void)result;
])],
[php_cv_have__controlfp_s=yes],
[php_cv_have__controlfp_s=no])])
AS_VAR_IF([php_cv_have__controlfp_s], [yes],
[AC_DEFINE([HAVE__CONTROLFP_S], [1],
[Define to 1 if _controlfp_s is present and usable.])])
AC_MSG_CHECKING([whether FPU control word can be manipulated by inline assembler])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
/* nothing */
]],[[
AC_CACHE_CHECK([whether FPU control word can be manipulated by inline assembler],
[php_cv_have_fpu_inline_asm_x86],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([], [dnl
unsigned int oldcw, cw;
volatile double result;
double a = 2877.0;
@ -105,235 +100,185 @@ AC_DEFUN([ZEND_CHECK_FLOAT_PRECISION],[
__asm__ __volatile__ ("fnstcw %0" : "=m" (*&oldcw));
cw = (oldcw & ~0x0 & ~0x300) | 0x200;
__asm__ __volatile__ ("fldcw %0" : : "m" (*&cw));
result = a / b;
__asm__ __volatile__ ("fldcw %0" : : "m" (*&oldcw));
]])], [ac_cfp_have_fpu_inline_asm_x86=yes], [ac_cfp_have_fpu_inline_asm_x86=no])
if test "$ac_cfp_have_fpu_inline_asm_x86" = "yes" ; then
AC_DEFINE(HAVE_FPU_INLINE_ASM_X86, 1, [whether FPU control word can be manipulated by inline assembler])
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
(void)result;
])],
[php_cv_have_fpu_inline_asm_x86=yes],
[php_cv_have_fpu_inline_asm_x86=no])])
AS_VAR_IF([php_cv_have_fpu_inline_asm_x86], [yes],
[AC_DEFINE([HAVE_FPU_INLINE_ASM_X86], [1],
[Define to 1 if FPU control word can be manipulated by inline assembler.])])
])
dnl
dnl LIBZEND_BASIC_CHECKS
dnl
dnl Basic checks specific for the Zend engine library.
dnl
AC_DEFUN([LIBZEND_BASIC_CHECKS],[
AC_REQUIRE([AC_PROG_CC])
AC_CHECK_HEADERS([cpuid.h])
dnl
dnl LIBZEND_DLSYM_CHECK
dnl ZEND_DLSYM_CHECK
dnl
dnl Ugly hack to check if dlsym() requires a leading underscore in symbol name.
dnl
AC_DEFUN([LIBZEND_DLSYM_CHECK],[
AC_DEFUN([ZEND_DLSYM_CHECK], [dnl
AC_MSG_CHECKING([whether dlsym() requires a leading underscore in symbol names])
_LT_AC_TRY_DLOPEN_SELF([
AC_MSG_RESULT(no)
], [
AC_MSG_RESULT(yes)
AC_DEFINE(DLSYM_NEEDS_UNDERSCORE, 1, [Define if dlsym() requires a leading underscore in symbol names. ])
], [
AC_MSG_RESULT(no)
], [])
_LT_AC_TRY_DLOPEN_SELF([AC_MSG_RESULT([no])], [
AC_MSG_RESULT([yes])
AC_DEFINE([DLSYM_NEEDS_UNDERSCORE], [1],
[Define to 1 if 'dlsym()' requires a leading underscore in symbol names.])
], [AC_MSG_RESULT([no])], [])
])
dnl Checks for library functions.
AC_CHECK_FUNCS(getpid kill sigsetjmp pthread_getattr_np pthread_attr_get_np pthread_get_stackaddr_np pthread_attr_getstack pthread_stackseg_np gettid)
dnl
dnl ZEND_INIT
dnl
dnl Configure checks and initialization specific for the Zend engine library.
dnl
AC_DEFUN([ZEND_INIT], [dnl
AC_REQUIRE([AC_PROG_CC])
dnl Test whether the stack grows downwards
dnl Assumes contiguous stack
AC_MSG_CHECKING(whether the stack grows downwards)
AC_CHECK_HEADERS(m4_normalize([
cpuid.h
libproc.h
]))
AC_RUN_IFELSE([AC_LANG_SOURCE([[
dnl Check for library functions.
AC_CHECK_FUNCS(m4_normalize([
getpid
gettid
kill
mremap
pthread_attr_get_np
pthread_attr_getstack
pthread_get_stackaddr_np
pthread_getattr_np
pthread_stackseg_np
strnlen
]))
AC_CHECK_DECL([clock_gettime_nsec_np],
[AC_DEFINE([HAVE_CLOCK_GETTIME_NSEC_NP], [1],
[Define to 1 if you have the declaration of 'clock_gettime_nsec_np'.])],,
[#include <time.h>])
dnl
dnl Check for sigsetjmp. If sigsetjmp is defined as a macro, use AC_CHECK_DECL
dnl as a fallback since AC_CHECK_FUNC cannot detect macros.
dnl
AC_CHECK_FUNC([sigsetjmp],,
[AC_CHECK_DECL([sigsetjmp],,
[AC_MSG_FAILURE([Required sigsetjmp not found.])],
[#include <setjmp.h>])])
ZEND_CHECK_STACK_DIRECTION
ZEND_CHECK_FLOAT_PRECISION
ZEND_DLSYM_CHECK
ZEND_CHECK_GLOBAL_REGISTER_VARIABLES
ZEND_CHECK_CPUID_COUNT
AC_MSG_CHECKING([whether to enable thread safety])
AC_MSG_RESULT([$ZEND_ZTS])
AS_VAR_IF([ZEND_ZTS], [yes], [
AC_DEFINE([ZTS], [1], [Define to 1 if thread safety (ZTS) is enabled.])
AS_VAR_APPEND([CFLAGS], [" -DZTS"])
])
AC_MSG_CHECKING([whether to enable Zend debugging])
AC_MSG_RESULT([$ZEND_DEBUG])
AH_TEMPLATE([ZEND_DEBUG],
[Define to 1 if debugging is enabled, and to 0 if not.])
AS_VAR_IF([ZEND_DEBUG], [yes], [
AC_DEFINE([ZEND_DEBUG], [1])
echo " $CFLAGS" | grep ' -g' >/dev/null || CFLAGS="$CFLAGS -g"
], [AC_DEFINE([ZEND_DEBUG], [0])])
AS_VAR_IF([GCC], [yes],
[CFLAGS="-Wall -Wextra -Wno-unused-parameter -Wno-sign-compare $CFLAGS"])
dnl Check if compiler supports -Wno-clobbered (only GCC).
AX_CHECK_COMPILE_FLAG([-Wno-clobbered],
[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"])
AX_CHECK_COMPILE_FLAG([-Wduplicated-cond],
[CFLAGS="-Wduplicated-cond $CFLAGS"])
AX_CHECK_COMPILE_FLAG([-Wlogical-op],
[CFLAGS="-Wlogical-op $CFLAGS"])
AX_CHECK_COMPILE_FLAG([-Wformat-truncation],
[CFLAGS="-Wformat-truncation $CFLAGS"])
AX_CHECK_COMPILE_FLAG([-Wstrict-prototypes],
[CFLAGS="-Wstrict-prototypes $CFLAGS"])
AX_CHECK_COMPILE_FLAG([-fno-common],
[CFLAGS="-fno-common $CFLAGS"])
ZEND_CHECK_ALIGNMENT
ZEND_CHECK_SIGNALS
ZEND_CHECK_MAX_EXECUTION_TIMERS
])
dnl
dnl ZEND_CHECK_STACK_DIRECTION
dnl
dnl Check whether the stack grows downwards, assumes contiguous stack.
dnl
AC_DEFUN([ZEND_CHECK_STACK_DIRECTION],
[AC_CACHE_CHECK([whether the stack grows downwards],
[php_cv_have_stack_limit],
[AC_RUN_IFELSE([AC_LANG_SOURCE([dnl
#include <stdint.h>
#ifdef __has_builtin
# if __has_builtin(__builtin_frame_address)
# define builtin_frame_address __builtin_frame_address(0)
# endif
#endif
int (*volatile f)(uintptr_t);
int stack_grows_downwards(uintptr_t arg) {
int local;
return (uintptr_t)&local < arg;
#ifdef builtin_frame_address
uintptr_t addr = (uintptr_t)builtin_frame_address;
#else
int local;
uintptr_t addr = (uintptr_t)&local;
#endif
return addr < arg;
}
int main(void) {
int local;
f = stack_grows_downwards;
return f((uintptr_t)&local) ? 0 : 1;
}
]])], [
AC_DEFINE([ZEND_CHECK_STACK_LIMIT], 1, [Define if checking the stack limit is supported])
AC_MSG_RESULT(yes)
], [
AC_MSG_RESULT(no)
], [
AC_MSG_RESULT(no)
])
ZEND_CHECK_FLOAT_PRECISION
])
dnl
dnl LIBZEND_OTHER_CHECKS
dnl
AC_DEFUN([LIBZEND_OTHER_CHECKS],[
AC_MSG_CHECKING(whether to enable thread-safety)
AC_MSG_RESULT($ZEND_ZTS)
AC_MSG_CHECKING(whether to enable Zend debugging)
AC_MSG_RESULT($ZEND_DEBUG)
if test "$ZEND_DEBUG" = "yes"; then
AC_DEFINE(ZEND_DEBUG,1,[ ])
echo " $CFLAGS" | grep ' -g' >/dev/null || DEBUG_CFLAGS="-g"
if test "$CFLAGS" = "-g -O2"; then
CFLAGS=-g
fi
else
AC_DEFINE(ZEND_DEBUG,0,[ ])
fi
test -n "$GCC" && CFLAGS="-Wall -Wextra -Wno-unused-parameter -Wno-sign-compare $CFLAGS"
dnl Check if compiler supports -Wno-clobbered (only GCC)
AX_CHECK_COMPILE_FLAG([-Wno-clobbered], CFLAGS="-Wno-clobbered $CFLAGS", , [-Werror])
dnl Check for support for implicit fallthrough level 1, also add after previous CFLAGS as level 3 is enabled in -Wextra
AX_CHECK_COMPILE_FLAG([-Wimplicit-fallthrough=1], CFLAGS="$CFLAGS -Wimplicit-fallthrough=1", , [-Werror])
AX_CHECK_COMPILE_FLAG([-Wduplicated-cond], CFLAGS="-Wduplicated-cond $CFLAGS", , [-Werror])
AX_CHECK_COMPILE_FLAG([-Wlogical-op], CFLAGS="-Wlogical-op $CFLAGS", , [-Werror])
AX_CHECK_COMPILE_FLAG([-Wformat-truncation], CFLAGS="-Wformat-truncation $CFLAGS", , [-Werror])
AX_CHECK_COMPILE_FLAG([-Wstrict-prototypes], CFLAGS="-Wstrict-prototypes $CFLAGS", , [-Werror])
AX_CHECK_COMPILE_FLAG([-fno-common], CFLAGS="-fno-common $CFLAGS", , [-Werror])
test -n "$DEBUG_CFLAGS" && CFLAGS="$CFLAGS $DEBUG_CFLAGS"
if test "$ZEND_ZTS" = "yes"; then
AC_DEFINE(ZTS,1,[ ])
CFLAGS="$CFLAGS -DZTS"
fi
AC_C_INLINE
AC_MSG_CHECKING(target system is Darwin)
if echo "$target" | grep "darwin" > /dev/null; then
AC_DEFINE([DARWIN], 1, [Define if the target system is darwin])
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
dnl Test and set the alignment define for ZEND_MM. This also does the
dnl logarithmic test for ZEND_MM.
AC_MSG_CHECKING(for MM alignment and log values)
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <stdio.h>
#include <stdlib.h>
typedef union _mm_align_test {
void *ptr;
double dbl;
long lng;
} mm_align_test;
#if (defined (__GNUC__) && __GNUC__ >= 2)
#define ZEND_MM_ALIGNMENT (__alignof__ (mm_align_test))
#ifdef builtin_frame_address
uintptr_t addr = (uintptr_t)builtin_frame_address;
#else
#define ZEND_MM_ALIGNMENT (sizeof(mm_align_test))
int local;
uintptr_t addr = (uintptr_t)&local;
#endif
int main(void)
{
size_t i = ZEND_MM_ALIGNMENT;
int zeros = 0;
FILE *fp;
while (i & ~0x1) {
zeros++;
i = i >> 1;
}
fp = fopen("conftest.zend", "w");
fprintf(fp, "(size_t)%zu (size_t)%d %d\n", ZEND_MM_ALIGNMENT, zeros, ZEND_MM_ALIGNMENT < 4);
fclose(fp);
return 0;
}
]])], [
LIBZEND_MM_ALIGN=`cat conftest.zend | cut -d ' ' -f 1`
LIBZEND_MM_ALIGN_LOG2=`cat conftest.zend | cut -d ' ' -f 2`
LIBZEND_MM_NEED_EIGHT_BYTE_REALIGNMENT=`cat conftest.zend | cut -d ' ' -f 3`
AC_DEFINE_UNQUOTED(ZEND_MM_ALIGNMENT, $LIBZEND_MM_ALIGN, [ ])
AC_DEFINE_UNQUOTED(ZEND_MM_ALIGNMENT_LOG2, $LIBZEND_MM_ALIGN_LOG2, [ ])
AC_DEFINE_UNQUOTED(ZEND_MM_NEED_EIGHT_BYTE_REALIGNMENT, $LIBZEND_MM_NEED_EIGHT_BYTE_REALIGNMENT, [ ])
], [], [
dnl Cross compilation needs something here.
AC_DEFINE(ZEND_MM_ALIGNMENT, 8, [ ])
AC_DEFINE(ZEND_MM_ALIGNMENT_LOG2, 3, [ ])
AC_DEFINE(ZEND_MM_NEED_EIGHT_BYTE_REALIGNMENT, 0, [ ])
])
AC_MSG_RESULT(done)
AC_CHECK_FUNCS(mremap)
AC_ARG_ENABLE([zend-signals],
[AS_HELP_STRING([--disable-zend-signals],
[whether to enable zend signal handling])],
[ZEND_SIGNALS=$enableval],
[ZEND_SIGNALS=yes])
AC_CHECK_FUNCS([sigaction], [], [
ZEND_SIGNALS=no
])
if test "$ZEND_SIGNALS" = "yes"; then
AC_DEFINE(ZEND_SIGNALS, 1, [Use zend signal handling])
CFLAGS="$CFLAGS -DZEND_SIGNALS"
fi
AC_MSG_CHECKING(whether to enable zend signal handling)
AC_MSG_RESULT($ZEND_SIGNALS)
dnl Don't enable Zend Max Execution Timers by default until PHP 8.3 to not break the ABI
AC_ARG_ENABLE([zend-max-execution-timers],
[AS_HELP_STRING([--enable-zend-max-execution-timers],
[whether to enable zend max execution timers])],
[ZEND_MAX_EXECUTION_TIMERS=$enableval],
[ZEND_MAX_EXECUTION_TIMERS=$ZEND_ZTS])
AS_CASE(["$host_alias"], [*linux*], [], [ZEND_MAX_EXECUTION_TIMERS='no'])
PHP_CHECK_FUNC(timer_create, rt)
if test "$ac_cv_func_timer_create" != "yes"; then
ZEND_MAX_EXECUTION_TIMERS='no'
fi
if test "$ZEND_MAX_EXECUTION_TIMERS" = "yes"; then
AC_DEFINE(ZEND_MAX_EXECUTION_TIMERS, 1, [Use zend max execution timers])
CFLAGS="$CFLAGS -DZEND_MAX_EXECUTION_TIMERS"
fi
AC_MSG_CHECKING(whether to enable zend max execution timers)
AC_MSG_RESULT($ZEND_MAX_EXECUTION_TIMERS)
f = stack_grows_downwards;
return f(addr) ? 0 : 1;
}])],
[php_cv_have_stack_limit=yes],
[php_cv_have_stack_limit=no],
[php_cv_have_stack_limit=no])])
AS_VAR_IF([php_cv_have_stack_limit], [yes],
[AC_DEFINE([ZEND_CHECK_STACK_LIMIT], [1],
[Define to 1 if checking the stack limit is supported.])])
])
dnl
dnl ZEND_CHECK_GLOBAL_REGISTER_VARIABLES
dnl
dnl Check whether to enable global register variables if supported.
dnl
AC_DEFUN([ZEND_CHECK_GLOBAL_REGISTER_VARIABLES], [dnl
AC_ARG_ENABLE([gcc-global-regs],
[AS_HELP_STRING([--disable-gcc-global-regs],
[whether to enable GCC global register variables])],
[Disable GCC global register variables])],
[ZEND_GCC_GLOBAL_REGS=$enableval],
[ZEND_GCC_GLOBAL_REGS=yes])
AC_MSG_CHECKING(for global register variables support)
if test "$ZEND_GCC_GLOBAL_REGS" != "no"; then
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
AS_VAR_IF([ZEND_GCC_GLOBAL_REGS], [no],,
[AC_CACHE_CHECK([whether system supports global register variables],
[php_cv_have_global_register_vars],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
#if defined(__GNUC__)
# define ZEND_GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
#else
@ -364,38 +309,158 @@ typedef int (*opcode_handler_t)(void);
register void *FP __asm__(ZEND_VM_FP_GLOBAL_REG);
register const opcode_handler_t *IP __asm__(ZEND_VM_IP_GLOBAL_REG);
int emu(const opcode_handler_t *ip, void *fp) {
const opcode_handler_t *orig_ip = IP;
void *orig_fp = FP;
IP = ip;
FP = fp;
while ((*ip)());
FP = orig_fp;
IP = orig_ip;
}
]], [[
]])], [
ZEND_GCC_GLOBAL_REGS=yes
], [
ZEND_GCC_GLOBAL_REGS=no
])
fi
if test "$ZEND_GCC_GLOBAL_REGS" = "yes"; then
AC_DEFINE([HAVE_GCC_GLOBAL_REGS], 1, [Define if the target system has support for global register variables])
fi
AC_MSG_RESULT($ZEND_GCC_GLOBAL_REGS)
const opcode_handler_t *orig_ip = IP;
void *orig_fp = FP;
IP = ip;
FP = fp;
while ((*ip)());
FP = orig_fp;
IP = orig_ip;
}], [])],
[php_cv_have_global_register_vars=yes],
[php_cv_have_global_register_vars=no])
])
AS_VAR_IF([php_cv_have_global_register_vars], [yes],
[AC_DEFINE([HAVE_GCC_GLOBAL_REGS], [1],
[Define to 1 if the target system has support for global register
variables.])],
[ZEND_GCC_GLOBAL_REGS=no])
])
AC_MSG_CHECKING([whether to enable global register variables support])
AC_MSG_RESULT([$ZEND_GCC_GLOBAL_REGS])
])
dnl
dnl ZEND_CHECK_CPUID_COUNT
dnl
dnl Check whether __cpuid_count is available.
AC_CACHE_CHECK(whether __cpuid_count is available, ac_cv_cpuid_count_available, [
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <cpuid.h>
]], [[
unsigned eax, ebx, ecx, edx;
__cpuid_count(0, 0, eax, ebx, ecx, edx);
]])], [
ac_cv_cpuid_count_available=yes
], [
ac_cv_cpuid_count_available=no
])])
if test "$ac_cv_cpuid_count_available" = "yes"; then
AC_DEFINE([HAVE_CPUID_COUNT], 1, [whether __cpuid_count is available])
fi
dnl
AC_DEFUN([ZEND_CHECK_CPUID_COUNT],
[AC_CACHE_CHECK([whether __cpuid_count is available],
[php_cv_have___cpuid_count],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <cpuid.h>], [dnl
unsigned eax, ebx, ecx, edx;
__cpuid_count(0, 0, eax, ebx, ecx, edx);
])],
[php_cv_have___cpuid_count=yes],
[php_cv_have___cpuid_count=no])])
AS_VAR_IF([php_cv_have___cpuid_count], [yes],
[AC_DEFINE([HAVE_CPUID_COUNT], [1],
[Define to 1 if '__cpuid_count' is available.])])
])
dnl
dnl ZEND_CHECK_ALIGNMENT
dnl
dnl Test and set the alignment defines for the Zend memory manager (ZEND_MM).
dnl This also does the logarithmic test.
dnl
AC_DEFUN([ZEND_CHECK_ALIGNMENT],
[AC_CACHE_CHECK([for Zend memory manager alignment and log values],
[php_cv_align_mm],
[AC_RUN_IFELSE([AC_LANG_SOURCE([
#include <stdio.h>
#include <stdlib.h>
typedef union _mm_align_test {
void *ptr;
double dbl;
long lng;
} mm_align_test;
#if (defined (__GNUC__) && __GNUC__ >= 2)
#define ZEND_MM_ALIGNMENT (__alignof__ (mm_align_test))
#else
#define ZEND_MM_ALIGNMENT (sizeof(mm_align_test))
#endif
int main(void)
{
size_t i = ZEND_MM_ALIGNMENT;
int zeros = 0;
FILE *fp;
while (i & ~0x1) {
zeros++;
i = i >> 1;
}
fp = fopen("conftest.zend", "w");
fprintf(fp, "(size_t)%zu (size_t)%d %d\n",
ZEND_MM_ALIGNMENT, zeros, ZEND_MM_ALIGNMENT < 4);
fclose(fp);
return 0;
}
])],
[php_cv_align_mm=$(cat conftest.zend)],
[php_cv_align_mm=failed],
[php_cv_align_mm="(size_t)8 (size_t)3 0"])])
AS_VAR_IF([php_cv_align_mm], [failed],
[AC_MSG_FAILURE([ZEND_MM alignment defines failed.])],
[zend_mm_alignment=$(echo $php_cv_align_mm | cut -d ' ' -f 1)
zend_mm_alignment_log2=$(echo $php_cv_align_mm | cut -d ' ' -f 2)
zend_mm_8byte_realign=$(echo $php_cv_align_mm | cut -d ' ' -f 3)
AC_DEFINE_UNQUOTED([ZEND_MM_ALIGNMENT],
[$zend_mm_alignment],
[Number of bytes for the ZEND_MM alignment.])
AC_DEFINE_UNQUOTED([ZEND_MM_ALIGNMENT_LOG2],
[$zend_mm_alignment_log2],
[Number of bytes for the logarithmic ZEND_MM alignment.])
AC_DEFINE_UNQUOTED([ZEND_MM_NEED_EIGHT_BYTE_REALIGNMENT],
[$zend_mm_8byte_realign],
[Define to 1 if ZEND_MM needs 8-byte realignment, and to 0 if not.])
])
])
dnl
dnl ZEND_CHECK_SIGNALS
dnl
dnl Check whether to enable Zend signal handling if supported by the system.
dnl
AC_DEFUN([ZEND_CHECK_SIGNALS], [dnl
AC_ARG_ENABLE([zend-signals],
[AS_HELP_STRING([--disable-zend-signals],
[Disable Zend signal handling])],
[ZEND_SIGNALS=$enableval],
[ZEND_SIGNALS=yes])
AC_CHECK_FUNCS([sigaction],, [ZEND_SIGNALS=no])
AS_VAR_IF([ZEND_SIGNALS], [yes],
[AC_DEFINE([ZEND_SIGNALS], [1],
[Define to 1 if Zend signal handling is supported and enabled.])
AS_VAR_APPEND([CFLAGS], [" -DZEND_SIGNALS"])])
AC_MSG_CHECKING([whether to enable Zend signal handling])
AC_MSG_RESULT([$ZEND_SIGNALS])
])
dnl
dnl ZEND_CHECK_MAX_EXECUTION_TIMERS
dnl
dnl Check whether to enable Zend max execution timers.
dnl
AC_DEFUN([ZEND_CHECK_MAX_EXECUTION_TIMERS], [dnl
AC_ARG_ENABLE([zend-max-execution-timers],
[AS_HELP_STRING([--enable-zend-max-execution-timers],
[Enable Zend max execution timers; when building with thread safety
(--enable-zts), they are automatically enabled by default based on the
system support])],
[ZEND_MAX_EXECUTION_TIMERS=$enableval],
[ZEND_MAX_EXECUTION_TIMERS=$ZEND_ZTS])
AS_CASE([$host_alias], [*linux*|*freebsd*],,
[ZEND_MAX_EXECUTION_TIMERS=no])
AS_VAR_IF([ZEND_MAX_EXECUTION_TIMERS], [yes],
[AC_SEARCH_LIBS([timer_create], [rt],,
[ZEND_MAX_EXECUTION_TIMERS=no])])
AS_VAR_IF([ZEND_MAX_EXECUTION_TIMERS], [yes],
[AC_DEFINE([ZEND_MAX_EXECUTION_TIMERS], [1],
[Define to 1 if Zend max execution timers are supported and enabled.])
AS_VAR_APPEND([CFLAGS], [" -DZEND_MAX_EXECUTION_TIMERS"])])
AC_MSG_CHECKING([whether to enable Zend max execution timers])
AC_MSG_RESULT([$ZEND_MAX_EXECUTION_TIMERS])
])

View file

@ -1,133 +1,133 @@
; Copyright Edward Nevill + Oliver Kowalke 2015
; Distributed under the Boost Software License, Version 1.0.
; (See accompanying file LICENSE_1_0.txt or copy at
; http://www.boost.org/LICENSE_1_0.txt)
;*******************************************************
;* *
;* ------------------------------------------------- *
;* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
;* ------------------------------------------------- *
;* | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| *
;* ------------------------------------------------- *
;* | d8 | d9 | d10 | d11 | *
;* ------------------------------------------------- *
;* ------------------------------------------------- *
;* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
;* ------------------------------------------------- *
;* | 0x20| 0x24| 0x28| 0x2c| 0x30| 0x34| 0x38| 0x3c| *
;* ------------------------------------------------- *
;* | d12 | d13 | d14 | d15 | *
;* ------------------------------------------------- *
;* ------------------------------------------------- *
;* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
;* ------------------------------------------------- *
;* | 0x40| 0x44| 0x48| 0x4c| 0x50| 0x54| 0x58| 0x5c| *
;* ------------------------------------------------- *
;* | x19 | x20 | x21 | x22 | *
;* ------------------------------------------------- *
;* ------------------------------------------------- *
;* | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
;* ------------------------------------------------- *
;* | 0x60| 0x64| 0x68| 0x6c| 0x70| 0x74| 0x78| 0x7c| *
;* ------------------------------------------------- *
;* | x23 | x24 | x25 | x26 | *
;* ------------------------------------------------- *
;* ------------------------------------------------- *
;* | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
;* ------------------------------------------------- *
;* | 0x80| 0x84| 0x88| 0x8c| 0x90| 0x94| 0x98| 0x9c| *
;* ------------------------------------------------- *
;* | x27 | x28 | FP | LR | *
;* ------------------------------------------------- *
;* ------------------------------------------------- *
;* | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | *
;* ------------------------------------------------- *
;* | 0xa0| 0xa4| 0xa8| 0xac| 0xb0| 0xb4| 0xb8| 0xbc| *
;* ------------------------------------------------- *
;* | fiber data| base | limit | dealloc | *
;* ------------------------------------------------- *
;* ------------------------------------------------- *
;* | 48 | 49 | 50 | 51 | | | *
;* ------------------------------------------------- *
;* | 0xc0| 0xc4| 0xc8| 0xcc| | | *
;* ------------------------------------------------- *
;* | PC | align | | | *
;* ------------------------------------------------- *
;* *
;*******************************************************
AREA |.text|, CODE, READONLY, ALIGN=4, CODEALIGN
EXPORT jump_fcontext
jump_fcontext proc
; prepare stack for GP + FPU
sub sp, sp, #0xd0
; save d8 - d15
stp d8, d9, [sp, #0x00]
stp d10, d11, [sp, #0x10]
stp d12, d13, [sp, #0x20]
stp d14, d15, [sp, #0x30]
; save x19-x30
stp x19, x20, [sp, #0x40]
stp x21, x22, [sp, #0x50]
stp x23, x24, [sp, #0x60]
stp x25, x26, [sp, #0x70]
stp x27, x28, [sp, #0x80]
stp x29, x30, [sp, #0x90]
; save LR as PC
str x30, [sp, #0xc0]
; save current stack base and limit
ldp x5, x6, [x18, #0x08] ; TeStackBase and TeStackLimit at ksarm64.h
stp x5, x6, [sp, #0xa0]
; save current fiber data and deallocation stack
ldr x5, [x18, #0x1478] ; TeDeallocationStack at ksarm64.h
ldr x6, [x18, #0x20] ; TeFiberData at ksarm64.h
stp x5, x6, [sp, #0xb0]
; store RSP (pointing to context-data) in X0
mov x4, sp
; restore RSP (pointing to context-data) from X1
mov sp, x0
; restore stack base and limit
ldp x5, x6, [sp, #0xa0]
stp x5, x6, [x18, #0x08] ; TeStackBase and TeStackLimit at ksarm64.h
; restore fiber data and deallocation stack
ldp x5, x6, [sp, #0xb0]
str x5, [x18, #0x1478] ; TeDeallocationStack at ksarm64.h
str x6, [x18, #0x20] ; TeFiberData at ksarm64.h
; load d8 - d15
ldp d8, d9, [sp, #0x00]
ldp d10, d11, [sp, #0x10]
ldp d12, d13, [sp, #0x20]
ldp d14, d15, [sp, #0x30]
; load x19-x30
ldp x19, x20, [sp, #0x40]
ldp x21, x22, [sp, #0x50]
ldp x23, x24, [sp, #0x60]
ldp x25, x26, [sp, #0x70]
ldp x27, x28, [sp, #0x80]
ldp x29, x30, [sp, #0x90]
; return transfer_t from jump
; pass transfer_t as first arg in context function
; X0 == FCTX, X1 == DATA
mov x0, x4
; load pc
ldr x4, [sp, #0xc0]
; restore stack from GP + FPU
add sp, sp, #0xd0
ret x4
ENDP
; Copyright Edward Nevill + Oliver Kowalke 2015
; Distributed under the Boost Software License, Version 1.0.
; (See accompanying file LICENSE_1_0.txt or copy at
; http://www.boost.org/LICENSE_1_0.txt)
;*******************************************************
;* *
;* ------------------------------------------------- *
;* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
;* ------------------------------------------------- *
;* | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| *
;* ------------------------------------------------- *
;* | d8 | d9 | d10 | d11 | *
;* ------------------------------------------------- *
;* ------------------------------------------------- *
;* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
;* ------------------------------------------------- *
;* | 0x20| 0x24| 0x28| 0x2c| 0x30| 0x34| 0x38| 0x3c| *
;* ------------------------------------------------- *
;* | d12 | d13 | d14 | d15 | *
;* ------------------------------------------------- *
;* ------------------------------------------------- *
;* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
;* ------------------------------------------------- *
;* | 0x40| 0x44| 0x48| 0x4c| 0x50| 0x54| 0x58| 0x5c| *
;* ------------------------------------------------- *
;* | x19 | x20 | x21 | x22 | *
;* ------------------------------------------------- *
;* ------------------------------------------------- *
;* | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
;* ------------------------------------------------- *
;* | 0x60| 0x64| 0x68| 0x6c| 0x70| 0x74| 0x78| 0x7c| *
;* ------------------------------------------------- *
;* | x23 | x24 | x25 | x26 | *
;* ------------------------------------------------- *
;* ------------------------------------------------- *
;* | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
;* ------------------------------------------------- *
;* | 0x80| 0x84| 0x88| 0x8c| 0x90| 0x94| 0x98| 0x9c| *
;* ------------------------------------------------- *
;* | x27 | x28 | FP | LR | *
;* ------------------------------------------------- *
;* ------------------------------------------------- *
;* | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | *
;* ------------------------------------------------- *
;* | 0xa0| 0xa4| 0xa8| 0xac| 0xb0| 0xb4| 0xb8| 0xbc| *
;* ------------------------------------------------- *
;* | fiber data| base | limit | dealloc | *
;* ------------------------------------------------- *
;* ------------------------------------------------- *
;* | 48 | 49 | 50 | 51 | | | *
;* ------------------------------------------------- *
;* | 0xc0| 0xc4| 0xc8| 0xcc| | | *
;* ------------------------------------------------- *
;* | PC | align | | | *
;* ------------------------------------------------- *
;* *
;*******************************************************
AREA |.text|, CODE, READONLY, ALIGN=4, CODEALIGN
EXPORT jump_fcontext
jump_fcontext proc
; prepare stack for GP + FPU
sub sp, sp, #0xd0
; save d8 - d15
stp d8, d9, [sp, #0x00]
stp d10, d11, [sp, #0x10]
stp d12, d13, [sp, #0x20]
stp d14, d15, [sp, #0x30]
; save x19-x30
stp x19, x20, [sp, #0x40]
stp x21, x22, [sp, #0x50]
stp x23, x24, [sp, #0x60]
stp x25, x26, [sp, #0x70]
stp x27, x28, [sp, #0x80]
stp x29, x30, [sp, #0x90]
; save LR as PC
str x30, [sp, #0xc0]
; save current stack base and limit
ldp x5, x6, [x18, #0x08] ; TeStackBase and TeStackLimit at ksarm64.h
stp x5, x6, [sp, #0xa0]
; save current fiber data and deallocation stack
ldr x5, [x18, #0x1478] ; TeDeallocationStack at ksarm64.h
ldr x6, [x18, #0x20] ; TeFiberData at ksarm64.h
stp x5, x6, [sp, #0xb0]
; store RSP (pointing to context-data) in X0
mov x4, sp
; restore RSP (pointing to context-data) from X1
mov sp, x0
; restore stack base and limit
ldp x5, x6, [sp, #0xa0]
stp x5, x6, [x18, #0x08] ; TeStackBase and TeStackLimit at ksarm64.h
; restore fiber data and deallocation stack
ldp x5, x6, [sp, #0xb0]
str x5, [x18, #0x1478] ; TeDeallocationStack at ksarm64.h
str x6, [x18, #0x20] ; TeFiberData at ksarm64.h
; load d8 - d15
ldp d8, d9, [sp, #0x00]
ldp d10, d11, [sp, #0x10]
ldp d12, d13, [sp, #0x20]
ldp d14, d15, [sp, #0x30]
; load x19-x30
ldp x19, x20, [sp, #0x40]
ldp x21, x22, [sp, #0x50]
ldp x23, x24, [sp, #0x60]
ldp x25, x26, [sp, #0x70]
ldp x27, x28, [sp, #0x80]
ldp x29, x30, [sp, #0x90]
; return transfer_t from jump
; pass transfer_t as first arg in context function
; X0 == FCTX, X1 == DATA
mov x0, x4
; load pc
ldr x4, [sp, #0xc0]
; restore stack from GP + FPU
add sp, sp, #0xd0
ret x4
ENDP
END

View file

@ -24,6 +24,10 @@
* *
****************************************************************************************/
#ifdef __x86_64__
#include "jump_x86_64_sysv_elf_gas.S"
#else
.file "jump_i386_sysv_elf_gas.S"
.text
.globl jump_fcontext
@ -91,3 +95,5 @@ jump_fcontext:
/* Mark that we don't need executable stack. */
.section .note.GNU-stack,"",%progbits
#endif

View file

@ -0,0 +1,121 @@
/*******************************************************
* *
* ------------------------------------------------- *
* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
* ------------------------------------------------- *
* | 0 | 8 | 16 | 24 | *
* ------------------------------------------------- *
* | FS0 | FS1 | FS2 | FS3 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
* ------------------------------------------------- *
* | 32 | 40 | 48 | 56 | *
* ------------------------------------------------- *
* | FS4 | FS5 | FS6 | FS7 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
* ------------------------------------------------- *
* | 64 | 72 | 80 | 88 | *
* ------------------------------------------------- *
* | S0 | S1 | S2 | S3 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
* ------------------------------------------------- *
* | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | *
* ------------------------------------------------- *
* | S4 | S5 | S6 | S7 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
* ------------------------------------------------- *
* | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | *
* ------------------------------------------------- *
* | S8 | FP | RA | PC | *
* ------------------------------------------------- *
* *
* *****************************************************/
.file "jump_loongarch64_sysv_elf_gas.S"
.text
.globl jump_fcontext
.align 2
.type jump_fcontext,@function
jump_fcontext:
# reserve space on stack
addi.d $sp, $sp, -160
# save fs0 - fs7
fst.d $fs0, $sp, 0
fst.d $fs1, $sp, 8
fst.d $fs2, $sp, 16
fst.d $fs3, $sp, 24
fst.d $fs4, $sp, 32
fst.d $fs5, $sp, 40
fst.d $fs6, $sp, 48
fst.d $fs7, $sp, 56
# save s0 - s8, fp, ra
st.d $s0, $sp, 64
st.d $s1, $sp, 72
st.d $s2, $sp, 80
st.d $s3, $sp, 88
st.d $s4, $sp, 96
st.d $s5, $sp, 104
st.d $s6, $sp, 112
st.d $s7, $sp, 120
st.d $s8, $sp, 128
st.d $fp, $sp, 136
st.d $ra, $sp, 144
# save RA as PC
st.d $ra, $sp, 152
# store SP (pointing to context-data) in A2
move $a2, $sp
# restore SP (pointing to context-data) from A0
move $sp, $a0
# load fs0 - fs7
fld.d $fs0, $sp, 0
fld.d $fs1, $sp, 8
fld.d $fs2, $sp, 16
fld.d $fs3, $sp, 24
fld.d $fs4, $sp, 32
fld.d $fs5, $sp, 40
fld.d $fs6, $sp, 48
fld.d $fs7, $sp, 56
#load s0 - s7
ld.d $s0, $sp, 64
ld.d $s1, $sp, 72
ld.d $s2, $sp, 80
ld.d $s3, $sp, 88
ld.d $s4, $sp, 96
ld.d $s5, $sp, 104
ld.d $s6, $sp, 112
ld.d $s7, $sp, 120
ld.d $s8, $sp, 128
ld.d $fp, $sp, 136
ld.d $ra, $sp, 144
# return transfer_t from jump
# pass transfer_t as first arg in context function
# a0 == FCTX, a1 == DATA
move $a0, $a2
# load PC
ld.d $a2, $sp, 152
# restore stack
addi.d $sp, $sp, 160
# jump to context
jr $a2
.size jump_fcontext, .-jump_fcontext
/* Mark that we don't need executable stack. */
.section .note.GNU-stack,"",%progbits

View file

@ -0,0 +1,49 @@
/*
Copyright Claudio Jeker 2024
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
/*
* typedef struct {
* void *handle;
* zend_fiber_transfer *transfer;
* } boost_context_data;
*
* boost_context_data jump_fcontext(void *to, zend_fiber_transfer *transfer);
*/
#define CC64FSZ 176
#define BIAS 2047
#define SP 128
#define I7 136
.file "jump_sparc64_sysv_elf_gas.S"
.text
.align 4
.global jump_fcontext
.type jump_fcontext, %function
jump_fcontext:
# prepare stack
save %sp, -CC64FSZ, %sp
# store framepointer and return address in slots reserved
# for arguments
stx %fp, [%sp + BIAS + SP]
stx %i7, [%sp + BIAS + I7]
mov %sp, %o0
# force flush register windows to stack and with that save context
flushw
# get SP (pointing to new context-data) from %i0 param
mov %i0, %sp
# load framepointer and return address from context
ldx [%sp + BIAS + SP], %fp
ldx [%sp + BIAS + I7], %i7
ret
restore %o0, %g0, %o0
# restore old %sp (pointing to old context-data) in %o0
# *data stored in %o1 was not modified
.size jump_fcontext,.-jump_fcontext
# Mark that we don't need executable stack.
.section .note.GNU-stack,"",%progbits

View file

@ -0,0 +1,205 @@
/*
Copyright Oliver Kowalke 2009.
Copyright Thomas Sailer 2013.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
/*************************************************************************************
* ---------------------------------------------------------------------------------- *
* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
* ---------------------------------------------------------------------------------- *
* | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c | *
* ---------------------------------------------------------------------------------- *
* | SEE registers (XMM6-XMM15) | *
* ---------------------------------------------------------------------------------- *
* ---------------------------------------------------------------------------------- *
* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
* ---------------------------------------------------------------------------------- *
* | 0x20 | 0x24 | 0x28 | 0x2c | 0x30 | 0x34 | 0x38 | 0x3c | *
* ---------------------------------------------------------------------------------- *
* | SEE registers (XMM6-XMM15) | *
* ---------------------------------------------------------------------------------- *
* ---------------------------------------------------------------------------------- *
* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
* ---------------------------------------------------------------------------------- *
* | 0xe40 | 0x44 | 0x48 | 0x4c | 0x50 | 0x54 | 0x58 | 0x5c | *
* ---------------------------------------------------------------------------------- *
* | SEE registers (XMM6-XMM15) | *
* ---------------------------------------------------------------------------------- *
* ---------------------------------------------------------------------------------- *
* | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
* ---------------------------------------------------------------------------------- *
* | 0x60 | 0x64 | 0x68 | 0x6c | 0x70 | 0x74 | 0x78 | 0x7c | *
* ---------------------------------------------------------------------------------- *
* | SEE registers (XMM6-XMM15) | *
* ---------------------------------------------------------------------------------- *
* ---------------------------------------------------------------------------------- *
* | 32 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | *
* ---------------------------------------------------------------------------------- *
* | 0x80 | 0x84 | 0x88 | 0x8c | 0x90 | 0x94 | 0x98 | 0x9c | *
* ---------------------------------------------------------------------------------- *
* | SEE registers (XMM6-XMM15) | *
* ---------------------------------------------------------------------------------- *
* ---------------------------------------------------------------------------------- *
* | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | *
* ---------------------------------------------------------------------------------- *
* | 0xa0 | 0xa4 | 0xa8 | 0xac | 0xb0 | 0xb4 | 0xb8 | 0xbc | *
* ---------------------------------------------------------------------------------- *
* | fc_mxcsr|fc_x87_cw| <alignment> | fbr_strg | fc_dealloc | *
* ---------------------------------------------------------------------------------- *
* ---------------------------------------------------------------------------------- *
* | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | *
* ---------------------------------------------------------------------------------- *
* | 0xc0 | 0xc4 | 0xc8 | 0xcc | 0xd0 | 0xd4 | 0xd8 | 0xdc | *
* ---------------------------------------------------------------------------------- *
* | limit | base | R12 | R13 | *
* ---------------------------------------------------------------------------------- *
* ---------------------------------------------------------------------------------- *
* | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | *
* ---------------------------------------------------------------------------------- *
* | 0xe0 | 0xe4 | 0xe8 | 0xec | 0xf0 | 0xf4 | 0xf8 | 0xfc | *
* ---------------------------------------------------------------------------------- *
* | R14 | R15 | RDI | RSI | *
* ---------------------------------------------------------------------------------- *
* ---------------------------------------------------------------------------------- *
* | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | *
* ---------------------------------------------------------------------------------- *
* | 0x100 | 0x104 | 0x108 | 0x10c | 0x110 | 0x114 | 0x118 | 0x11c | *
* ---------------------------------------------------------------------------------- *
* | RBX | RBP | hidden | RIP | *
* ---------------------------------------------------------------------------------- *
* ---------------------------------------------------------------------------------- *
* | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | *
* ---------------------------------------------------------------------------------- *
* | 0x120 | 0x124 | 0x128 | 0x12c | 0x130 | 0x134 | 0x138 | 0x13c | *
* ---------------------------------------------------------------------------------- *
* | parameter area | *
* ---------------------------------------------------------------------------------- *
* ---------------------------------------------------------------------------------- *
* | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | *
* ---------------------------------------------------------------------------------- *
* | 0x140 | 0x144 | 0x148 | 0x14c | 0x150 | 0x154 | 0x158 | 0x15c | *
* ---------------------------------------------------------------------------------- *
* | FCTX | DATA | | *
* ---------------------------------------------------------------------------------- *
**************************************************************************************/
.file "jump_x86_64_ms_pe_gas.asm"
.text
.p2align 4,,15
.def jump_fcontext; .scl 2; .type 32; .endef
.seh_proc jump_fcontext
jump_fcontext:
.seh_endprologue
leaq -0x118(%rsp), %rsp /* prepare stack */
#if !defined(BOOST_USE_TSX)
/* save XMM storage */
movaps %xmm6, 0x0(%rsp)
movaps %xmm7, 0x10(%rsp)
movaps %xmm8, 0x20(%rsp)
movaps %xmm9, 0x30(%rsp)
movaps %xmm10, 0x40(%rsp)
movaps %xmm11, 0x50(%rsp)
movaps %xmm12, 0x60(%rsp)
movaps %xmm13, 0x70(%rsp)
movaps %xmm14, 0x80(%rsp)
movaps %xmm15, 0x90(%rsp)
stmxcsr 0xa0(%rsp) /* save MMX control- and status-word */
fnstcw 0xa4(%rsp) /* save x87 control-word */
#endif
/* load NT_TIB */
movq %gs:(0x30), %r10
/* save fiber local storage */
movq 0x20(%r10), %rax
movq %rax, 0xb0(%rsp)
/* save current deallocation stack */
movq 0x1478(%r10), %rax
movq %rax, 0xb8(%rsp)
/* save current stack limit */
movq 0x10(%r10), %rax
movq %rax, 0xc0(%rsp)
/* save current stack base */
movq 0x08(%r10), %rax
movq %rax, 0xc8(%rsp)
movq %r12, 0xd0(%rsp) /* save R12 */
movq %r13, 0xd8(%rsp) /* save R13 */
movq %r14, 0xe0(%rsp) /* save R14 */
movq %r15, 0xe8(%rsp) /* save R15 */
movq %rdi, 0xf0(%rsp) /* save RDI */
movq %rsi, 0xf8(%rsp) /* save RSI */
movq %rbx, 0x100(%rsp) /* save RBX */
movq %rbp, 0x108(%rsp) /* save RBP */
movq %rcx, 0x110(%rsp) /* save hidden address of transport_t */
/* preserve RSP (pointing to context-data) in R9 */
movq %rsp, %r9
/* restore RSP (pointing to context-data) from RDX */
movq %rdx, %rsp
#if !defined(BOOST_USE_TSX)
/* restore XMM storage */
movaps 0x0(%rsp), %xmm6
movaps 0x10(%rsp), %xmm7
movaps 0x20(%rsp), %xmm8
movaps 0x30(%rsp), %xmm9
movaps 0x40(%rsp), %xmm10
movaps 0x50(%rsp), %xmm11
movaps 0x60(%rsp), %xmm12
movaps 0x70(%rsp), %xmm13
movaps 0x80(%rsp), %xmm14
movaps 0x90(%rsp), %xmm15
ldmxcsr 0xa0(%rsp) /* restore MMX control- and status-word */
fldcw 0xa4(%rsp) /* restore x87 control-word */
#endif
/* load NT_TIB */
movq %gs:(0x30), %r10
/* restore fiber local storage */
movq 0xb0(%rsp), %rax
movq %rax, 0x20(%r10)
/* restore current deallocation stack */
movq 0xb8(%rsp), %rax
movq %rax, 0x1478(%r10)
/* restore current stack limit */
movq 0xc0(%rsp), %rax
movq %rax, 0x10(%r10)
/* restore current stack base */
movq 0xc8(%rsp), %rax
movq %rax, 0x08(%r10)
movq 0xd0(%rsp), %r12 /* restore R12 */
movq 0xd8(%rsp), %r13 /* restore R13 */
movq 0xe0(%rsp), %r14 /* restore R14 */
movq 0xe8(%rsp), %r15 /* restore R15 */
movq 0xf0(%rsp), %rdi /* restore RDI */
movq 0xf8(%rsp), %rsi /* restore RSI */
movq 0x100(%rsp), %rbx /* restore RBX */
movq 0x108(%rsp), %rbp /* restore RBP */
movq 0x110(%rsp), %rax /* restore hidden address of transport_t */
leaq 0x118(%rsp), %rsp /* prepare stack */
/* restore return-address */
popq %r10
/* transport_t returned in RAX */
/* return parent fcontext_t */
movq %r9, 0x0(%rax)
/* return data */
movq %r8, 0x8(%rax)
/* transport_t as 1.arg of context-function */
movq %rax, %rcx
/* indirect jump to context */
jmp *%r10
.seh_endproc

View file

@ -31,13 +31,16 @@
* *
****************************************************************************************/
# if defined __CET__
# include <cet.h>
# define SHSTK_ENABLED (__CET__ & 0x2)
# define BOOST_CONTEXT_SHADOW_STACK (SHSTK_ENABLED && SHADOW_STACK_SYSCALL)
# ifdef __i386__
# include "jump_i386_sysv_elf_gas.S"
# else
# define _CET_ENDBR
# endif
# if defined __CET__
# include <cet.h>
# define SHSTK_ENABLED (__CET__ & 0x2)
# define BOOST_CONTEXT_SHADOW_STACK (SHSTK_ENABLED && SHADOW_STACK_SYSCALL)
# else
# define _CET_ENDBR
# endif
.file "jump_x86_64_sysv_elf_gas.S"
.text
.globl jump_fcontext
@ -148,3 +151,4 @@ jump_fcontext:
/* Mark that we don't need executable stack. */
.section .note.GNU-stack,"",%progbits
# endif

View file

@ -1,107 +1,107 @@
; Copyright Edward Nevill + Oliver Kowalke 2015
; Distributed under the Boost Software License, Version 1.0.
; (See accompanying file LICENSE_1_0.txt or copy at
; http://www.boost.org/LICENSE_1_0.txt)
;*******************************************************
;* *
;* ------------------------------------------------- *
;* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
;* ------------------------------------------------- *
;* | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| *
;* ------------------------------------------------- *
;* | d8 | d9 | d10 | d11 | *
;* ------------------------------------------------- *
;* ------------------------------------------------- *
;* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
;* ------------------------------------------------- *
;* | 0x20| 0x24| 0x28| 0x2c| 0x30| 0x34| 0x38| 0x3c| *
;* ------------------------------------------------- *
;* | d12 | d13 | d14 | d15 | *
;* ------------------------------------------------- *
;* ------------------------------------------------- *
;* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
;* ------------------------------------------------- *
;* | 0x40| 0x44| 0x48| 0x4c| 0x50| 0x54| 0x58| 0x5c| *
;* ------------------------------------------------- *
;* | x19 | x20 | x21 | x22 | *
;* ------------------------------------------------- *
;* ------------------------------------------------- *
;* | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
;* ------------------------------------------------- *
;* | 0x60| 0x64| 0x68| 0x6c| 0x70| 0x74| 0x78| 0x7c| *
;* ------------------------------------------------- *
;* | x23 | x24 | x25 | x26 | *
;* ------------------------------------------------- *
;* ------------------------------------------------- *
;* | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
;* ------------------------------------------------- *
;* | 0x80| 0x84| 0x88| 0x8c| 0x90| 0x94| 0x98| 0x9c| *
;* ------------------------------------------------- *
;* | x27 | x28 | FP | LR | *
;* ------------------------------------------------- *
;* ------------------------------------------------- *
;* | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | *
;* ------------------------------------------------- *
;* | 0xa0| 0xa4| 0xa8| 0xac| 0xb0| 0xb4| 0xb8| 0xbc| *
;* ------------------------------------------------- *
;* | base | limit | dealloc | fiber data| *
;* ------------------------------------------------- *
;* ------------------------------------------------- *
;* | 48 | 49 | 50 | 51 | | | *
;* ------------------------------------------------- *
;* | 0xc0| 0xc4| 0xc8| 0xcc| | | *
;* ------------------------------------------------- *
;* | PC | align | | | *
;* ------------------------------------------------- *
;* *
;*******************************************************
AREA |.text|, CODE, READONLY, ALIGN=4, CODEALIGN
EXPORT make_fcontext
IMPORT _exit
make_fcontext proc
; save stack top address to x3
mov x3, x0
; shift address in x0 (allocated stack) to lower 16 byte boundary
and x0, x0, ~0xF
; reserve space for context-data on context-stack
sub x0, x0, #0xd0
; save top address of context_stack as 'base'
str x3, [x0, #0xa0]
; save bottom address of context-stack as 'limit' and 'dealloction stack'
sub x3, x3, x1
stp x3, x3, [x0, #0xa8]
; save 0 as 'fiber data'
str xzr, [x0, #0xb8]
; third arg of make_fcontext() == address of context-function
; store address as x19 for trampoline
str x2, [x0, #0x40]
; store trampoline address as pc
adr x2, trampoline
str x2, [x0, #0xc0]
; save address of finish as return-address for context-function
; will be entered after context-function returns (LR register)
adr x1, finish
str x1, [x0, #0x98]
ret x30 ; return pointer to context-data (x0)
trampoline
stp fp, lr, [sp, #-0x10]!
mov fp, sp
blr x19
finish
; exit code is zero
mov x0, #0
; exit application
bl _exit
ENDP
END
; Copyright Edward Nevill + Oliver Kowalke 2015
; Distributed under the Boost Software License, Version 1.0.
; (See accompanying file LICENSE_1_0.txt or copy at
; http://www.boost.org/LICENSE_1_0.txt)
;*******************************************************
;* *
;* ------------------------------------------------- *
;* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
;* ------------------------------------------------- *
;* | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| *
;* ------------------------------------------------- *
;* | d8 | d9 | d10 | d11 | *
;* ------------------------------------------------- *
;* ------------------------------------------------- *
;* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
;* ------------------------------------------------- *
;* | 0x20| 0x24| 0x28| 0x2c| 0x30| 0x34| 0x38| 0x3c| *
;* ------------------------------------------------- *
;* | d12 | d13 | d14 | d15 | *
;* ------------------------------------------------- *
;* ------------------------------------------------- *
;* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
;* ------------------------------------------------- *
;* | 0x40| 0x44| 0x48| 0x4c| 0x50| 0x54| 0x58| 0x5c| *
;* ------------------------------------------------- *
;* | x19 | x20 | x21 | x22 | *
;* ------------------------------------------------- *
;* ------------------------------------------------- *
;* | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
;* ------------------------------------------------- *
;* | 0x60| 0x64| 0x68| 0x6c| 0x70| 0x74| 0x78| 0x7c| *
;* ------------------------------------------------- *
;* | x23 | x24 | x25 | x26 | *
;* ------------------------------------------------- *
;* ------------------------------------------------- *
;* | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
;* ------------------------------------------------- *
;* | 0x80| 0x84| 0x88| 0x8c| 0x90| 0x94| 0x98| 0x9c| *
;* ------------------------------------------------- *
;* | x27 | x28 | FP | LR | *
;* ------------------------------------------------- *
;* ------------------------------------------------- *
;* | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | *
;* ------------------------------------------------- *
;* | 0xa0| 0xa4| 0xa8| 0xac| 0xb0| 0xb4| 0xb8| 0xbc| *
;* ------------------------------------------------- *
;* | base | limit | dealloc | fiber data| *
;* ------------------------------------------------- *
;* ------------------------------------------------- *
;* | 48 | 49 | 50 | 51 | | | *
;* ------------------------------------------------- *
;* | 0xc0| 0xc4| 0xc8| 0xcc| | | *
;* ------------------------------------------------- *
;* | PC | align | | | *
;* ------------------------------------------------- *
;* *
;*******************************************************
AREA |.text|, CODE, READONLY, ALIGN=4, CODEALIGN
EXPORT make_fcontext
IMPORT _exit
make_fcontext proc
; save stack top address to x3
mov x3, x0
; shift address in x0 (allocated stack) to lower 16 byte boundary
and x0, x0, ~0xF
; reserve space for context-data on context-stack
sub x0, x0, #0xd0
; save top address of context_stack as 'base'
str x3, [x0, #0xa0]
; save bottom address of context-stack as 'limit' and 'dealloction stack'
sub x3, x3, x1
stp x3, x3, [x0, #0xa8]
; save 0 as 'fiber data'
str xzr, [x0, #0xb8]
; third arg of make_fcontext() == address of context-function
; store address as x19 for trampoline
str x2, [x0, #0x40]
; store trampoline address as pc
adr x2, trampoline
str x2, [x0, #0xc0]
; save address of finish as return-address for context-function
; will be entered after context-function returns (LR register)
adr x1, finish
str x1, [x0, #0x98]
ret x30 ; return pointer to context-data (x0)
trampoline
stp fp, lr, [sp, #-0x10]!
mov fp, sp
blr x19
finish
; exit code is zero
mov x0, #0
; exit application
bl _exit
ENDP
END

View file

@ -24,6 +24,10 @@
* *
****************************************************************************************/
#ifdef __x86_64__
#include "make_x86_64_sysv_elf_gas.S"
#else
.file "make_i386_sysv_elf_gas.S"
.text
.globl make_fcontext
@ -111,3 +115,5 @@ finish:
/* Mark that we don't need executable stack. */
.section .note.GNU-stack,"",%progbits
#endif

View file

@ -0,0 +1,72 @@
/*******************************************************
* *
* ------------------------------------------------- *
* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
* ------------------------------------------------- *
* | 0 | 8 | 16 | 24 | *
* ------------------------------------------------- *
* | FS0 | FS1 | FS2 | FS3 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
* ------------------------------------------------- *
* | 32 | 40 | 48 | 56 | *
* ------------------------------------------------- *
* | FS4 | FS5 | FS6 | FS7 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
* ------------------------------------------------- *
* | 64 | 72 | 80 | 88 | *
* ------------------------------------------------- *
* | S0 | S1 | S2 | S3 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
* ------------------------------------------------- *
* | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | *
* ------------------------------------------------- *
* | S4 | S5 | S6 | S7 | *
* ------------------------------------------------- *
* ------------------------------------------------- *
* | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
* ------------------------------------------------- *
* | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | *
* ------------------------------------------------- *
* | S8 | FP | RA | PC | *
* ------------------------------------------------- *
* *
* *****************************************************/
.file "make_loongarch64_sysv_elf_gas.S"
.text
.globl make_fcontext
.align 2
.type make_fcontext,@function
make_fcontext:
# shift address in A0 to lower 16 byte boundary
bstrins.d $a0, $zero, 3, 0
# reserve space for context-data on context-stack
addi.d $a0, $a0, -160
# third arg of make_fcontext() == address of context-function
st.d $a2, $a0, 152
# save address of finish as return-address for context-function
# will be entered after context-function returns
la.local $a4, finish
st.d $a4, $a0, 144
# return pointer to context-data
jr $ra
finish:
# exit code is zero
li.d $a0, 0
# call _exit(0)
b %plt(_exit)
.size make_fcontext, .-make_fcontext
/* Mark that we don't need executable stack. */
.section .note.GNU-stack,"",%progbits

View file

@ -64,6 +64,7 @@
* | FCTX | DATA | | | *
* ------------------------------------------------- *
* *
*******************************************************/
.text
.globl _make_fcontext

View file

@ -0,0 +1,68 @@
/*
Copyright Claudio Jeker 2024
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
/*
* void *make_fcontext(void *sp, size_t size, void (*fn)(boost_context_data));
*/
#define CC64FSZ 176
#define BIAS 2047
#define FP 112
#define SP 128
#define I7 136
.file "make_sparc64_sysv_elf_gas.S"
.text
.align 4
.global make_fcontext
.type make_fcontext, %function
make_fcontext:
save %sp, -CC64FSZ, %sp
# shift address in %i0 (allocated stack) to lower 16 byte boundary
and %i0, -0xf, %i0
# reserve space for two frames on the stack
# the first frame is for the call the second one holds the data
# for jump_fcontext
sub %i0, 2 * CC64FSZ, %i0
# third argument of make_fcontext() is the context-function to call
# store it in the first stack frame, also clear %fp there to indicate
# the end of the stack.
stx %i2, [%i0 + CC64FSZ + I7]
stx %g0, [%i0 + CC64FSZ + FP]
# On OpenBSD stackghost prevents overriding the return address on
# a stack frame. So this code uses an extra trampoline to load
# to call the context-function and then do the _exit(0) dance.
# Extract the full address of the trampoline via pc relative addressing
1:
rd %pc, %l0
add %l0, (trampoline - 1b - 8), %l0
stx %l0, [%i0 + I7]
# Save framepointer to first stack frame but first substract the BIAS
add %i0, CC64FSZ - BIAS, %l0
stx %l0, [%i0 + SP]
# Return context-data which is also includes the BIAS
ret
restore %i0, -BIAS, %o0
trampoline:
ldx [%sp + BIAS + I7], %l0
# no need to setup boost_context_data, already in %o0 and %o1
jmpl %l0, %o7
nop
call _exit
clr %o0
unimp
.size make_fcontext,.-make_fcontext
# Mark that we don't need executable stack.
.section .note.GNU-stack,"",%progbits

View file

@ -0,0 +1,170 @@
/*
Copyright Oliver Kowalke 2009.
Copyright Thomas Sailer 2013.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
/*************************************************************************************
* ---------------------------------------------------------------------------------- *
* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
* ---------------------------------------------------------------------------------- *
* | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c | *
* ---------------------------------------------------------------------------------- *
* | SEE registers (XMM6-XMM15) | *
* ---------------------------------------------------------------------------------- *
* ---------------------------------------------------------------------------------- *
* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
* ---------------------------------------------------------------------------------- *
* | 0x20 | 0x24 | 0x28 | 0x2c | 0x30 | 0x34 | 0x38 | 0x3c | *
* ---------------------------------------------------------------------------------- *
* | SEE registers (XMM6-XMM15) | *
* ---------------------------------------------------------------------------------- *
* ---------------------------------------------------------------------------------- *
* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
* ---------------------------------------------------------------------------------- *
* | 0xe40 | 0x44 | 0x48 | 0x4c | 0x50 | 0x54 | 0x58 | 0x5c | *
* ---------------------------------------------------------------------------------- *
* | SEE registers (XMM6-XMM15) | *
* ---------------------------------------------------------------------------------- *
* ---------------------------------------------------------------------------------- *
* | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
* ---------------------------------------------------------------------------------- *
* | 0x60 | 0x64 | 0x68 | 0x6c | 0x70 | 0x74 | 0x78 | 0x7c | *
* ---------------------------------------------------------------------------------- *
* | SEE registers (XMM6-XMM15) | *
* ---------------------------------------------------------------------------------- *
* ---------------------------------------------------------------------------------- *
* | 32 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | *
* ---------------------------------------------------------------------------------- *
* | 0x80 | 0x84 | 0x88 | 0x8c | 0x90 | 0x94 | 0x98 | 0x9c | *
* ---------------------------------------------------------------------------------- *
* | SEE registers (XMM6-XMM15) | *
* ---------------------------------------------------------------------------------- *
* ---------------------------------------------------------------------------------- *
* | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | *
* ---------------------------------------------------------------------------------- *
* | 0xa0 | 0xa4 | 0xa8 | 0xac | 0xb0 | 0xb4 | 0xb8 | 0xbc | *
* ---------------------------------------------------------------------------------- *
* | fc_mxcsr|fc_x87_cw| <alignment> | fbr_strg | fc_dealloc | *
* ---------------------------------------------------------------------------------- *
* ---------------------------------------------------------------------------------- *
* | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | *
* ---------------------------------------------------------------------------------- *
* | 0xc0 | 0xc4 | 0xc8 | 0xcc | 0xd0 | 0xd4 | 0xd8 | 0xdc | *
* ---------------------------------------------------------------------------------- *
* | limit | base | R12 | R13 | *
* ---------------------------------------------------------------------------------- *
* ---------------------------------------------------------------------------------- *
* | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | *
* ---------------------------------------------------------------------------------- *
* | 0xe0 | 0xe4 | 0xe8 | 0xec | 0xf0 | 0xf4 | 0xf8 | 0xfc | *
* ---------------------------------------------------------------------------------- *
* | R14 | R15 | RDI | RSI | *
* ---------------------------------------------------------------------------------- *
* ---------------------------------------------------------------------------------- *
* | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | *
* ---------------------------------------------------------------------------------- *
* | 0x100 | 0x104 | 0x108 | 0x10c | 0x110 | 0x114 | 0x118 | 0x11c | *
* ---------------------------------------------------------------------------------- *
* | RBX | RBP | hidden | RIP | *
* ---------------------------------------------------------------------------------- *
* ---------------------------------------------------------------------------------- *
* | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | *
* ---------------------------------------------------------------------------------- *
* | 0x120 | 0x124 | 0x128 | 0x12c | 0x130 | 0x134 | 0x138 | 0x13c | *
* ---------------------------------------------------------------------------------- *
* | parameter area | *
* ---------------------------------------------------------------------------------- *
* ---------------------------------------------------------------------------------- *
* | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | *
* ---------------------------------------------------------------------------------- *
* | 0x140 | 0x144 | 0x148 | 0x14c | 0x150 | 0x154 | 0x158 | 0x15c | *
* ---------------------------------------------------------------------------------- *
* | FCTX | DATA | | *
* ---------------------------------------------------------------------------------- *
**************************************************************************************/
.file "make_x86_64_ms_pe_gas.asm"
.text
.p2align 4,,15
.def make_fcontext; .scl 2; .type 32; .endef
.seh_proc make_fcontext
make_fcontext:
.seh_endprologue
/* first arg of make_fcontext() == top of context-stack */
movq %rcx, %rax
/* shift address in RAX to lower 16 byte boundary */
/* == pointer to fcontext_t and address of context stack */
andq $-16, %rax
/* reserve space for context-data on context-stack */
/* on context-function entry: (RSP -0x8) % 16 == 0 */
leaq -0x150(%rax), %rax
/* third arg of make_fcontext() == address of context-function */
movq %r8, 0x100(%rax)
/* first arg of make_fcontext() == top of context-stack */
/* save top address of context stack as 'base' */
movq %rcx, 0xc8(%rax)
/* second arg of make_fcontext() == size of context-stack */
/* negate stack size for LEA instruction (== substraction) */
negq %rdx
/* compute bottom address of context stack (limit) */
leaq (%rcx,%rdx), %rcx
/* save bottom address of context stack as 'limit' */
movq %rcx, 0xc0(%rax)
/* save address of context stack limit as 'dealloction stack' */
movq %rcx, 0xb8(%rax)
/* set fiber-storage to zero */
xorq %rcx, %rcx
movq %rcx, 0xb0(%rax)
/* save MMX control- and status-word */
stmxcsr 0xa0(%rax)
/* save x87 control-word */
fnstcw 0xa4(%rax)
/* compute address of transport_t */
leaq 0x140(%rax), %rcx
/* store address of transport_t in hidden field */
movq %rcx, 0x110(%rax)
/* compute abs address of label trampoline */
leaq trampoline(%rip), %rcx
/* save address of finish as return-address for context-function */
/* will be entered after jump_fcontext() first time */
movq %rcx, 0x118(%rax)
/* compute abs address of label finish */
leaq finish(%rip), %rcx
/* save address of finish as return-address for context-function */
/* will be entered after context-function returns */
movq %rcx, 0x108(%rax)
ret /* return pointer to context-data */
trampoline:
/* store return address on stack */
/* fix stack alignment */
pushq %rbp
/* jump to context-function */
jmp *%rbx
finish:
/* 32byte shadow-space for _exit() */
andq $-32, %rsp
/* 32byte shadow-space for _exit() are */
/* already reserved by make_fcontext() */
/* exit code is zero */
xorq %rcx, %rcx
/* exit application */
call _exit
hlt
.seh_endproc
.def _exit; .scl 2; .type 32; .endef /* standard C library function */

View file

@ -31,13 +31,16 @@
* *
****************************************************************************************/
# if defined __CET__
# include <cet.h>
# define SHSTK_ENABLED (__CET__ & 0x2)
# define BOOST_CONTEXT_SHADOW_STACK (SHSTK_ENABLED && SHADOW_STACK_SYSCALL)
# ifdef __i386__
# include "make_i386_sysv_elf_gas.S"
# else
# define _CET_ENDBR
# endif
# if defined __CET__
# include <cet.h>
# define SHSTK_ENABLED (__CET__ & 0x2)
# define BOOST_CONTEXT_SHADOW_STACK (SHSTK_ENABLED && SHADOW_STACK_SYSCALL)
# else
# define _CET_ENDBR
# endif
.file "make_x86_64_sysv_elf_gas.S"
.text
.globl make_fcontext
@ -184,3 +187,4 @@ finish:
/* Mark that we don't need executable stack. */
.section .note.GNU-stack,"",%progbits
# endif

View file

@ -0,0 +1,43 @@
.code
; ZEND_API void execute_ex(zend_execute_data *ex)
PUBLIC execute_ex
EXTERN execute_ex_real:PROC
; Assembly wrapper around the real execute_ex function, so that we can
; save the preserved registers when re-entering the VM from JIT code.
; See GH-18136.
execute_ex PROC EXPORT FRAME
; 10 floating points numbers
; 32 bytes shadow space
; 8 bytes to align after the return address
sub rsp, 8*10 + 32 + 8
.allocstack 8*10 + 32 + 8
.endprolog
movsd qword ptr [rsp + 32 + 8*0], xmm6
movsd qword ptr [rsp + 32 + 8*1], xmm7
movsd qword ptr [rsp + 32 + 8*2], xmm8
movsd qword ptr [rsp + 32 + 8*3], xmm9
movsd qword ptr [rsp + 32 + 8*4], xmm10
movsd qword ptr [rsp + 32 + 8*5], xmm11
movsd qword ptr [rsp + 32 + 8*6], xmm12
movsd qword ptr [rsp + 32 + 8*7], xmm13
movsd qword ptr [rsp + 32 + 8*8], xmm14
movsd qword ptr [rsp + 32 + 8*9], xmm15
call execute_ex_real
movsd xmm6, qword ptr [rsp + 32 + 8*0]
movsd xmm7, qword ptr [rsp + 32 + 8*1]
movsd xmm8, qword ptr [rsp + 32 + 8*2]
movsd xmm9, qword ptr [rsp + 32 + 8*3]
movsd xmm10, qword ptr [rsp + 32 + 8*4]
movsd xmm11, qword ptr [rsp + 32 + 8*5]
movsd xmm12, qword ptr [rsp + 32 + 8*6]
movsd xmm13, qword ptr [rsp + 32 + 8*7]
movsd xmm14, qword ptr [rsp + 32 + 8*8]
movsd xmm15, qword ptr [rsp + 32 + 8*9]
add rsp, 8*10 + 32 + 8
ret
execute_ex ENDP
END

View file

@ -1,121 +0,0 @@
--TEST--
func_get_arg() tests
--FILE--
<?php
function test1() {
try {
var_dump(func_get_arg(-10));
} catch (\ValueError $e) {
echo $e->getMessage() . \PHP_EOL;
}
try {
var_dump(func_get_arg(0));
} catch (\Error $e) {
echo $e->getMessage() . \PHP_EOL;
}
try {
var_dump(func_get_arg(1));
} catch (\Error $e) {
echo $e->getMessage() . \PHP_EOL;
}
}
function test2($a) {
try {
var_dump(func_get_arg(0));
} catch (\Error $e) {
echo $e->getMessage() . \PHP_EOL;
}
try {
var_dump(func_get_arg(1));
} catch (\Error $e) {
echo $e->getMessage() . \PHP_EOL;
}
}
function test3($a, $b) {
try {
var_dump(func_get_arg(0));
} catch (\Error $e) {
echo $e->getMessage() . \PHP_EOL;
}
try {
var_dump(func_get_arg(1));
} catch (\Error $e) {
echo $e->getMessage() . \PHP_EOL;
}
try {
var_dump(func_get_arg(2));
} catch (\Error $e) {
echo $e->getMessage() . \PHP_EOL;
}
}
test1();
test1(10);
test2(1);
try {
test2();
} catch (Throwable $e) {
echo "Exception: " . $e->getMessage() . "\n";
}
test3(1,2);
call_user_func("test1");
try {
call_user_func("test3", 1);
} catch (Throwable $e) {
echo "Exception: " . $e->getMessage() . "\n";
}
call_user_func("test3", 1, 2);
class test {
static function test1($a) {
try {
var_dump(func_get_arg(0));
} catch (\Error $e) {
echo $e->getMessage() . \PHP_EOL;
}
try {
var_dump(func_get_arg(1));
} catch (\Error $e) {
echo $e->getMessage() . \PHP_EOL;
}
}
}
test::test1(1);
try {
var_dump(func_get_arg(1));
} catch (\Error $e) {
echo $e->getMessage() . \PHP_EOL;
}
echo "Done\n";
?>
--EXPECTF--
func_get_arg(): Argument #1 ($position) must be greater than or equal to 0
func_get_arg(): Argument #1 ($position) must be less than the number of the arguments passed to the currently executed function
func_get_arg(): Argument #1 ($position) must be less than the number of the arguments passed to the currently executed function
func_get_arg(): Argument #1 ($position) must be greater than or equal to 0
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
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
func_get_arg(): Argument #1 ($position) must be greater than or equal to 0
func_get_arg(): Argument #1 ($position) must be less than the number of the arguments passed to the currently executed function
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 test3(), 1 passed in %s on line %d and exactly 2 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
int(1)
func_get_arg(): Argument #1 ($position) must be less than the number of the arguments passed to the currently executed function
func_get_arg() cannot be called from the global scope
Done

View file

@ -1,82 +0,0 @@
--TEST--
func_get_args() tests
--FILE--
<?php
function test1() {
var_dump(func_get_args());
}
function test2($a) {
var_dump(func_get_args());
}
function test3($a, $b) {
var_dump(func_get_args());
}
test1();
test1(10);
test2(1);
try {
test2();
} catch (Throwable $e) {
echo "Exception: " . $e->getMessage() . "\n";
}
test3(1,2);
call_user_func("test1");
try {
call_user_func("test3", 1);
} catch (Throwable $e) {
echo "Exception: " . $e->getMessage() . "\n";
}
call_user_func("test3", 1, 2);
class test {
static function test1($a) {
var_dump(func_get_args());
}
}
test::test1(1);
try {
var_dump(func_get_args());
} catch (\Error $e) {
echo $e->getMessage() . \PHP_EOL;
}
?>
--EXPECTF--
array(0) {
}
array(1) {
[0]=>
int(10)
}
array(1) {
[0]=>
int(1)
}
Exception: Too few arguments to function test2(), 0 passed in %s003.php on line %d and exactly 1 expected
array(2) {
[0]=>
int(1)
[1]=>
int(2)
}
array(0) {
}
Exception: Too few arguments to function test3(), 1 passed in %s003.php on line %d and exactly 2 expected
array(2) {
[0]=>
int(1)
[1]=>
int(2)
}
array(1) {
[0]=>
int(1)
}
func_get_args() cannot be called from the global scope

View file

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

View file

@ -1,42 +0,0 @@
--TEST--
get_included_files() tests
--FILE--
<?php
var_dump(get_included_files());
include(__DIR__."/014.inc");
var_dump(get_included_files());
include_once(__DIR__."/014.inc");
var_dump(get_included_files());
include(__DIR__."/014.inc");
var_dump(get_included_files());
echo "Done\n";
?>
--EXPECTF--
array(1) {
[0]=>
string(%d) "%s"
}
array(2) {
[0]=>
string(%d) "%s"
[1]=>
string(%d) "%s"
}
array(2) {
[0]=>
string(%d) "%s"
[1]=>
string(%d) "%s"
}
array(2) {
[0]=>
string(%d) "%s"
[1]=>
string(%d) "%s"
}
Done

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