Bug #70541 [NEW]: Changing variable type never trigger but in one case

From: Date: Mon, 21 Sep 2015 08:47:01 +0000
Subject: Bug #70541 [NEW]: Changing variable type never trigger but in one case
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-196124@lists.php.net to get a copy of this message
From: jonathan dot massuchetti at gmail dot com Operating system: PHP version: Irrelevant Package: *General Issues Bug Type: Bug Bug description:Changing variable type never trigger but in one case Description: ------------ Hello, I've this one on reddit ( https://www.reddit.com/r/lolphp/comments/3hm7hh/conjure_arrays_from_nothing ). I've verified this in PHP 7 RC 3 but according to the author of the reddit post and to testing website such as 3v4l.org, it is a valid issue from PHP 4.3 to PHP 7.0.0 RC 3. So as a brief description, you set a variable to false, than you implicitly turn it into an array, no error is triggered. But when you set it to true, and then change it into an array, a warning is raised. Test script: --------------- <?php $foo = false; $foo["bar"] = "baz"; // No warning $foo = true; $foo["bar"] = "baz"; // Warning: Cannot use a scalar value as an array Expected result: ---------------- Consistant output. Always or never. IMHO it should be always. -- Edit bug report at https://bugs.php.net/bug.php?id=70541&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70541&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70541&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70541&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=70541&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=70541&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=70541&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=70541&r=needscript Try newer version: https://bugs.php.net/fix.php?id=70541&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=70541&r=support Expected behavior: https://bugs.php.net/fix.php?id=70541&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=70541&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=70541&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=70541&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70541&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=70541&r=dst IIS Stability: https://bugs.php.net/fix.php?id=70541&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=70541&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=70541&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=70541&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=70541&r=mysqlcfg

« previous php.bugs (#196124) next »