Bug #55032 [Opn->Dup]: Treating null, boolean and numbers as arrays does not trigger an error
| From: | aharvey@php.net | Date: | Tue, 14 Jun 2011 13:51:14 +0000 |
| Subject: | Bug #55032 [Opn->Dup]: Treating null, boolean and numbers as arrays does not trigger an error | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-161388@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=55032&edit=1
ID: 55032
Updated by: aharvey@php.net
Reported by: cagret at gmail dot com
Summary: Treating null, boolean and numbers as arrays does
not trigger an error
-Status: Open
+Status: Duplicate
Type: Bug
Package: Variables related
Operating System: Linux, Windows
PHP Version: 5.3.6
Block user comment: N
Private report: N
New Comment:
This is intended behaviour, per bug #41195.
Previous Comments:
------------------------------------------------------------------------
[2011-06-13 19:14:44] cagret at gmail dot com
If implementing it is a performance problem (can't think of any other reason why it still
hasn't been fixed), then you could at least give us an
option, for example a php.ini option "check_types" that would be checking for such error.
That would allow us to enable this option on Developer
machines during testings and hopefully we would catch and fix all of these errors before uploading
the code to the Production machine.
------------------------------------------------------------------------
[2011-06-11 02:19:47] cagret at gmail dot com
Description:
------------
This bug is really annoying and generates many headeaches to millions of php
developers. It's really hard to detect this bug sometimes, and that is because
we have so much faith in PHP and we think that it's not possible that php would
allow us to write such a nonsensical code and not throw an error, after all
didn't we set the most strict error reporting you allow us to set?
This example code should be self explanatory:
<?php
error_reporting(-1); // The most strict error reporting.
$n = null;
echo $n[12]; // That should generate at least a E_NOTICE or E_STRICT warning.
$f = false;
echo $f[12]; // No error.
$t = true;
echo $t[12]; // No error, again.
$a = 4;
echo $a[12]; // Oh really, again no error? What a surprise!
$a = 4.44;
echo $a[12]; // And what do you think?! Guess! No error!
?>
Please fix it ASAP.
Thank you for your time.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=55032&edit=1