Bug #70541 [Asn->Sus]: Changing variable type never trigger but in one case

From: Date: Wed, 23 Sep 2015 16:54:02 +0000
Subject: Bug #70541 [Asn->Sus]: Changing variable type never trigger but in one case
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-196190@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70541&edit=1 ID: 70541 Updated by: bwoebi@php.net Reported by: jonathan dot massuchetti at gmail dot com Summary: Changing variable type never trigger but in one case -Status: Assigned +Status: Suspended Type: Bug Package: *General Issues PHP Version: Irrelevant -Assigned To: bwoebi +Assigned To: Block user comment: N Private report: N New Comment: That needs a RFC (I guess… or at least some thorough internals discussion). Suspending as it'll target minimum 7.1. Previous Comments: ------------------------------------------------------------------------ [2015-09-21 17:02:35] bwoebi@php.net I totally agree this should be fixed. *puts on ToDo list* ------------------------------------------------------------------------ [2015-09-21 08:46:58] jonathan dot massuchetti at gmail dot com 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 this bug report at https://bugs.php.net/bug.php?id=70541&edit=1

« previous php.bugs (#196190) next »