|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2018-12-06 20:35 UTC] mail dot cmcm at gmail dot com
Description:
------------
I basically have this code in a project (in a private static function):
$a = false;
$var = "overview";
switch($var)
{
case "overview":
$a = true;
break;
case "details":
break;
}
console($a);
And with PHP 7.3 the result is "false"! Doesn't happen with PHP 5.6-7.2.
I tried to reproduce this bug outside my project, but couldn't. However I see nothing in my code that could produce such an odd result. In fact if I add the console output (via ChromePhp) like this
case "overview":
$a = true;
console($a);
break;
I get "true" on both outputs.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 05:00:01 2025 UTC |
Reduced test case based on code provided via mail: function test($x) { switch ($x["y"]) { case "a": break; case "b": break; } } This generates "Block 4 predecessors missing 1" SSA verification errors, first appearing after jump optimization.Okay, that was maybe a bit too reduced. A better variant is: <?php function test($x) { $a = false; switch($x["y"]) { case "a": $a = true; break; case "b": break; case "c": break; } return $a; } var_dump(test(["y" => "a"])); The issue is basically that we currently require that block predecessors are unique. The code for unlinking a block has a broken implementation of the deduplication. However, the more important issue is that if we remove predecessors due to deduplication, we must also adjust phi nodes accordingly. Those issues can be fixed, but I think that the cleaner fix would be to relax the restriction on duplicate predecessors. Not sure what other fallout that would have though.