mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
op1 of ZEND_MATCH_ERROR, which refers to the match expression, is not freed by MATCH_ERROR itself. Instead, it is freed by ZEND_HANDLE_EXCEPTION. For normal control flow, a FREE is placed at the end of the match expression. Since FREE may appear after MATCH_ERROR in the opcode sequence, we need to correctly handle op1 of MATCH_ERROR as alive. Fixes GH-17106 Closes GH-17108
22 lines
301 B
PHP
22 lines
301 B
PHP
--TEST--
|
|
GH-17106: ZEND_MATCH_ERROR misoptimization
|
|
--EXTENSIONS--
|
|
opcache
|
|
--INI--
|
|
opcache.enable_cli=1
|
|
opcache.optimization_level=-1
|
|
--FILE--
|
|
<?php
|
|
|
|
const X = 2;
|
|
|
|
var_dump(7 ?? match (X) {});
|
|
var_dump(null ?? match (X) { 2 => 2 });
|
|
var_dump(match (X) { 2 => 2 });
|
|
|
|
?>
|
|
--EXPECT--
|
|
int(7)
|
|
int(2)
|
|
int(2)
|