Skip to content

Commit 6ca6b46

Browse files
committed
Merge branch 'PHP-8.2'
* PHP-8.2: Fix incorrect CG(memoize_mode) state after bailout in ??=
2 parents 6f63d4b + 439919c commit 6ca6b46

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

Zend/tests/gh11108.phpt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--TEST--
2+
GH-11108: Incorrect CG(memoize_mode) state after bailout in ??=
3+
--FILE--
4+
<?php
5+
register_shutdown_function(function() {
6+
include __DIR__ . '/gh11108_shutdown.inc';
7+
});
8+
include __DIR__ . '/gh11108_test.inc';
9+
?>
10+
--EXPECTF--
11+
Fatal error: Cannot use [] for reading in %s on line %d

Zend/tests/gh11108_shutdown.inc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
function test() {
4+
throw new Exception();
5+
}

Zend/tests/gh11108_test.inc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?php
2+
3+
$messageList[] ??= true;

Zend/zend.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,6 +1190,7 @@ ZEND_API ZEND_COLD ZEND_NORETURN void _zend_bailout(const char *filename, uint32
11901190
CG(unclean_shutdown) = 1;
11911191
CG(active_class_entry) = NULL;
11921192
CG(in_compilation) = 0;
1193+
CG(memoize_mode) = 0;
11931194
EG(current_execute_data) = NULL;
11941195
LONGJMP(*EG(bailout), FAILURE);
11951196
}

0 commit comments

Comments
 (0)