#40692 [Opn->Bgs]: Trying to use boolean as array doesn't give an error
| From: | iliaa@php.net | Date: | Sat, 03 Mar 2007 15:58:22 +0000 |
| Subject: | #40692 [Opn->Bgs]: Trying to use boolean as array doesn't give an error | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-109832@lists.php.net to get a copy of this message | ||
ID: 40692
Updated by: iliaa@php.net
Reported By: smlerman at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: Scripting Engine problem
Operating System: Any
PHP Version: 5.2.1
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
PHP is not type strict.
Previous Comments:
------------------------------------------------------------------------
[2007-03-02 16:20:40] smlerman at gmail dot com
Description:
------------
If you try to use a boolean as an array (which most likely means an
error occurred somewhere), the value is correctly returned as NULL, but
no error message is reported. Obviously not a major problem, but it
would make debugging a little easier.
Reproduce code:
---------------
<?php
var_dump(error_reporting());
$a = false;
var_dump($a[0]);
$b = (string)$a;
var_dump($b[0]);
?>
Expected result:
----------------
int(8191)
[Something like] Notice: Cannot use boolean as array in C:\Documents
and Settings\...\boolean_array.php on line 5
NULL
Notice: Uninitialized string offset: 0 in C:\Documents and
Settings\...\boolean_array.php on line 8
string(0) ""
Actual result:
--------------
int(8191)
NULL
Notice: Uninitialized string offset: 0 in C:\Documents and
Settings\Scott\My Documents\Test Files\boolean_array.php on line 8
string(0) ""
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=40692&edit=1