Skip to content

Fix incorrect CG(memoize_mode) state after bailout in ??= #11109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Zend/tests/gh11108.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--TEST--
GH-11108: Incorrect CG(memoize_mode) state after bailout in ??=
--FILE--
<?php
register_shutdown_function(function() {
include __DIR__ . '/gh11108_shutdown.inc';
});
include __DIR__ . '/gh11108_test.inc';
?>
--EXPECTF--
Fatal error: Cannot use [] for reading in %s on line %d
5 changes: 5 additions & 0 deletions Zend/tests/gh11108_shutdown.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

function test() {
throw new Exception();
}
3 changes: 3 additions & 0 deletions Zend/tests/gh11108_test.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

$messageList[] ??= true;
1 change: 1 addition & 0 deletions Zend/zend.c
Original file line number Diff line number Diff line change
Expand Up @@ -1193,6 +1193,7 @@ ZEND_API ZEND_COLD ZEND_NORETURN void _zend_bailout(const char *filename, uint32
CG(active_class_entry) = NULL;
CG(in_compilation) = 0;
EG(current_execute_data) = NULL;
CG(memoize_mode) = 0;
LONGJMP(*EG(bailout), FAILURE);
}
/* }}} */
Expand Down