Skip to content

Commit 439919c

Browse files
committed
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1: Fix incorrect CG(memoize_mode) state after bailout in ??=
2 parents b2282be + 4c38a79 commit 439919c

File tree

5 files changed

+22
-0
lines changed

5 files changed

+22
-0
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ PHP NEWS
1111
. Fixed bug GH-10737 (PHP 8.1.16 segfaults on line 597 of
1212
sapi/apache2handler/sapi_apache2.c). (nielsdos, ElliotNB)
1313
. Fixed bug GH-11028 (Heap Buffer Overflow in zval_undefined_cv.). (nielsdos)
14+
. Fixed bug GH-11108 (Incorrect CG(memoize_mode) state after bailout in ??=).
15+
(ilutov)
1416

1517
- Date:
1618
. Fixed bug where the diff() method would not return the right result around

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
@@ -1172,6 +1172,7 @@ ZEND_API ZEND_COLD ZEND_NORETURN void _zend_bailout(const char *filename, uint32
11721172
CG(unclean_shutdown) = 1;
11731173
CG(active_class_entry) = NULL;
11741174
CG(in_compilation) = 0;
1175+
CG(memoize_mode) = 0;
11751176
EG(current_execute_data) = NULL;
11761177
LONGJMP(*EG(bailout), FAILURE);
11771178
}

0 commit comments

Comments
 (0)