-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix incorrect sccp optimization of zend_switch with strict comparison
- Loading branch information
Showing
4 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
--TEST-- | ||
Test match jump table optimizer | ||
--INI-- | ||
opcache.enable=1 | ||
opcache.enable_cli=1 | ||
opcache.opt_debug_level=0x20000 | ||
--SKIPIF-- | ||
<?php if (!extension_loaded('Zend OPcache')) die('skip Zend OPcache extension not available'); ?> | ||
--FILE-- | ||
<?php | ||
|
||
function test() { | ||
$x = 20; | ||
match($x) { | ||
1, 2, 3, 4, 5 => { throw new RuntimeException(); }, | ||
default => { echo "No match\n"; }, | ||
} | ||
} | ||
test(); | ||
|
||
function test2() { | ||
$x = 'foo'; | ||
match($x) { | ||
'1', '2', '3', '4', '5' => { throw new RuntimeException(); }, | ||
default => { echo "No match\n"; }, | ||
} | ||
} | ||
test2(); | ||
|
||
--EXPECTF-- | ||
$_main: | ||
; (lines=5, args=0, vars=0, tmps=0) | ||
; (after optimizer) | ||
; %s | ||
0000 INIT_FCALL 0 %d string("test") | ||
0001 DO_UCALL | ||
0002 INIT_FCALL 0 %d string("test2") | ||
0003 DO_UCALL | ||
0004 RETURN int(1) | ||
|
||
test: | ||
; (lines=2, args=0, vars=0, tmps=0) | ||
; (after optimizer) | ||
; %s | ||
0000 ECHO string("No match | ||
") | ||
0001 RETURN null | ||
|
||
test2: | ||
; (lines=2, args=0, vars=0, tmps=0) | ||
; (after optimizer) | ||
; %s | ||
0000 ECHO string("No match | ||
") | ||
0001 RETURN null | ||
No match | ||
No match |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters