From:             smlerman at gmail dot com
Operating system: Any
PHP version:      5.2.1
PHP Bug Type:     Scripting Engine problem
Bug description:  Trying to use boolean as array doesn't give an error

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 bug report at http://bugs.php.net/?id=40692&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=40692&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=40692&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=40692&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=40692&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=40692&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=40692&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=40692&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=40692&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=40692&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=40692&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=40692&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=40692&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=40692&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=40692&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=40692&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=40692&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=40692&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=40692&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=40692&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=40692&r=mysqlcfg

Reply via email to