Skip to content

Commit dd7d829

Browse files
committed
Disable opcache optimizations during some observer tests
Opcache inlines functions that only return a constant. Disable optimizations to prevent differences in tests where such functions are used (or rewrite the test to not depend on it).
1 parent f2364f3 commit dd7d829

File tree

4 files changed

+18
-16
lines changed

4 files changed

+18
-16
lines changed

ext/zend_test/tests/observer_retval_01.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Observer: Retvals are observable that are: IS_CONST
66
zend_test.observer.enabled=1
77
zend_test.observer.observe_all=1
88
zend_test.observer.show_return_value=1
9+
opcache.optimization_level=0
910
--FILE--
1011
<?php
1112
function foo() {

ext/zend_test/tests/observer_retval_by_ref_03.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Observer: Retvals by reference are observable that are: IS_VAR, ZEND_RETURNS_FUN
66
zend_test.observer.enabled=1
77
zend_test.observer.observe_all=1
88
zend_test.observer.show_return_value=1
9+
opcache.optimization_level=0
910
--FILE--
1011
<?php
1112
function getMessage() {

ext/zend_test/tests/observer_shutdown_01.phpt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,31 @@ register_shutdown_function(function () {
1212
echo 'Shutdown: ' . foo() . PHP_EOL;
1313
});
1414

15-
function bar() {
16-
return 42;
15+
function bar($arg) {
16+
return $arg;
1717
}
1818

1919
function foo() {
20-
bar();
21-
return bar();
20+
bar(41);
21+
return bar(42);
2222
}
2323

24-
echo 'Done: ' . bar() . PHP_EOL;
24+
echo 'Done: ' . bar(40) . PHP_EOL;
2525
?>
2626
--EXPECTF--
2727
<!-- init '%s/observer_shutdown_%d.php' -->
2828
<file '%s/observer_shutdown_%d.php'>
2929
<!-- init bar() -->
3030
<bar>
31-
</bar:42>
32-
Done: 42
31+
</bar:40>
32+
Done: 40
3333
</file '%s/observer_shutdown_%d.php'>
3434
<!-- init {closure}() -->
3535
<{closure}>
3636
<!-- init foo() -->
3737
<foo>
3838
<bar>
39-
</bar:42>
39+
</bar:41>
4040
<bar>
4141
</bar:42>
4242
</foo:42>

ext/zend_test/tests/observer_shutdown_02.phpt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,33 +16,33 @@ class MyClass
1616
}
1717
}
1818

19-
function bar() {
20-
return 42;
19+
function bar($arg) {
20+
return $arg;
2121
}
2222

2323
function foo() {
24-
bar();
25-
return bar();
24+
bar(41);
25+
return bar(42);
2626
}
2727

2828
$mc = new MyClass();
2929

30-
echo 'Done: ' . bar() . PHP_EOL;
30+
echo 'Done: ' . bar(40) . PHP_EOL;
3131
?>
3232
--EXPECTF--
3333
<!-- init '%s/observer_shutdown_%d.php' -->
3434
<file '%s/observer_shutdown_%d.php'>
3535
<!-- init bar() -->
3636
<bar>
37-
</bar:42>
38-
Done: 42
37+
</bar:40>
38+
Done: 40
3939
</file '%s/observer_shutdown_%d.php'>
4040
<!-- init MyClass::__destruct() -->
4141
<MyClass::__destruct>
4242
<!-- init foo() -->
4343
<foo>
4444
<bar>
45-
</bar:42>
45+
</bar:41>
4646
<bar>
4747
</bar:42>
4848
</foo:42>

0 commit comments

Comments
 (0)