1
0
mirror of https://github.com/php/php-src.git synced 2026-04-19 22:11:12 +02:00
Files
archived-php-src/ext/opcache/tests/bug80900.phpt
twosee 7c6cf09463 Fixed bug #80900
SCCP optimization marks the wrong target feasible when the constant is of the incorrect type.

Closes GH-6861.
2021-04-14 00:07:32 +08:00

57 lines
1.0 KiB
PHP

--TEST--
Bug 80900: Switch constant with incorrect type
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.optimization_level=-1
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
function switchLong() {
$var = 'foo';
/* The number of case clauses needs to be greater than 5,
* otherwise it will not be compiled into SWITCH_LONG. */
switch ($var) {
case 1:
echo 'no1';
break;
case 2:
echo 'no2';
break;
case 3:
echo 'no3';
break;
case 4:
echo 'no4';
break;
case 5:
echo 'no5';
break;
default:
echo 'yes';
break;
}
echo PHP_EOL;
}
function switchString() {
$var = false;
switch ($var) {
case 'string':
echo 'no';
break;
default:
echo 'yes';
break;
}
echo PHP_EOL;
}
switchLong();
switchString();
?>
--EXPECT--
yes
yes