Bug #70541 [Opn->Asn]: Changing variable type never trigger but in one case
| From: | bwoebi@php.net | Date: | Mon, 21 Sep 2015 17:02:36 +0000 |
| Subject: | Bug #70541 [Opn->Asn]: Changing variable type never trigger but in one case | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-196141@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: Open
+Status: Assigned
Type: Bug
Package: *General Issues
PHP Version: Irrelevant
-Assigned To:
+Assigned To: bwoebi
Block user comment: N
Private report: N
New Comment:
I totally agree this should be fixed. *puts on ToDo list*
Previous Comments:
------------------------------------------------------------------------
[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