xref: /php-src/Zend/tests/new_oom.phpt (revision bf431132)
1--TEST--
2Test OOM on new of each class
3--SKIPIF--
4<?php
5if (getenv("USE_ZEND_ALLOC") === "0") die("skip requires zmm");
6if (getenv("SKIP_SLOW_TESTS")) die('skip slow test');
7?>
8--FILE--
9<?php
10
11$file = __DIR__ . '/new_oom.inc';
12$php = PHP_BINARY;
13
14foreach (get_declared_classes() as $class) {
15    $output = shell_exec("$php --no-php-ini $file $class 2>&1");
16    if ($output && preg_match('(^\nFatal error: Allowed memory size of [0-9]+ bytes exhausted[^\r\n]* \(tried to allocate [0-9]+ bytes\) in [^\r\n]+ on line [0-9]+$)', $output) !== 1) {
17        echo "Class $class failed\n";
18        echo $output, "\n";
19    }
20}
21
22?>
23===DONE===
24--EXPECT--
25===DONE===
26