Skip to content

Commit 50fe247

Browse files
committed
Fix test
Test will exhaust memory before reaching stack limit with opcache enabled
1 parent dd3f1c0 commit 50fe247

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
if (!class_exists("constructs_in_destructor")) {
4+
class constructs_in_destructor {
5+
public function __destruct() {
6+
$a = new constructs_in_destructor;
7+
$time = '';
8+
require(__FILE__);
9+
}
10+
}
11+
}
12+
13+
$a = new constructs_in_destructor;

Zend/tests/stack_limit/stack_limit_013.phpt

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,11 @@ memory_limit=2G
1313
<?php
1414

1515
try {
16-
if (!class_exists("constructs_in_destructor")) {
17-
class constructs_in_destructor {
18-
public function __destruct() {
19-
for ($i = 0; $i < 10000; ++$i) {
20-
$a = new constructs_in_destructor;
21-
$time = '';
22-
require(__FILE__);
23-
}
24-
}
25-
}
26-
}
27-
28-
$a = new constructs_in_destructor;
16+
require __DIR__.'/stack_limit_013.inc';
2917
} catch (Error $e) {
3018
echo $e->getMessage(), "\n";
3119
}
3220

3321
?>
3422
--EXPECTF--
35-
%SMaximum call stack size of %d bytes reached%s
23+
%S%rMaximum call stack size of [0-9]+ bytes reached|Allowed memory size of [0-9]+ bytes exhausted%r%s

0 commit comments

Comments
 (0)