Bug #73169 [NEW]: Variable becames reference

From: Date: Sun, 25 Sep 2016 16:57:25 +0000
Subject: Bug #73169 [NEW]: Variable becames reference
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-204254@lists.php.net to get a copy of this message
From: kilobyte at freemail dot hu Operating system: Windows 7 PHP version: 5.6Git-2016-09-25 (snap) Package: *General Issues Bug Type: Bug Bug description:Variable becames reference Description: ------------ the code: class CC { private static $bt; public function run(&$a) { self::$bt[] = debug_backtrace(); $a = 222; } } function n(&$a) { (new CC())->run($a); } $a = [ 'a' => 1, 'b' => 2, 'c' => 3 ]; n($a['b']); echo '<pre>'; var_dump($a); -------------------- this generates the following: array(3) { ["a"]=> int(1) ["b"]=> &int(222) ["c"]=> int(3) } there is a "reference &" signal at "b". If I remove this line: "self::$bt[] = debug_backtrace();" its gone, it will work right, but why do this variable goes reference? -- Edit bug report at https://bugs.php.net/bug.php?id=73169&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73169&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73169&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73169&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=73169&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=73169&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=73169&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=73169&r=needscript Try newer version: https://bugs.php.net/fix.php?id=73169&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=73169&r=support Expected behavior: https://bugs.php.net/fix.php?id=73169&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=73169&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=73169&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=73169&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73169&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=73169&r=dst IIS Stability: https://bugs.php.net/fix.php?id=73169&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=73169&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=73169&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=73169&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=73169&r=mysqlcfg

« previous php.bugs (#204254) next »