xref: /php-src/tests/lang/bug45392.phpt (revision 6d596207)
1--TEST--
2Bug #45392 (ob_start()/ob_end_clean() and memory_limit)
3--SKIPIF--
4<?php
5if (getenv("USE_ZEND_ALLOC") === "0") {
6    die("skip Zend MM disabled");
7}
8$tracing = extension_loaded("Zend OPcache")
9    && ($conf = opcache_get_configuration()["directives"])
10    && array_key_exists("opcache.jit", $conf)
11    &&  $conf["opcache.jit"] === "tracing";
12if (PHP_OS_FAMILY === "Windows" && PHP_INT_SIZE == 8 && $tracing) {
13    $url = "https://github.com/php/php-src/pull/14919#issuecomment-2259003979";
14    die("xfail Test fails on Windows x64 (VS17) and tracing JIT; see $url");
15}
16?>
17--FILE--
18<?php
19echo __LINE__ . "\n";
20ini_set('memory_limit', "2M");
21ob_start();
22$i = 0;
23while($i++ < 5000)  {
24  echo str_repeat("may not be displayed ", 42);
25}
26ob_end_clean();
27?>
28--EXPECTF--
292
30
31Fatal error: Allowed memory size of %d bytes exhausted%s
32