Files
php-src/Zend/tests/oom_call_function_002.phpt
3584a98bda Avoid state corruption via bailout
- Replace bailout on OOM with UnwindExit
- Properly reset various globals that may be accessed during startup

Fix GHSA-w8hw-w9fx-j79w (CVE-2026-109618)
Fix GHSA-6wmf-4rv5-p3rp (CVE-2026-109619)

Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com>
Co-authored-by: Jakub Zelenka <bukka@php.net>
Co-authored-by: Nora Dossche <7771979+ndossche@users.noreply.github.com>
Co-authored-by: Nicolas Grekas <nicolas.grekas@gmail.com>
2026-10-21 16:06:22 +02:00

28 lines
700 B
PHP

--TEST--
OOM zend_call_function() after OOM: destructor called by an internal function
--INI--
memory_limit=8M
--FILE--
<?php
class A {
public function __destruct() {
echo "not reached\n";
}
}
/* array_splice() allocates the new table first, which crosses the soft limit,
* then destroys the removed element. The destructor call goes through
* zend_call_known_function(), which used to bailout with "Couldn't execute method"
* instead of the OOM. */
$n = 200000;
$arr = range(1, $n);
$arr[$n - 1] = new A;
array_splice($arr, $n - 1, 1);
echo "not reached\n";
?>
--EXPECTF--
Fatal error: Allowed memory size of %d bytes exhausted %S(tried to allocate %d bytes) in %s on line %d