From:             a dot dotreppe at aspyct dot org
Operating system: Windows Vista 32bit
PHP version:      5.3.0
PHP Bug Type:     Scripting Engine problem
Bug description:  Can use any scalar as an array

Description:
------------
Hi

I just noticed that any scalar type could be used as an array.
This could be source of a long list of undetectable bugs.
Should this be considered as a bug ?

Except for strings, that should be indexable. But then, only with numeric
indexes, not strings (that are anyway evaluated to 0).

Reproduce code:
---------------
$value = false;
var_dump($value['hello']);

$value = 4;
var_dump($value['hello']);

$value = 74.6;
var_dump($value['hello']);

$value = 'hello';
var_dump($value['hello']);

Expected result:
----------------
Some Fatal error, something brutal that will halt the script.

Actual result:
--------------
NULL NULL NULL string(1) "h" 

-- 
Edit bug report at http://bugs.php.net/?id=49264&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=49264&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=49264&r=trysnapshot53
Try a snapshot (PHP 6.0):            
http://bugs.php.net/fix.php?id=49264&r=trysnapshot60
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=49264&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=49264&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=49264&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=49264&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=49264&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=49264&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=49264&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=49264&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=49264&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=49264&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=49264&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=49264&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=49264&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=49264&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=49264&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=49264&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=49264&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=49264&r=mysqlcfg

Reply via email to