Bug #77257 [Com]: value of variable assigned in a switch() construct gets lost

From: Date: Fri, 07 Dec 2018 07:04:45 +0000
Subject: Bug #77257 [Com]: value of variable assigned in a switch() construct gets lost
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-218306@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77257&edit=1

 ID:                 77257
 Comment by:         info at cmcm dot info
 Reported by:        mail dot cmcm at gmail dot com
 Summary:            value of variable assigned in a switch() construct
                     gets lost
 Status:             Feedback
 Type:               Bug
 Package:            *General Issues
 Operating System:   Windows 10
 PHP Version:        7.3.0
 Block user comment: N
 Private report:     N

 New Comment:

Indeed, disabling opcache fixed the problem. So is this a bug specific to 7.3 or the windows
version? Because I never had a problem with 7.2 and opcache enabled.


Previous Comments:
------------------------------------------------------------------------
[2018-12-06 20:53:23] requinix@php.net

What if you disable opcache?

------------------------------------------------------------------------
[2018-12-06 20:35:28] 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.



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=77257&edit=1


Thread (10 messages)

« previous php.bugs (#218306) next »