xref: /PHP-8.4/ext/spl/tests/gh14639.phpt (revision 6d596207)
1--TEST--
2GH-14639 (Member access within null pointer in ext/spl/spl_observer.c)
3--INI--
4memory_limit=2M
5--SKIPIF--
6<?php
7if (getenv("USE_ZEND_ALLOC") === "0") {
8    die("skip Zend MM disabled");
9}
10$tracing = extension_loaded("Zend OPcache")
11    && ($conf = opcache_get_configuration()["directives"])
12    && array_key_exists("opcache.jit", $conf)
13    &&  $conf["opcache.jit"] === "tracing";
14if (PHP_OS_FAMILY === "Windows" && PHP_INT_SIZE == 8 && $tracing) {
15    $url = "https://github.com/php/php-src/pull/14919#issuecomment-2259003979";
16    die("xfail Test fails on Windows x64 (VS17) and tracing JIT; see $url");
17}
18?>
19--FILE--
20<?php
21$b = new SplObjectStorage();
22for ($i = 10000; $i > 0; $i--) {
23    $object = new StdClass();
24    $object->a = str_repeat("a", 2);
25    $b->attach($object);
26}
27?>
28--EXPECTF--
29Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %s on line %d
30