Commit graph

68953 commits

Author SHA1 Message Date
Niels Dossche
1e94f3423b
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Split off php_set_sock_blocking() and s.is_blocked to a separate function
  Fix missing checks against php_set_blocking() in xp_ssl.c
2025-05-20 08:08:39 +02:00
Niels Dossche
1863014fbd
Split off php_set_sock_blocking() and s.is_blocked to a separate function
This makes it harder to forget the check and keeps the variable and
function call consistent.

Closes GH-18604.
2025-05-20 08:08:06 +02:00
Niels Dossche
31ebb42268
Fix missing checks against php_set_blocking() in xp_ssl.c 2025-05-20 08:07:34 +02:00
Niels Dossche
b2d78ae00c
Backport accel_globals->key leak fix (8.3)
Closes GH-18602.
2025-05-19 22:27:54 +02:00
Niels Dossche
db3bf715e0
Fix leak of accel_globals->key
I don't know why this was guarded with ZTS, but it leaks on this test
(and a few more):
`./sapi/cli/php ./run-tests.php -c . --show-diff sapi/phpdbg/tests/stdin_001.phpt`

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

Closes GH-18586.
2025-05-19 19:21:53 +02:00
Niels Dossche
43915b302c
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-18567: Preloading with internal class alias triggers assertion failure
2025-05-19 19:20:11 +02:00
Niels Dossche
41e11a627d
Fix GH-18567: Preloading with internal class alias triggers assertion failure
The assertion is imprecise now, and the code assumed that from the
moment an internal class was encountered that there were only internal
classes remaining. This is wrong now, and we still have to continue if
we encounter an internal class. We can only skip the remaining iterations
if the entry in the hash table is not an alias.

Closes GH-18575.
2025-05-19 19:19:26 +02:00
Niels Dossche
9bf140afb4
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix deprecation warning for libxml SAX header (#18594)
2025-05-19 19:11:22 +02:00
Niels Dossche
92a0cc7d94
Fix deprecation warning for libxml SAX header (#18594)
This header is deprecated, but fortunately it isn't actually used.
2025-05-19 19:10:27 +02:00
Niels Dossche
dbc7c5f34a
Backport lexbor/lexbor@814e0bce97 (#18574)
Co-authored-by: Alexander Borisov <lex.borisov@gmail.com>
2025-05-16 20:27:56 +02:00
Remi Collet
8647624261
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  NEWS
  Fix GH-18529: ldap no longer respects TLS_CACERT from ldaprc in ldap_start_tls() Regresion introduced in fix for GH-17776
2025-05-15 09:22:09 +02:00
Remi Collet
2760a3ef97
Fix GH-18529: ldap no longer respects TLS_CACERT from ldaprc in ldap_start_tls() Regresion introduced in fix for GH-17776
- ensure TLS string options are properly inherited
  workaround to openldap issue https://bugs.openldap.org/show_bug.cgi?id=10337

- fix ldaps/start_tls tests using LDAPNOINIT in ldaps/tls tests
2025-05-15 09:19:57 +02:00
Arnaud Le Blanc
18276a8b42
Snapshotted poly_func / poly_this may be spilled
Polymorphic calls pass this and the function to side traces via snapshotting.
However, we assume that this/func are in registers, when in fact they may be
spilled.

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

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

Closes GH-18408
2025-05-14 12:27:57 +02:00
Tim Düsterhus
40edd58d36
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  standard: Take `zend.assertions` into account for dynamic calls to `assert()` (#18521)
2025-05-12 08:45:26 +02:00
Tim Düsterhus
8d2682fc50
standard: Take zend.assertions into account for dynamic calls to assert() (#18521)
Fixes php/php-src#18509.
2025-05-12 08:44:46 +02:00
Tim Düsterhus
84f82d0a1c
gen_stub: Fix ce_flags generation for compatibility mode (#18507)
* gen_stub: Fix `ce_flags` generation for compatibility mode

Fixes php/php-src#18506

* gen_stub: Improve output for ce_flags compatibility
2025-05-09 13:33:09 +02:00
Remi Collet
71ffa9596a
bump zip extension version to 1.22.6 2025-05-07 14:24:07 +02:00
Niels Dossche
dcf9d8f812
Fix GH-18494: PDO OCI segfault in statement GC
This is the same issue that was fixed in 2ae897fff7, but now for OCI.

Closes GH-18495.
2025-05-05 19:30:23 +02:00
David Carlier
2e2077172d
Merge branch 'PHP-8.3' into PHP-8.4 2025-05-04 14:15:05 +01:00
David Carlier
8a585856d1
Fix GH-18480: array_splice overflow on array length with offset.
close GH-18483
2025-05-04 14:14:22 +01:00
Niels Dossche
42ad1c64bf
Backport lexbor/lexbor#274
Co-authored-by: Alex Peattie <alexpeattie@gmail.com>

Closes GH-18490.
2025-05-04 12:57:54 +02:00
David Carlier
a7b78a5091
Fix ext/date: date_sunrise() new tests.
close GH-18489
2025-05-03 19:40:16 +01:00
David Carlier
004d7cd290
Merge branch 'PHP-8.3' into PHP-8.4 2025-05-03 16:56:32 +01:00
David Carlier
0227d96f48
Fix GH-18481: date_sunrise check sun rise with offset if is finite/is nan
close GH-18484
2025-05-03 16:56:09 +01:00
David Carlier
351face053
Merge branch 'PHP-8.3' into PHP-8.4 2025-05-02 21:32:20 +01:00
David Carlier
24ab0f1ea1
Fixed GH-18458: Authorization set with CURLOPT_USERPWD with NULL value.
Close GH-18460
2025-05-02 21:31:50 +01:00
Niels Dossche
8d6e377ed8
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Update NEWS for the intl reference fixes
  Fix reference handling of IntlTimeZone::getCanonicalID/intltz_get_canonical_id
  Fix reference handling of grapheme_extract()
  Fix numfmt_parse_currency() reference handling
2025-05-01 10:42:25 +02:00
Niels Dossche
a090e59b37
Fix reference handling of IntlTimeZone::getCanonicalID/intltz_get_canonical_id
Closes GH-18469.
2025-05-01 10:41:32 +02:00
Niels Dossche
e3105f5f1e
Fix reference handling of grapheme_extract()
Closes GH-18471.
2025-05-01 10:40:17 +02:00
Niels Dossche
e3cac07a9b
Fix numfmt_parse_currency() reference handling
Closes GH-18472.
2025-05-01 10:39:53 +02:00
Ilija Tovilo
386ab1dad2
Revert "Fix infinite recursion on deprecated attribute evaluation"
This reverts commit 272f7f75e2.

Reverts GH-17712 for the PHP-8.4 branch. This will be reapplied later
with a fix for GH-18463 (GH-18464).
2025-04-30 20:52:56 +02:00
David Carlier
d9d58c9d79
Revert "Fixed GH-18458: Authorization set with CURLOPT_USERPWD with NULL value."
This reverts commit bb431f124c.
2025-04-29 22:48:16 +01:00
David Carlier
bb431f124c
Fixed GH-18458: Authorization set with CURLOPT_USERPWD with NULL value. 2025-04-29 22:41:32 +01:00
Arnaud Le Blanc
978c01ce15
JIT: Check exception on exit
Add a new exit flag (ZEND_JIT_EXIT_CHECK_EXCEPTION) that enables exception
checking during exit/deoptimization.

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

This also fixes two issues in zend_jit_trace_exit():

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

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

Fixes GH-18262
Closes GH-18297
2025-04-29 10:55:31 +02:00
Niels Dossche
c620fee404
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-18417: Windows SHM reattachment fails when increasing memory_consumption or jit_buffer_size
2025-04-28 19:52:22 +02:00
Niels Dossche
7869af6fa8
Fix GH-18417: Windows SHM reattachment fails when increasing memory_consumption or jit_buffer_size
When a first PHP process launches, Opcache creates a shared file mapping
to use as a shm region. The size of this mapping is set by
opcache.memory_consumption.
When a new PHP process launches while the old one is still running,
Opcache tries to reattach to the shm.
When reattaching it tries to map the requested size (i.e. set by
opcache.memory_consumption). However, if the new requested size is
larger than the size used in the original file mapping, then the call
to VirtualProtect() will fail and the new PHP process will fail to
launch.
It's not possible to resize the virtual region on Windows, unless
relying on undocumented APIs like `NtExtendSection` but then we would
sitll need to communicate that to the first process.

This issue is the root cause of Psalm end-to-end tests failing in
GH-18417: Psalm estimates the required memory sizes and relaunches itself
with more memory requested, if its estimate is below the currently allocated
shared memory. This causes a crash on startup and the tests fail.

To solve this, we need to make the mappings unique per requested size.
There are two ideas:
1. Include in zend_system_id. However, this also affects other things
   and may be too overkill.
2. Include it in the filename, this is an easy local change.
   I went with this option.

Closes GH-18443.
2025-04-28 19:51:31 +02:00
Niels Dossche
173dccb646
Fix IntlDateFormatter::parseToCalendar() reference type system breaks
Closes GH-18440.
2025-04-27 11:33:21 +02:00
Niels Dossche
d00adca199
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  datefmt_parse/datefmt_localtime references type system fixes
  Fix GH-18438: Handling of empty data and errors in ZipArchive::addPattern
2025-04-27 11:32:57 +02:00
Niels Dossche
2beec54e47
datefmt_parse/datefmt_localtime references type system fixes
Closes GH-18441.
2025-04-27 11:31:35 +02:00
Niels Dossche
2eb3100dca
Fix GH-18438: Handling of empty data and errors in ZipArchive::addPattern
There is a ZPP arginfo violation because the empty return or error
return is not always properly handled.
And there is also a memory leak if creating the regular expression
instance fails.

Closes GH-18438.
2025-04-27 11:30:57 +02:00
Niels Dossche
5b8db66227
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-18431: Registering ZIP progress callback twice doesn't work
2025-04-26 14:23:54 +02:00
Niels Dossche
b066ac0b23
Fix GH-18431: Registering ZIP progress callback twice doesn't work
Libzip already cleans up the previous callback, so when that means:
1. The callback zval being already copied over the previous one causes
   libzip to clean up the new callback object. This is the root cause.
2. Our own code to clean the old callback is redundant.

Closes GH-18432.
2025-04-26 14:21:03 +02:00
Niels Dossche
7a2bef02c0
Fix GH-18400: http_build_query type error is inaccurate
Objects are also accepted still, so the error message is misleading.

Closes GH-18434.
2025-04-26 14:17:24 +02:00
Niels Dossche
4ff41cfb4b
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-18421: Integer overflow with large numbers in LimitIterator
2025-04-25 20:06:18 +02:00
Niels Dossche
a91d913901
Fix GH-18421: Integer overflow with large numbers in LimitIterator
Since we already know that `pos < intern->u.limit.offset` at this point,
we can reverse the expression.

Closes GH-18424.
2025-04-25 20:05:55 +02:00
Niels Dossche
c6ed104e91
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17403: Potential deadlock when putenv fails
2025-04-24 20:22:30 +02:00
Niels Dossche
32e091260a
Fix GH-17403: Potential deadlock when putenv fails
Closes GH-18368.
2025-04-24 20:22:04 +02:00
Ilija Tovilo
303610154b
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [skip ci] Increase tolerance for cve-2014-3538 tests
2025-04-24 11:27:32 +02:00
Ilija Tovilo
438f07c9f7
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  [skip ci] Increase tolerance for cve-2014-3538 tests
2025-04-24 11:27:25 +02:00