Skip to content

Commit 31c18ce

Browse files
committed
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4: Fix GH-25311: Assertion ret == SUCCESS in array_map()/array_filter() after delayed out-of-memory
2 parents 1e8a35d + 0f779a6 commit 31c18ce

3 files changed

Lines changed: 20 additions & 2 deletions

File tree

‎NEWS‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ PHP NEWS
2323
nested isset()/empty(). (Jorg Sowa)
2424
. Fixed AST printing dropping readonly on promoted constructor parameters.
2525
(Jorg Sowa)
26+
. Fixed bug GH-25311 (Assertion ret == SUCCESS in array_map()/array_filter()
27+
after delayed out-of-memory). (ndossche)
2628

2729
- Curl:
2830
. Fixed curl_reset() retaining CURLOPT_PRIVATE after reset. (lacatoire)

‎Zend/zend_execute_API.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -836,9 +836,11 @@ zend_result zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_
836836
return FAILURE; /* executor is already inactive */
837837
}
838838
if (ZEND_HAS_OOM()) {
839-
/* Callers expect SUCCESS || EG(exception), so let's throw right now */
839+
/* Throws UnwindExit if the OOM is pending. If not pending, acts as if executor is inactive. */
840840
zend_handle_delayed_oom();
841-
return FAILURE;
841+
if (!EG(exception)) {
842+
return FAILURE;
843+
}
842844
}
843845
if (EG(exception)) {
844846
if (fci_cache) {
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
--TEST--
2+
GH-25311 (Assertion ret == SUCCESS in array_map()/array_filter() after delayed out-of-memory)
3+
--INI--
4+
memory_limit=10M
5+
--FILE--
6+
<?php
7+
8+
$s = str_repeat("a", 5 * 1024 * 1024);
9+
$s .= $s;
10+
array_map(fn($x) => $x, [1]);
11+
12+
?>
13+
--EXPECTF--
14+
Fatal error: Allowed memory size of 10485760 bytes exhausted %s

0 commit comments

Comments
 (0)