Compare commits

...

2477 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
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
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
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
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
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
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
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
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
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
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
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
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
63cb81ff2c
Merge branch 'PHP-8.4'
* PHP-8.4:
  COMMUNTIY build grouping adjustments
2025-08-06 14:20:39 +02:00
Gina Peter Banyard
1e0c8baf05
tree: drop non canonical casts and ZPP tests 2025-08-06 13:20:28 +01: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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
David Carlier
f4ad6ea287
Merge branch 'PHP-8.4' 2025-07-27 13:50:30 +01:00
David Carlier
f7ca8138e7
Merge branch 'PHP-8.4' 2025-07-27 12:56:05 +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
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
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
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
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
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
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
5b05d429f2
Merge branch 'PHP-8.4'
* PHP-8.4:
  Leak in failed unserialize() with opcache
2025-07-22 15:44:24 +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
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
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
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
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
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
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
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
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
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
2afab21ffb
Merge branch 'PHP-8.4' 2025-07-16 14:15:14 +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
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
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
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
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
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
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
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
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
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
Dmitry Stogov
dd69b65638
Merge branch 'PHP-8.4'
* PHP-8.4:
  Update IR
2025-07-07 14:03:36 +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
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
4d27420543
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix stream double free in phar
2025-07-05 21:32:29 +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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Shivam Mathur
9adc94985f
Merge branch 'PHP-8.4' 2025-06-25 03:23:03 +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
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
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
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
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
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
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
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
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
David Carlier
a2461021b6
Merge branch 'PHP-8.4' 2025-06-22 11:46:16 +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
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
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
Gina Peter Banyard
27e485d22e Merge branch 'PHP-8.4' 2025-06-20 19:09:02 +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
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
412d691f54
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix iconv tests skipped on windows
2025-06-18 20:47:40 +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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Jakub Zelenka
b64daf9b3f
Merge branch 'PHP-8.4' 2025-05-30 22:58: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
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
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
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
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
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
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
c2749e0a80
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix compile error for attribute
2025-05-27 21:01:39 +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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
90d2f8abfd
Merge branch 'PHP-8.4' 2025-05-17 11:21:02 +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
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
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
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
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
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
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
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
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
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
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
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
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
David Carlier
c0371d3965
Merge branch 'PHP-8.4' 2025-05-03 19:40:28 +01:00
David Carlier
0f6e18df8f
Merge branch 'PHP-8.4' 2025-05-03 16:56:55 +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
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
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
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
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
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
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
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
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
78370689b8 Merge branch 'PHP-8.4' 2025-04-27 11:53:33 -04:00
George Wang
7cc7ae9d24 Merge branch 'PHP-8.4' 2025-04-27 11:47:52 -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
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
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
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
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
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
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
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
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
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
Saki Takamachi
7ac1b0c917
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] NEWS for #18317
2025-04-23 09:32:11 +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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
David Carlier
8846e9376c
Merge branch 'PHP-8.4' 2025-04-02 12:36:17 +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
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
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
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
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
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
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
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
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
916528e3f5
Merge branch 'PHP-8.4' 2025-03-27 11:38:17 +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
ab6e464ae2
Merge branch 'PHP-8.4'
* PHP-8.4:
  Implement benchmark diff commit fallback
2025-03-26 23:35:51 +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
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
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
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
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
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
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
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
8d7cdbf427
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix intl tests for icu 77 (#18125)
2025-03-21 14:25:23 +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
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
3dcf36c701
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fixed bug GH-13193 again
2025-03-21 11:48:22 +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
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
ead36985b3
Merge branch 'PHP-8.4'
* PHP-8.4:
  [ci skip] Fix NEWS order
2025-03-20 19:14:44 +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
8598e55370
Merge branch 'PHP-8.4'
* PHP-8.4:
  Add test for GH-18113
2025-03-19 23:49:56 +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
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
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
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
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
Jakub Zelenka
aa9d140a2a
Merge branch 'PHP-8.4' 2025-03-17 14:52:33 +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
Ilija Tovilo
798e27286e
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix mysql test date flakiness
2025-03-16 14:26:38 +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
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
6c189708a5
Merge branch 'PHP-8.4' 2025-03-15 11:34:52 +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
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
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
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
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
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
Jakub Zelenka
6ec89f028f
Merge branch 'PHP-8.4' 2025-03-13 22:32:18 +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
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
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
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
Dmitry Stogov
7faa3decd9
Merge branch 'PHP-8.4'
* PHP-8.4:
  Update IR
2025-03-13 03:08:16 +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
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
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
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
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
Ben Ramsey
3ae44211b3
Merge branch 'PHP-8.4' 2025-03-11 16:43:52 -05:00
Jakub Zelenka
5c8025e23f
Merge branch 'PHP-8.4' 2025-03-11 22:24:34 +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
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
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
94f327219a
Merge branch 'PHP-8.4' 2025-03-10 11:28:49 +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
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
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
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
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
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
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
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
David Carlier
a14301b2d6
Merge branch 'PHP-8.4' 2025-03-07 18:31:51 +00:00
David Carlier
ea86442857
Merge branch 'PHP-8.4' 2025-03-07 18:08:30 +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
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
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
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
Dmitry Stogov
ad5de59f93
Merge branch 'PHP-8.4'
* PHP-8.4:
  Merge IR
2025-03-06 23:01:25 +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
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
bc32bb164f
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix flaky DatePeriod test
2025-03-06 15:04:36 +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
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
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
Dmitry Stogov
9dd2ae4d76
Merge branch 'PHP-8.4'
* PHP-8.4:
  Merge IR
2025-03-03 23:48:30 +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
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
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
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
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
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
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
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
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
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
David Carlier
d6cd754121
Merge branch 'PHP-8.4' 2025-02-25 21:56:01 +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
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
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
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
Jakub Zelenka
9ed83e1c74
Merge branch 'PHP-8.4' 2025-02-24 23:23:25 +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
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
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
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
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
Bob Weinand
bcd7222522 Merge branch 'PHP-8.4' 2025-02-24 14:37:21 +01:00
David Carlier
06101224b4
Merge branch 'PHP-8.4' 2025-02-24 07:15:08 +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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Ilija Tovilo
f25eb7f18d
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix curl protocols test expectation
2025-02-14 14:38:58 +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
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
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
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
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
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
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
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
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
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
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
Dmitry Stogov
cdaa69e122
Merge branch 'PHP-8.4'
* PHP-8.4:
  IR Update
2025-02-06 02:04:36 +03:00
David Carlier
65a20d5a09
Merge branch 'PHP-8.4' 2025-02-05 19:41:16 +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
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
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
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
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
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
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
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
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
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
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
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
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
c9fa625e41
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fixed GH-17398: bcmul memory leak (#17615)
2025-01-29 19:15:23 +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
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
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
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
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
dfd8c0ca05
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Another flaky macOS phar test
2025-01-28 12:45:43 +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
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
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
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
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
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
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
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
fa1af48c83
Merge branch 'PHP-8.4'
* PHP-8.4:
  Use preinstalled MySQL for Windows CI
2025-01-25 17:43:17 +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
f2b010f503
Merge branch 'PHP-8.4'
* PHP-8.4:
  Update test expectation for different Firebird version
2025-01-24 22:10:21 +01: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
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
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
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
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
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
David Carlier
3337f22eb1
Merge branch 'PHP-8.4' 2025-01-21 19:34:14 +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
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
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
David Carlier
27125b8c39
Merge branch 'PHP-8.4' 2025-01-19 18:01:52 +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
675f359e91
Merge branch 'PHP-8.4'
* PHP-8.4:
  Cherry-pick lexbor/lexbor@f94d97a3
2025-01-19 11:51:41 +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
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
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
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
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
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
a4fa1e728a
Merge branch 'PHP-8.4'
* PHP-8.4:
  Cherry-pick lexbor/lexbor@58c88147
2025-01-16 19:22:55 +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
8d6f46d9d2
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix NULL arithmetic during system program execution
2025-01-15 22:55:19 +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
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
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
David Carlier
a4e25839d3
Merge branch 'PHP-8.4' 2025-01-14 18:33:00 +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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
3ee8b3929e
Merge branch 'PHP-8.4' 2025-01-05 13:35:20 +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
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
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
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
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
3bfe39f279
Merge branch 'PHP-8.4'
* PHP-8.4:
2025-01-01 20:04:47 +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
Jakub Zelenka
b072206313
Merge branch 'PHP-8.4' 2024-12-31 15:25:17 +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
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
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
c6b3ab3966
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix some emalloc() size mistakes
2024-12-29 12:12:22 +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
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
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
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
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
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
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
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
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
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
Jakub Zelenka
0aeac68063
Merge branch 'PHP-8.4' 2024-12-22 14:58:36 +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
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
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
afc1f0d99b
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17216: Trampoline crash on error
2024-12-21 00:26:37 +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
David Carlier
76ade7165e
Merge branch 'PHP-8.4' 2024-12-20 15:09:59 +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
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
Dmitry Stogov
6a015491a0
Merge branch 'PHP-8.4'
* PHP-8.4:
  Update IR
2024-12-19 20:30:05 +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
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
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
Derick Rethans
2e1d6785d5
Merge branch 'PHP-8.4' 2024-12-18 11:39:06 +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
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
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
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
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
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
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
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
David Carlier
fa8c6a552d
Merge branch 'PHP-8.4' 2024-12-15 16:05:20 +00:00
David Carlier
36d5a0fdcd
Merge branch 'PHP-8.4' 2024-12-15 15:22:47 +00:00
David Carlier
9ba2667cf5
Merge branch 'PHP-8.4' 2024-12-15 14:56:29 +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
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
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
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
Jakub Zelenka
7bfd19880f
Merge branch 'PHP-8.4' 2024-12-14 15:01:55 +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
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
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
f1f266f953
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix ZEND_MATCH_ERROR misoptimization
2024-12-12 13:11:34 +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
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
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
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
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
b81bddd457
Merge branch 'PHP-8.4'
* PHP-8.4:
  Backport GH-16348
2024-12-09 21:01:03 +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
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
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
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
David Carlier
94d9cc1266
Merge branch 'PHP-8.4' 2024-12-09 13:17:29 +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
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
David Carlier
ba432c7a47
Merge branch 'PHP-8.4' 2024-12-08 20:30:57 +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
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
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
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
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
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
bb13556240
Merge branch 'PHP-8.4'
* PHP-8.4:
  Correctly compare 0 and -0 (#17051)
2024-12-07 01:52:44 +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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
David Carlier
917e120b96
Merge branch 'PHP-8.4' 2024-12-01 13:58:47 +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
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
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
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
Dmitry Stogov
e8154c6c7d
Merge branch 'PHP-8.4'
* PHP-8.4:
  Update IR
2024-11-29 16:28:53 +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
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
Dmitry Stogov
5c05e6c247
Merge branch 'PHP-8.4'
* PHP-8.4:
  Update IR
2024-11-29 02:40:52 +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
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
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
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
David Carlier
7b9b832be5
Merge branch 'PHP-8.4' 2024-11-27 19:55:04 +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
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
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
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
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
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
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
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
cef23c4853
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix is_zend_ptr() huge block comparison
2024-11-26 19:24:54 +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
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
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
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
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
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
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
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
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
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
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
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
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
Dmitry Stogov
de17e243d5
Merge branch 'PHP-8.4'
* PHP-8.4:
  Update IR
2024-11-25 10:35:11 +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
59ed9cebaa
Merge branch 'PHP-8.4' 2024-11-24 20:16:26 +01:00
Jakub Zelenka
b3a615391a
Merge branch 'PHP-8.4' 2024-11-24 19:48:06 +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
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
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
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
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
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
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
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
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
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
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
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
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
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
09d25b2964
Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] NEWS for #16694
2024-11-20 00:43:00 +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
Patrick Allaert
cc308de069
Merge branch 'PHP-8.4' 2024-11-19 16:12:32 +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
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
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
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
Jakub Zelenka
07cef9fb65
Merge branch 'PHP-8.4' 2024-11-18 16:50:52 +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
Dmitry Stogov
1307d3037c
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fixed test
2024-11-18 15:35:21 +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
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
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
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
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
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
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
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
23d390ecb1
Merge branch 'PHP-8.4'
* PHP-8.4:
  Update FreeBSD CI
2024-11-15 18:24:58 +01:00
David Carlier
4f76baba29
Merge branch 'PHP-8.4' 2024-11-15 16:51:10 +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
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
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
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
fa3421cd10
Merge branch 'PHP-8.4'
* PHP-8.4:
  Patch libcurl.pc for macOS builds
2024-11-13 19:40:52 +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
53e5c09052
Merge branch 'PHP-8.4' 2024-11-13 12:12:25 +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
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
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
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
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
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
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
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
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
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
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
9ebbe1e3f3
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16723: CURLMOPT_PUSHFUNCTION issues
2024-11-09 12:44:16 +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
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
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
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
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
Jakub Zelenka
efcd72029c
Merge branch 'PHP-8.4' 2024-11-08 17:04:18 +01:00
Jakub Zelenka
84400eefbb
Merge branch 'PHP-8.4' 2024-11-08 16:51:19 +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
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
David Carlier
600da8cffc
Merge branch 'PHP-8.4' 2024-11-07 22:53:08 +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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
David Carlier
f37fd7fa1a
Merge branch 'PHP-8.4' 2024-11-03 13:40:34 +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
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
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
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
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
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
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
Arnaud Le Blanc
50a3f019dc
Merge branch 'PHP-8.4'
* PHP-8.4:
  Add ReflectionProperty::isLazy()
2024-10-31 14:15:49 +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
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
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
df2436d359
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix static analysis warning
2024-10-30 20:56:16 +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
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
bf5496149b
Merge branch 'PHP-8.4'
* PHP-8.4:
  Partial backport of e7462bf
2024-10-30 14:24:26 +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
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
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
David Carlier
cb6212b073
Merge branch 'PHP-8.4' 2024-10-28 21:25:49 +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
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
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
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
0b4aed09d5
Merge branch 'PHP-8.4'
* PHP-8.4:
  Backport CI fixes to security branches
2024-10-28 16:08:07 +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
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
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
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
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
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
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
Bob Weinand
1e08c15512 Merge branch 'PHP-8.4' 2024-10-25 01:31:15 +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
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
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
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
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
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
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
Ilija Tovilo
96f83f7ca3
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix gh16508.phpt test expectation
2024-10-22 22:07:43 +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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
David Carlier
c025ce4d66
Merge branch 'PHP-8.4' 2024-10-20 21:44:41 +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
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
Derick Rethans
b63167f9e6
Merge branch 'PHP-8.4' 2024-10-18 12:38:28 +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
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
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
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
a73754fece
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix various document ref pointer mismanagements
2024-10-17 21:21:56 +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
76138d6f0f
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix uaf in SplFixedArray::unset()
2024-10-17 18:26:01 +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
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
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
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
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
ec152105f2
Merge branch 'PHP-8.4'
* PHP-8.4:
  Disallow asymmetric visibility on static properties
2024-10-16 23:00:41 +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
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
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
Niels Dossche
5e2e49af82
Merge branch 'PHP-8.4'
* PHP-8.4:
  [ci skip] Fix UPGRADING section
2024-10-15 19:24:04 +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
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
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
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
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
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
fc210b44a6
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix deprecation warnings in tests
2024-10-14 14:28:12 +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
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
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
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
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
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
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
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
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
David Carlier
79c71c9f0b
Merge branch 'PHP-8.4' 2024-10-13 14:27:24 +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
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
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
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
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
David Carlier
35c8a010c6
Merge branch 'PHP-8.4' 2024-10-12 15:24:53 +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
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
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
a1974e6db0
Merge branch 'PHP-8.4'
* PHP-8.4:
  Restore accidentally deleted check
2024-10-12 13:41:29 +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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Jakub Zelenka
c8194a1788
Merge branch 'PHP-8.4' 2024-10-08 19:23:07 +01:00
Niels Dossche
dcd51beac0
Merge branch 'PHP-8.4'
* PHP-8.4:
  Update Lexbor (#16288)
2024-10-08 19:16:30 +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
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
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
Dmitry Stogov
edc94a8d21
Merge branch 'PHP-8.4'
* PHP-8.4:
  Update IR
2024-10-07 21:18:55 +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
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
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
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
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
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
Dmitry Stogov
4e071b9f3e
Merge branch 'PHP-8.4'
* PHP-8.4:
  Update IR
2024-10-07 15:31:25 +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
David Carlier
27985472d9
Merge branch 'PHP-8.4' 2024-10-07 13:06:00 +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
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
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
Jakub Zelenka
00cdbcf110
Merge branch 'PHP-8.4' 2024-10-06 21:27:06 +01:00
Jakub Zelenka
ba0336c5b9
Merge branch 'PHP-8.4' 2024-10-06 19:43:44 +01:00
David Carlier
828a21792c
Merge branch 'PHP-8.4' 2024-10-06 19:26:29 +01:00
David Carlier
c4532c8e98
Merge branch 'PHP-8.4' 2024-10-06 18:08:08 +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
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
5b0792f74b
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix Soap leaking http_msg on error
2024-10-06 17:59:54 +02:00
David Carlier
a7edde7c40
Merge branch 'PHP-8.4' 2024-10-06 16:43:08 +01:00
David Carlier
1feb210e93
Merge branch 'PHP-8.4' 2024-10-06 11:02:43 +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
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
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
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
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
David Carlier
671200ac95
Merge branch 'PHP-8.4' 2024-10-05 13:10:18 +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
3b9676762b
Merge branch 'PHP-8.4' 2024-10-05 10:48:08 +01:00
Yuya Hamada
4ac65b4c6b Merge branch 'PHP-8.4' 2024-10-05 18:29:39 +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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
bfa728538f
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix small typo in UPGRADING (#16141)
2024-09-30 21:43:01 +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
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
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
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
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
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
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
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
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
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
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
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
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
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
Ben Ramsey
91a07e7b75
Merge branch 'PHP-8.4' 2024-09-26 14:25:41 -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
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
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
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
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
553e18f679
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix missing libavif-dev in asan nightly
2024-09-26 15:09:53 +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
Christoph M. Becker
9e3b959bf9
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix bug71610.phpt
2024-09-26 13:19:21 +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
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
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
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
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
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
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
Ilija Tovilo
14b0862512
Merge branch 'PHP-8.4' 2024-09-25 01:22:28 +02:00
Ilija Tovilo
a52c056638
Merge branch 'PHP-8.4' 2024-09-25 01:12:27 +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
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
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
7bd0bcadaa
Prepare for PHP 8.4 2024-09-25 00:03:39 +09:00
5487 changed files with 640475 additions and 267454 deletions

View file

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

View file

@ -32,3 +32,7 @@ max_line_length = 80
[*.patch]
trim_trailing_whitespace = false
[*.rst]
indent_style = space
max_line_length = 100

5
.gitattributes vendored
View file

@ -21,7 +21,7 @@
# Collapse generated files within git and pull request diff.
**/*_arginfo.h linguist-generated -diff
/main/gdb_inlined_script.c 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
@ -30,4 +30,5 @@
/ext/date/tests/ossfuzz*.txt binary
# Vendored libraries
/ext/dom/lexbor/lexbor linguist-vendored
/ext/lexbor/lexbor linguist-vendored
/ext/uri/uriparser linguist-vendored

4
.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
@ -27,6 +27,7 @@
/ext/gmp @Girgias
/ext/intl @devnexen
/ext/json @bukka
/ext/lexbor @kocsismate @nielsdos
/ext/libxml @nielsdos
/ext/mbstring @alexdowad @youkidearitai
/ext/mysqli @bukka @kamil-tekiela
@ -51,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

@ -35,13 +35,11 @@ runs:
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 \

View file

@ -13,7 +13,7 @@ runs:
# 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
brew reinstall autoconf webp tidy-html5 libzip libsodium icu4c curl
brew install \
bison \
re2c

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,12 +35,10 @@ runs:
--with-freetype \
--with-xpm \
--enable-exif \
--with-zip \
--with-zlib \
--enable-soap \
--enable-xmlreader \
--with-xsl \
--with-tidy \
--enable-sysvsem \
--enable-sysvshm \
--enable-shmop \

View file

@ -113,8 +113,7 @@ 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

View file

@ -30,7 +30,9 @@ runs:
export PDO_PGSQL_TEST_DSN="pgsql:host=localhost port=5432 dbname=test user=postgres password=postgres"
fi
export PDO_FIREBIRD_TEST_DATABASE=test.fdb
export PDO_FIREBIRD_TEST_DSN=firebird:dbname=localhost: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"

6
.github/labeler.yml vendored
View file

@ -320,6 +320,11 @@
- any-glob-to-any-file:
- ext/tokenizer/**/*
"Extension: uri":
- changed-files:
- any-glob-to-any-file:
- ext/uri/**/*
"Extension: xml":
- changed-files:
- any-glob-to-any-file:
@ -464,7 +469,6 @@
- 'ext/pdo/php_pdo.h'
- 'ext/pdo/php_pdo_driver.h'
- 'ext/pdo/php_pdo_error.h'
- 'ext/phar/php_phar.h'
- 'ext/random/php_random.h'
- 'ext/random/php_random_csprng.h'
- 'ext/random/php_random_uint128.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

@ -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

@ -92,8 +92,6 @@ 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=64M -d opcache.jit=tracing
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
rem prepare for enchant
mkdir %~d0\usr\local\lib\enchant-2
@ -123,11 +121,14 @@ hMailServer.exe /verysilent
cd %APPVEYOR_BUILD_FOLDER%
%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
@ -137,21 +138,23 @@ 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%

View file

@ -17,11 +17,11 @@ jobs:
if: github.repository == 'php/php-src'
steps:
- name: git checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Install dependencies
run: pip install sphinx-design sphinxawesome-theme rstfmt
run: pip install -r docs/requirements.txt
- name: Check formatting
run: rstfmt --check -w 100 docs/source
run: make -C docs check-formatting
- name: Publish
if: github.event_name == 'push'
uses: sphinx-notes/pages@v3

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
@ -95,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
@ -134,7 +134,6 @@ jobs:
jitType: tracing
runTestsParameters: >-
--asan -x
-d zend_extension=opcache.so
-d opcache.enable_cli=1
- name: Extra tests
uses: ./.github/actions/extra-tests
@ -207,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
@ -250,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
@ -268,7 +265,6 @@ 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
@ -310,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
@ -344,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
@ -359,7 +353,6 @@ 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
@ -381,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
@ -406,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
@ -420,7 +411,6 @@ jobs:
with:
jitType: function
runTestsParameters: >-
-d zend_extension=opcache.so
-d opcache.enable_cli=1
- name: Extra tests
uses: ./.github/actions/extra-tests
@ -459,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
@ -484,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() }}
@ -513,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
@ -538,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
@ -717,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
@ -739,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
@ -761,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
@ -769,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
@ -785,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
@ -863,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
@ -877,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
@ -927,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
@ -1068,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
@ -1089,7 +1071,7 @@ jobs:
timeout-minutes: 50
steps:
- name: git checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
ref: ${{ inputs.branch }}
- name: FreeBSD

View file

@ -78,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
@ -129,7 +130,6 @@ jobs:
with:
jitType: tracing
runTestsParameters: >-
-d zend_extension=opcache.so
-d opcache.enable_cli=1
${{ matrix.asan && '--asan -x' || '' }}
- name: Verify generated files are up to date
@ -139,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
@ -153,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
@ -178,7 +189,6 @@ jobs:
with:
jitType: tracing
runTestsParameters: >-
-d zend_extension=opcache.so
-d opcache.enable_cli=1
MACOS_DEBUG_NTS:
if: github.repository == 'php/php-src' || github.event_name == 'pull_request'
@ -186,13 +196,14 @@ jobs:
fail-fast: false
matrix:
include:
- os: 14
- os: 15
arch: ARM64
name: MACOS_${{ matrix.arch }}_DEBUG_NTS
runs-on: macos-${{ matrix.os }}
timeout-minutes: 50
steps:
- name: git checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: brew
uses: ./.github/actions/brew
- name: ccache
@ -216,7 +227,6 @@ jobs:
with:
jitType: tracing
runTestsParameters: >-
-d zend_extension=opcache.so
-d opcache.enable_cli=1
- name: Verify generated files are up to date
uses: ./.github/actions/verify-generated-files
@ -224,6 +234,7 @@ jobs:
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
@ -239,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
@ -249,10 +260,11 @@ 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
@ -284,7 +296,6 @@ jobs:
./configure \
--disable-debug \
--enable-mbstring \
--enable-opcache \
--enable-option-checking=fatal \
--enable-sockets \
--enable-werror \
@ -304,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
@ -316,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 }}
@ -359,6 +369,6 @@ jobs:
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

@ -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

10
.gitignore vendored
View file

@ -238,6 +238,7 @@ php
**/tests/**/*.exp
**/tests/**/*.log
**/tests/**/*.sh
**/tests/**/*.stdin
# Generated by some test cases
**/tests/**/*.db
@ -294,6 +295,13 @@ tmp-php.ini
/junit.out.xml
/.ccache/
# ------------------------------------------------------------------------------
# Editor configuration directories
# ------------------------------------------------------------------------------
/.idea/
/.vscode/
/.zed/
# ------------------------------------------------------------------------------
# Additional test build files
# ------------------------------------------------------------------------------
@ -306,6 +314,6 @@ tmp-php.ini
!/ext/fileinfo/libmagic/config.h
!/ext/fileinfo/libmagic.patch
!/ext/fileinfo/magicdata.patch
!/ext/dom/lexbor/patches/*.patch
!/ext/lexbor/patches/*.patch
!/ext/pcre/pcre2lib/config.h
!/win32/build/Makefile

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
@ -350,9 +356,10 @@ Currently, we have the following branches in use:
| Branch | |
| --------- | --------- |
| master | Active development branch for PHP 8.4, which is open for backwards incompatible changes and major internal API changes. |
| 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 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. |

View file

@ -195,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)
@ -231,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
-------------------------------------------------------------------------------
@ -412,7 +420,7 @@ STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: random
PRIMARY MAINTAINER Go Kudo <zeriyoshi@php.net> (2022 - 2024)
Tim Düsterhus <timwolla@php.net> (2022 - 2024)
Tim Düsterhus <timwolla@php.net> (2022 - 2025)
MAINTENANCE: Maintained
STATUS: Working
SINCE: 8.2.0
@ -426,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
-------------------------------------------------------------------------------
@ -495,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)

1833
NEWS

File diff suppressed because it is too large Load diff

View file

@ -17,8 +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/dom/lexbor/lexbor) see ext/dom/lexbor/LICENSE
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

@ -15,7 +15,7 @@ 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)
[![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
@ -42,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`.
@ -74,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.
@ -88,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

View file

@ -778,7 +778,7 @@ TSRM_API size_t tsrm_get_ls_cache_tcb_offset(void)
return 0;
#elif defined(__x86_64__) && defined(__GNUC__) && !defined(__FreeBSD__) && \
!defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(__MUSL__) && \
!defined(__HAIKU__)
!defined(__HAIKU__) && !defined(__CYGWIN__)
size_t ret;
asm ("movq _tsrm_ls_cache@gottpoff(%%rip),%0"
@ -786,7 +786,7 @@ TSRM_API size_t tsrm_get_ls_cache_tcb_offset(void)
return ret;
#elif defined(__i386__) && defined(__GNUC__) && !defined(__FreeBSD__) && \
!defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(__MUSL__) && \
!defined(__HAIKU__)
!defined(__HAIKU__) && !defined(__CYGWIN__)
size_t ret;
asm ("leal _tsrm_ls_cache@ntpoff,%0"

View file

@ -636,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) {

1703
UPGRADING

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
PHP 8.4 INTERNALS UPGRADE NOTES
PHP 8.5 INTERNALS UPGRADE NOTES
1. Internal API changes
@ -14,413 +14,158 @@ PHP 8.4 INTERNALS UPGRADE NOTES
1. Internal API changes
========================
* zend_register_module_ex() now takes an additional int module_type argument.
This function will also assign the module number and type, there is no need
to do this at the call site anymore. Writing the handle should happen after
successful registration.
- 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.
* ZPP now accepts a F or Z_PARAM_FUNC_NO_TRAMPOLINE_FREE type check.
This is identical to the 'f' or Z_PARAM_FUNC type check, except the FCC is
always initialized because it doesn't free trampolines.
Trampolines MUST be freed using zend_release_fcall_info_cache() or consumed.
Z_PARAM_FUNC_EX2 was added as well with the same arguments as Z_PARAM_FUNC_EX
plus an additional argument free_trampoline.
- Hash
. Hash functions now use proper hash_spec_result enum for return values
instead of using SUCCESS and FAILURE.
* The zend_object_iterator_funcs valid member has changed its signature from
int(*)(zend_object_iterator *) to zend_result(*)(zend_object_iterator *) to
be more in line with what callbacks are returning.
- 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.
* The backwards compatibility headers ext/standard/{php_lcg.h,php_mt_rand.h,
php_rand.h,php_random.h} have been removed. Include ext/random/php_random.h
directly.
* The zend_*printf family of functions now supports the "%S" modifier to print
out zend_string*. This won't cut off the string if it embeds a NUL byte.
* The inet_aton() and win32/inet.h have been removed. Use platform-agnostic
inet_pton() from arpa/inet.h or ws2tcpip.h on Windows.
* zend_mm_set_custom_debug_handlers() has been removed from ZendMM, use
zend_mm_set_custom_handlers() instead which now supports DEBUG builds
* zend_mm_set_custom_handlers() has changed its signature from
void()(zend_mm_heap *heap,
void* (*_malloc)(size_t),
void (*_free)(void*),
void* (*_realloc)(void*, size_t))
to
void()(zend_mm_heap *heap,
void* (*_malloc)(size_t ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC),
void (*_free)(void* ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC),
void* (*_realloc)(void*, size_t ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC))
* zend_mm_get_custom_handlers() has changed its signature from
void()(zend_mm_heap *heap,
void* (**_malloc)(size_t),
void (**_free)(void*),
void* (**_realloc)(void*, size_t))
to
void()(zend_mm_heap *heap,
void* (**_malloc)(size_t ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC),
void (**_free)(void* ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC),
void* (**_realloc)(void*, size_t ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC))
* Added gc and shutdown custom handlers, settable via
zend_mm_set_custom_handlers_ex()
* __zend_malloc() has changed their signature from
void(*)(size_t) to
void(*)(size_t ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
* __zend_calloc() has changed their signature from
void(*)(size_t, size_t) to
void(*)(size_t, size_t ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
* __zend_realloc() has changed their signature from
void(*)(void *, size_t) to
void(*)(void *, size_t ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
* zend_observer_remove_begin_handler() and zend_observer_remove_end_handler()
got each a new parameter returning an observer which must be called, if the
removal happened during observer execution.
* zend_get_internal_function_extension_handle[s]() must now be used over
zend_get_op_array_extension_handle[s]() when registering run_time_cache slots
for internal functions. If you need a cache slot for both internal and user
functions, you may obtain a slot for each through the corresponding function.
* zend_is_true now returns bool rather than int. Note that on PHP 8 this has
always returned 0 or 1, so conversion should be trivial.
* Added zend_hash_get_current_pos_ex() variant of zend_hash_get_current_pos().
* Renamed rebuild_object_properties() to rebuild_object_properties_internal().
This function should not be used outside of zend_std_get_properties_ex() and
zend_std_get_properties(). Use zend_std_get_properties_ex() or
zend_std_get_properties() instead.
* zend_object.properties must not be accessed directly. Use
zend_std_get_properties_ex() instead.
* Removed IS_STATIC_VAR_UNINITIALIZED constant. Check for IS_NULL in the
static_variables array instead.
* Removed ZEND_DIM_ALTERNATIVE_SYNTAX constant. This syntax no longer has a
specialized error message.
- 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
========================
a. Abstract
- The configure option --with-imap has been removed.
- The configure option --with-mhash emits deprecation warning.
- The configure option --with-pdo-oci has been removed.
- The configure option --with-pspell has been removed.
- Symbol SIZEOF_SHORT removed (size of 2 on 32-bit and 64-bit platforms).
- Symbol DBA_CDB_MAKE removed in ext/dba.
- Symbol HAVE_LIBM has been removed.
- Symbol HAVE_INET_ATON has been removed.
- Symbol HAVE_SIGSETJMP has been removed.
- The Zend/zend_istdiostream.h header has been removed.
- Abstract
. Preprocessor macro SIZEOF_PTRDIFF_T has been removed.
. Preprocessor macro SIZEOF_INTMAX_T has been removed.
b. Unix build system changes
- The configure option --with-imap-ssl has been removed.
- The configure option --with-oci8 has been removed.
- The configure option --with-zlib-dir has been removed.
- The configure option --with-kerberos has been removed.
- The configure option --with-openssl-dir has been removed. SSL support in
ext/ftp and ext/mysqlnd is enabled implicitly, when building with
ext/openssl (--with-openssl), or explicitly by using new configure options
--with-ftp-ssl and --with-mysqlnd-ssl.
- New configure option --with-openssl-legacy-provider to enable OpenSSL
legacy provider.
- New configure option --with-openssl-argon2 to enable PASSWORD_ARGON2
from OpenSSL 3.2
- COOKIE_IO_FUNCTIONS_T symbol has been removed (use cookie_io_functions_t).
- HAVE_SOCKADDR_UN_SUN_LEN symbol renamed to HAVE_STRUCT_SOCKADDR_UN_SUN_LEN.
- HAVE_UTSNAME_DOMAINNAME symbol renamed to HAVE_STRUCT_UTSNAME_DOMAINNAME.
- PHP_CHECK_IN_ADDR_T Autoconf macro and 'in_addr_t' fallback definition to
'u_int' removed (use AC_CHECK_TYPES Autoconf macro instead).
- HAVE_ODBC2 symbol has been removed in ext/odbc.
- Removed linking with obsolete dnet_stub library in ext/pdo_dblib.
- Removed checking and linking with obsolete libbind for some functions.
- Symbol HAVE_JSON has been removed (ext/json is always available since PHP
8.0).
- Symbol DARWIN has been removed (use __APPLE__ to target Darwin systems).
- Symbol MISSING_FCLOSE_DECL and Autoconf macro PHP_MISSING_FCLOSE_DECL were
removed.
- Symbol HAVE_BSD_ICONV has been removed.
- Symbol ZEND_FIBER_ASM has been removed.
- Symbols HAVE_DLOPEN and HAVE_DLSYM have been removed.
- Symbol HAVE_MYSQL has been removed.
- Symbol HAVE_PDO_SQLITELIB has been removed.
- Symbol HAVE_WAITPID has been removed.
- Symbol HAVE_LIBPQ has been removed.
- Symbols HAVE_LIBRT and HAVE_TIMER_CREATE removed.
- Symbols PHP_FPM_SYSTEMD, PHP_FPM_USER, and PHP_FPM_GROUP removed.
- Symbol PTHREADS has been removed.
- Symbol HAVE_STRPTIME_DECL_FAILS has been removed (use HAVE_DECL_STRPTIME).
- Symbol HAVE_PHPDBG has been removed.
- Symbols PHP_HAVE_AVX512_SUPPORTS and PHP_HAVE_AVX512_VBMI_SUPPORTS are now
either defined to 1 or undefined.
- Symbol HAVE_LIBCRYPT has been removed.
- Autoconf macro PHP_DEFINE (atomic includes) removed (use AC_DEFINE and
config.h).
- Autoconf macro PHP_WITH_SHARED has been removed (use PHP_ARG_WITH).
- Autoconf macro PHP_STRUCT_FLOCK has been removed (use AC_CHECK_TYPES).
- Autoconf macro PHP_SOCKADDR_CHECKS has been removed (use AC_CHECK_TYPES and
AC_CHECK_MEMBERS).
- Autoconf macro PHP_CHECK_GCC_ARG has been removed since PHP 8.0 (use
AX_CHECK_COMPILE_FLAG).
- Autoconf macro PHP_PROG_RE2C got a new 2nd argument to define common
default re2c command-line options substituted to the Makefile RE2C_FLAGS
variable.
- Autoconf macros PHP_CHECK_BUILTIN_* have been removed in favor of
PHP_CHECK_BUILTIN and all PHP_HAVE_BUILTIN_* symbols changed to be either
undefined or defined to 1 whether compiler supports the builtin.
- Added php-config --lib-dir and --lib-embed options for PHP embed SAPI.
- PDO extensions in php-src don't have the include flag -I$pdo_cv_inc_path
directory anymore.
- Autoconf macro PHP_SETUP_OPENSSL doesn't accept the 3rd argument anymore.
- Autoconf macro PHP_EVAL_LIBLINE got a new 3rd argument to override the
ext_shared checks.
- Autoconf macro PHP_SETUP_LIBXML doesn't define the redundant HAVE_LIBXML
symbol anymore and requires at least libxml2 2.9.4.
- Autoconf macro PHP_SETUP_ICONV doesn't define the HAVE_ICONV symbol
anymore.
- Autoconf macro PHP_AP_EXTRACT_VERSION is obsolete (use the
'apxs -q HTTPD_VERSION').
- Autoconf macro PHP_OUTPUT is obsolete (use AC_CONFIG_FILES).
- Autoconf macro PHP_TEST_BUILD is obsolete (use AC_* macros).
- Autoconf macro PHP_BUILD_THREAD_SAFE is obsolete (set enable_zts manually).
- Autoconf macro PHP_DEF_HAVE is obsolete (use AC_DEFINE).
- Autoconf macro PHP_PROG_SETUP now accepts an argument to set the minimum
required PHP version during the build.
- Autoconf macro PHP_INSTALL_HEADERS arguments can now be also
blank-or-newline-separated lists instead of only separated with whitespace
or backslash-then-newline.
- Autoconf macro PHP_ADD_BUILD_DIR now also accepts 1st argument as a
blank-or-newline-separated separated list.
- Autoconf macros PHP_NEW_EXTENSION, PHP_ADD_SOURCES, PHP_ADD_SOURCES_X,
PHP_SELECT_SAPI now have the source files and flags arguments normalized so
the list of items can be passed as a blank-or-newline-separated list.
- Autoconf macro PHP_ADD_INCLUDE now takes also a blank-or-newline-separated
list of include directories instead of a single directory. The "prepend"
argument is validated at Autoconf compile time.
- TSRM/tsrm.m4 file and its TSRM_CHECK_PTHREADS macro have been removed.
- Added pkg-config support to find libpq for the pdo_pgsql and pgsql
extensions. The libpq paths can be customized with the PGSQL_CFLAGS and
PGSQL_LIBS environment variables. When a directory argument is provided to
configure options (--with-pgsql=DIR or --with-pdo-pgsql=DIR), it will be
used instead of the pkg-config search.
- Added pkg-config support to find unixODBC and iODBC for the pdo_odbc
extension.
- Added pkg-config support to find GNU MP library. As a fallback default
system paths are searched. When a directory argument is provided
(--with-gmp=DIR), it will be used instead of the pkg-config.
- Added optional pkg-config support to find NET-SNMP library. As a fallback
net-snmp-config utility is used like before.
- Removed BC enable_pear variable check due to --enable-pear configure option
once used (use with_pear variable name).
- Cache variables synced to php_cv_* naming scheme. If you use them for
advanced cross-compilation, these were renamed:
- ac_cv_copy_file_range -> php_cv_func_copy_file_range
- ac_cv_flush_io -> php_cv_have_flush_io
- ac_cv_func_getaddrinfo -> php_cv_func_getaddrinfo
- ac_cv_have_broken_gcc_strlen_opt -> php_cv_have_broken_gcc_strlen_opt
- ac_cv_have_pcre2_jit -> php_cv_have_pcre2_jit
- ac_cv_pread -> php_cv_func_pread
- ac_cv_pwrite -> php_cv_func_pwrite
- ac_cv_syscall_shadow_stack_exists -> php_cv_have_shadow_stack_syscall
- ac_cv_time_r_type -> php_cv_time_r_type
- ac_cv_write_stdout -> php_cv_have_write_stdout
and all other checks wrapped with their belonging cache variables (see *.m4
source files for details).
- 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.
c. Windows build system changes
- The configure options --with-oci8-11g, --with-oci8-12c, --with-oci8-19,
--enable-apache2-2handler have been removed.
- The configure option --enable-apache2-4handler is now an alias for the
preferred --enable-apache2handler.
- Added Bison flag '-Wall' when generating lexer files as done in *nix build
system.
- HAVE_WIN32_NATIVE_THREAD, USE_WIN32_NATIVE_THREAD, ENABLE_THREADS symbols
in ext/mbstring/libmbfl removed.
- FIBER_ASSEMBLER and FIBER_ASM_ARCH Makefile variables removed in favor of
PHP_ASSEMBLER and FIBER_ASM_ABI.
- HAVE_PHP_SOAP symbol renamed to HAVE_SOAP.
- Unused symbols CONFIGURATION_FILE_PATH, DISCARD_PATH, HAVE_ERRMSG_H,
HAVE_REGCOMP, HAVE_RINT, NEED_ISBLANK, PHP_URL_FOPEN, REGEX, HSREGEX,
USE_CONFIG_FILE have been removed.
- The HAVE_OPENSSL symbol has been removed.
- The HAVE_OPENSSL_EXT symbol is now consistently defined to value 1 whether
the openssl extension is available either as shared or built statically.
- Added configure option --enable-phpdbg-debug to build phpdbg in debug mode.
- The win32/build/libs_version.txt file has been removed.
- MSVC builds now use the new preprocessor (/Zc:preprocessor).
- The CHECK_HEADER_ADD_INCLUDE function now consistently defines preprocessor
macros HAVE_<header>_H either to value 1 or leaves them undefined to match
the Autotools headers checks.
- 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/dom
- dom_read_t and dom_write_t now expect the function to return zend_result
instead of int.
- The macros DOM_NO_ARGS() and DOM_NOT_IMPLEMENTED() have been removed.
- New public APIs are available to handle callbacks from XPath, see
xpath_callbacks.h.
- Added public APIs to manipulate namespace data, see namespace_compat.h.
- php_dom_create_object() now no longer accepts a NULL obj argument.
- Removed the `ret` argument from the DOM_RET_OBJ macro, use the return
value instead.
- Removed DOM_XMLNS_NAMESPACE from xml_common.h. Use DOM_XMLNS_NS_URI
from namespace_compat.h instead.
- Added php_dom_get_ns_mapper(), php_dom_next_in_tree_order(),
php_dom_follow_spec_doc_ref(), and php_dom_follow_spec_doc_ref().
- 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/random
- The macro RAND_RANGE_BADSCALING() has been removed. The implementation
should either be inlined and undefined behavior fixed or it should be
replaced by a non-biased scaler.
- The php_srand() and php_rand() functions have been removed. These were
slim wrappers around the corresponding php_mt_srand() and php_mt_rand()
function since PHP 7.1, but using zend_long instead of uint32_t as their
input/output types. This made their behavior incompatible between 32-bit
and 64-bit builds of PHP. Users of these functions are encouraged to
migrate to one of the more modern engines provided since PHP 8.2. If that
is not possible, due to backwards compatibility requirements, then the
php_mt_srand() and php_mt_rand() functions should be called directly and
the values appropriately casted.
- The PHP_RAND_MAX and RAND_MAX constants corresponding to the removed
php_rand() have also been removed.
- The generate member of a php_random_algo is now expected to return
the new php_random_result struct, replacing the last_generated_size
member of the php_random_status struct and the generate_size member of
the php_random_algo struct.
- The php_random_status struct has been removed, since the previous change
reduced it to a single void* member containing the actual state, resulting
in needless indirection. Functions taking a php_random_algo struct pointer
and a php_random_status struct pointer as separate parameters now take a
single php_random_algo_with_state struct by value, making it easier to
pass around the state with its associated algorithm and thus reducing
the chance for mistakes.
- The seed member of a php_random_algo has been removed. As a replacement
engine-specific seeding functions are now exposed. This change allows
users to better take engine-specific behavior into account. As an example
Mt19937 ignored the upper half of the seed parameter of the generic
seeding function.
- The CSPRNG API (php_random_(bytes|int)_*) is now provided by the new
and much smaller php_random_csprng.h header. The new header is included
in php_random.h for compatibility with existing users.
- A new php_random_generate_fallback_seed() function has been added as a
replacement for the generically named GENERATE_SEED(). The internal
implementation has been improved to generate better seeds, however any
users should use the opportunity to verify that seeding is first
attempted using the CSPRNG for better output size flexibility.
- The standalone combined_lcg engine has been removed, as the lcg_value()
userland function is deprecated and as the engine is unable to return
unbiased integer values. The internal php_combined_lcg() function remains
available for now.
- 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/xsl
- The function php_xsl_create_object() was removed as it was not used
nor exported.
- 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/libxml
- Added php_libxml_pretend_ctx_error_ex() to emit errors as if they had come
from libxml.
- Added php_libxml_error_handler_va() to pass libxml errors, and
corresponding php_libxml_error_level enum.
- Removed the "properties" HashTable field from php_libxml_node_object.
- Added a way to attached private data to a php_libxml_ref_obj.
- Added a way to fix a class type onto php_libxml_ref_obj.
- Added a way to record quirks mode in php_libxml_ref_obj.
- Added php_libxml_uses_internal_errors().
- Added a way to override document handlers (e.g. serialization) with
php_libxml_document_handlers.
- Changed the refcount fields from int to unsigned int.
- 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/date
- Added the php_format_date_ex() API to format instances of php_date_obj.
- Added the php_date_initialize_from_ts_long() and
php_date_initialize_from_ts_double() to initialize a php_date_obj with
the given unix timestamp using GMT +00:00.
f. ext/pcre
- php_pcre_match_impl() now no longer has a use_flags argument.
When flags should be ignored, pass 0 to the flags argument.
- php_pcre_match_impl() and pcre_get_compiled_regex_cache_ex() now use
proper boolean argument types instead of integer types.
- pcre_get_compiled_regex_cache_ex() now provides an option to collect extra
options (from modifiers used in the expression, for example), and calls
pcre2_set_compile_extra_options() with those options.
- Removed per-request cache, the cache is now always per process or
per thread depending on whether you use NTS or ZTS.
This was removed due to fundamental ordering issues between destructors.
g. ext/standard
- Added the php_base64_encode_ex() API with flag parameters, value can be
PHP_BASE64_NO_PADDING to encode without the padding character '='.
- The php_escape_shell_cmd() now takes a zend_string* instead of a char*
Moreover, providing it with a binary safe string is the responsibility of
the caller now.
- The php_escape_shell_arg() now takes a zend_string* instead of a char*
Moreover, providing it with a binary safe string is the responsibility of
the caller now.
- The php_info_html_esc() function has been removed, use
php_escape_html_entities() with ENT_QUOTES directly instead.
- The deprecated php_uint32 and php_int32 typedefs have been removed from
ext/standard/basic_functions.h. Use the standard uint32_t and int32_t
types instead.
- The php_mkdir() and php_mkdir_ex() APIs have been removed, use
php_stream_mkdir() instead.
- The php_strtoupper(), php_string_toupper(), php_strtolower(), and
php_string_tolower() functions has been removed, use zend_str_toupper(),
zend_string_toupper(), zend_str_tolower(), and zend_string_tolower()
respectively instead.
- The php_replace_controlchars_ex() function is no longer exposed.
h. ext/session
- Added the php_get_session_status() API to get the session status, which is
equivalent to reading PS(session_status) but works with shared objects too.
- Added the php_get_session_var_str() API to set a session variable without
needing to create a zend_string.
- The ext/session/php_session.h doesn't transitively include the
ext/hash/php_hash.h header anymore.
- It is no longer allowed to return out of the PS_ENCODE_LOOP macro.
Instead, you should break out of the loop instead.
i. ext/xml
- Made the expat compatibility wrapper XML_GetCurrentByteIndex return a long
instead of an int. This corresponds to the XML_Index type when
XML_LARGE_SIZE is not used in expat.
- 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
========================
* DO_ICALL, DO_FCALL, and DO_FCALL_BY_NAME now call zend_interrupt_function
while the internal frame is still on the stack. This means interrupt handlers
will now see the internal call. If your interrupt handler does something like
switching EG(current_execute_data), it should not do so if an internal func
is on top.
* New FRAMELESS_ICALL_[0,3] opcodes for faster internal function calls have been
added. These opcodes don't create a stack frame, but pass arguments via opcode
operands. They only work for functions that are known at compile-time, and
that provide a frameless handler (search for usages of the
ZEND_FRAMELESS_FUNCTION macro).
* CREATE_GENERATOR now initializes the generator with opline pointing to the
CREATE_GENERATOR op (before, opline was set to the next op).
* YIELD and YIELD_FROM do not increment the opline anymore.
* The EXIT opcode has been removed as exit is now implemented as a function.
* New ZEND_DECLARE_ATTRIBUTED_CONST is used when a global constant is declared
with `const` and has attributes; this opcode is used *instead* of the
ZEND_DECLARE_CONST, and in addition to the name of the constant and the
value to use, has a ZEND_OP_DATA with a pointer to the compiled attributes.
========================
5. SAPI changes
========================
- SAPIs must now call php_child_init() after a fork. If php-src code was
executed in other threads than the one initiating the fork,
refresh_memory_manager() must be called in every such thread.

View file

@ -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:

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;
@ -480,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*);
@ -500,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,10 +713,19 @@ void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx
break;
case ZEND_DECLARE_ANON_CLASS:
case ZEND_DECLARE_CLASS_DELAYED:
case ZEND_JMP_FRAMELESS:
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))) {

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) {

View file

@ -78,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|ZEND_ACC_DEPRECATED))
&& !(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
@ -202,18 +204,12 @@ 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
@ -223,6 +219,16 @@ void zend_optimize_func_calls(zend_op_array *op_array, zend_optimizer_ctx *ctx)
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

@ -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;

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),
@ -46,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),
@ -129,9 +131,7 @@ 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)
@ -421,13 +421,12 @@ 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_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_TRUE),
#if defined(HAVE_GETSERVBYPORT)
F1("getservbyport", MAY_BE_STRING|MAY_BE_FALSE),
@ -511,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),

View file

@ -2409,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;

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;
}

View file

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

View file

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

View file

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

View file

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

View file

@ -0,0 +1,22 @@
--TEST--
__debugInfo with reference return
--FILE--
<?php
class Test {
private $tmp = ['x' => 1];
public function &__debugInfo(): array
{
return $this->tmp;
}
}
var_dump(new Test);
?>
--EXPECT--
object(Test)#1 (1) {
["x"]=>
int(1)
}

View file

@ -0,0 +1,19 @@
--TEST--
Abstract methods not allowed in classes that are not abstract (GH-16067)
--FILE--
<?php
// Still allowed via trait
trait TraitWithAbstract {
abstract public function foo();
}
class TraitWorks {
use TraitWithAbstract;
}
class NotAbstract {
abstract public function bar();
}
?>
--EXPECTF--
Fatal error: Class NotAbstract declares abstract method bar() and must therefore be declared abstract in %s on line %d

View file

@ -1,5 +1,5 @@
--TEST--
using multiple access modifiers (attributes)
using multiple access modifiers (properties)
--FILE--
<?php

View file

@ -0,0 +1,13 @@
--TEST--
Abstract function must be implemented
--FILE--
<?php
abstract class ParentClass {
abstract public function f();
}
$o = new class extends ParentClass {};
?>
--EXPECTF--
Fatal error: Class ParentClass@anonymous must implement 1 abstract method (ParentClass::f) in %sgh15994.php on line 7

View file

@ -0,0 +1,11 @@
--TEST--
Compiler prevents explicit `abstract` methods on anonymous classes
--FILE--
<?php
$c = new class {
abstract public function f();
}
?>
--EXPECTF--
Fatal error: Anonymous class method f() must not be abstract in %s on line 4

View file

@ -5,8 +5,6 @@ zend.assertions=1
--FILE--
<?php
// TODO We're missing parentheses for the direct call
try {
assert((fn() => false)());
} catch (AssertionError $e) {
@ -21,5 +19,5 @@ try {
?>
--EXPECT--
assert(): assert(fn() => false()) failed
assert(): assert(fn&(int ...$args): ?bool => $args[0](false)) failed
assert(): assert((fn() => false)()) failed
assert(): assert((fn&(int ...$args): ?bool => $args[0])(false)) failed

View file

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

View file

@ -183,7 +183,7 @@ assert(0 && ($a = function () {
$x = $a ?? $b;
[$a, $b, $c] = [1, 2 => 'x', 'z' => 'c'];
@foo();
$y = clone $x;
$y = \clone($x);
yield 1 => 2;
yield from $x;
}))

View file

@ -5,8 +5,145 @@ Asymmetric visibility on static props
class C {
public private(set) static int $prop;
public private(set) static array $prop2;
public private(set) static stdClass $prop3;
public private(set) static object $unset;
public static function reset() {
self::$prop = 1;
self::$prop2 = [];
self::$prop3 = new stdClass();
}
public static function setProp($prop) {
self::$prop = $prop;
}
public static function addProp2($prop2) {
self::$prop2[] = $prop2;
}
}
function test() {
C::reset();
try {
C::$prop = 2;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
var_dump(C::$prop);
C::setProp(3);
var_dump(C::$prop);
try {
++C::$prop;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
var_dump(C::$prop);
try {
C::$prop++;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
var_dump(C::$prop);
try {
C::$prop += str_repeat('a', 10);
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
var_dump(C::$prop);
try {
$ref = &C::$prop;
$ref++;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
var_dump(C::$prop);
try {
$ref = 4;
C::$prop = &$ref;
$ref++;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
var_dump(C::$prop);
try {
C::$prop2[] = 'foo';
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
var_dump(C::$prop2);
C::addProp2('bar');
var_dump(C::$prop2);
C::$prop3->foo = 'foo';
var_dump(C::$prop3);
unset(C::$unset->foo);
}
test();
echo "\nRepeat:\n";
test();
?>
--EXPECTF--
Fatal error: Static property may not have asymmetric visibility in %s on line %d
Cannot modify private(set) property C::$prop from global scope
int(1)
int(3)
Cannot indirectly modify private(set) property C::$prop from global scope
int(3)
Cannot indirectly modify private(set) property C::$prop from global scope
int(3)
Cannot indirectly modify private(set) property C::$prop from global scope
int(3)
Cannot indirectly modify private(set) property C::$prop from global scope
int(3)
Cannot indirectly modify private(set) property C::$prop from global scope
int(3)
Cannot indirectly modify private(set) property C::$prop2 from global scope
array(0) {
}
array(1) {
[0]=>
string(3) "bar"
}
object(stdClass)#%d (1) {
["foo"]=>
string(3) "foo"
}
Repeat:
Cannot modify private(set) property C::$prop from global scope
int(1)
int(3)
Cannot indirectly modify private(set) property C::$prop from global scope
int(3)
Cannot indirectly modify private(set) property C::$prop from global scope
int(3)
Cannot indirectly modify private(set) property C::$prop from global scope
int(3)
Cannot indirectly modify private(set) property C::$prop from global scope
int(3)
Cannot indirectly modify private(set) property C::$prop from global scope
int(3)
Cannot indirectly modify private(set) property C::$prop2 from global scope
array(0) {
}
array(1) {
[0]=>
string(3) "bar"
}
object(stdClass)#%d (1) {
["foo"]=>
string(3) "foo"
}

View file

@ -25,6 +25,9 @@ $f2 = #[A1(9)] function () { };
$f3 = #[A1(10)] fn () => 1;
#[A1(11)]
const CT_CONSTANT = 'Demo';
$ref = new \ReflectionClass(Foo::class);
$sources = [
@ -37,7 +40,8 @@ $sources = [
new \ReflectionObject($object),
new \ReflectionFunction('f1'),
new \ReflectionFunction($f2),
new \ReflectionFunction($f3)
new \ReflectionFunction($f3),
new \ReflectionConstant('CT_CONSTANT'),
];
foreach ($sources as $r) {
@ -132,3 +136,11 @@ array(1) {
[0]=>
int(10)
}
string(18) "ReflectionConstant"
int(1)
string(2) "A1"
array(1) {
[0]=>
int(11)
}

View file

@ -18,6 +18,9 @@ var_dump($rcc->getAttributes());
$rp = new ReflectionProperty('Exception', 'message');
var_dump($rp->getAttributes());
$rct = new ReflectionConstant('PHP_VERSION');
var_dump($rct->getAttributes());
?>
--EXPECT--
array(0) {
@ -30,3 +33,5 @@ array(0) {
}
array(0) {
}
array(0) {
}

View file

@ -0,0 +1,39 @@
--TEST--
Attribute flags are all different, TARGET_ALL includes all targets
--FILE--
<?php
function showFlag(string $name, int $value) {
$all = Attribute::TARGET_ALL;
$and = $all & $value;
echo "Attribute::$name = $value ($all & $value === $and)\n";
}
showFlag("TARGET_CLASS", Attribute::TARGET_CLASS);
showFlag("TARGET_FUNCTION", Attribute::TARGET_FUNCTION);
showFlag("TARGET_METHOD", Attribute::TARGET_METHOD);
showFlag("TARGET_PROPERTY", Attribute::TARGET_PROPERTY);
showFlag("TARGET_CLASS_CONSTANT", Attribute::TARGET_CLASS_CONSTANT);
showFlag("TARGET_PARAMETER", Attribute::TARGET_PARAMETER);
showFlag("TARGET_CONSTANT", Attribute::TARGET_CONSTANT);
showFlag("IS_REPEATABLE", Attribute::IS_REPEATABLE);
$all = Attribute::TARGET_CLASS | Attribute::TARGET_FUNCTION
| Attribute::TARGET_METHOD | Attribute::TARGET_PROPERTY
| Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PARAMETER
| Attribute::TARGET_CONSTANT;
var_dump($all, Attribute::TARGET_ALL, $all === Attribute::TARGET_ALL);
?>
--EXPECT--
Attribute::TARGET_CLASS = 1 (127 & 1 === 1)
Attribute::TARGET_FUNCTION = 2 (127 & 2 === 2)
Attribute::TARGET_METHOD = 4 (127 & 4 === 4)
Attribute::TARGET_PROPERTY = 8 (127 & 8 === 8)
Attribute::TARGET_CLASS_CONSTANT = 16 (127 & 16 === 16)
Attribute::TARGET_PARAMETER = 32 (127 & 32 === 32)
Attribute::TARGET_CONSTANT = 64 (127 & 64 === 64)
Attribute::IS_REPEATABLE = 128 (127 & 128 === 0)
int(127)
int(127)
bool(true)

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

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