From:             
Operating system: All
PHP version:      5.2.14
Package:          Unknown/Other Function
Bug Type:         Bug
Bug description:String index access on empty string converts to array

Description:
------------
The title/code says it all. Once a variable is a string, using array access
should 

mean char access, but this is not maintained for empty strings, while it's


maintained for non-empty strings.

Test script:
---------------
$a = ''; // empty string

$a[10] = 'a';

echo $a; // "Array"



$b = ' '; // non empty string

$b[10] = 'b';

echo $b; // "          b"

Expected result:
----------------
"          a"

"          b"

Actual result:
--------------
"Array"

"          b"

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

Reply via email to