diff --git a/Zend/tests/new_oom.phpt b/Zend/tests/new_oom.phpt
index a424e12b4eab9..fc0f6323236f4 100644
--- a/Zend/tests/new_oom.phpt
+++ b/Zend/tests/new_oom.phpt
@@ -13,7 +13,7 @@ $php = PHP_BINARY;
foreach (get_declared_classes() as $class) {
$output = shell_exec("$php --no-php-ini $file $class 2>&1");
- 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) {
+ 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]+\nStack trace:\n(#[0-9]+ [^\r\n]+\n)+$/', $output) !== 1) {
echo "Class $class failed\n";
echo $output, "\n";
}
diff --git a/ext/opcache/tests/gh8846.phpt b/ext/opcache/tests/gh8846.phpt
index 98e94a401cb7a..1e9dd68f191cf 100644
--- a/ext/opcache/tests/gh8846.phpt
+++ b/ext/opcache/tests/gh8846.phpt
@@ -34,6 +34,9 @@ echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/gh8846-index.php?s
bool(true)
Fatal error: Cannot redeclare class Foo (previously declared in %sgh8846-1.inc:2) in %sgh8846-2.inc on line %d
+Stack trace:
+#0 %sgh8846-index.php(%d): include()
+#1 {main}
bool(true)
Ok