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

From: Date: Thu, 06 Dec 2018 20:35:28 +0000
Subject: Bug #77257 [NEW]: value of variable assigned in a switch() construct gets lost
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-218299@lists.php.net to get a copy of this message
From:             mail dot cmcm at gmail dot com
Operating system: Windows 10
PHP version:      7.3.0
Package:          *General Issues
Bug Type:         Bug
Bug description:value of variable assigned in a switch() construct gets lost

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 bug report at https://bugs.php.net/bug.php?id=77257&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=77257&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=77257&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=77257&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=77257&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=77257&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=77257&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=77257&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=77257&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=77257&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=77257&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=77257&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=77257&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=77257&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77257&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=77257&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=77257&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=77257&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=77257&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=77257&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=77257&r=mysqlcfg



Thread (10 messages)

« previous php.bugs (#218299) next »