From:             thuejk at gmail dot com
Operating system: Linux
PHP version:      5.2.0
PHP Bug Type:     Feature/Change Request
Bug description:  Trying to access the index of an integer should throw a 
warning

Description:
------------
Trying to access the index of an integer is not a well-defined operation
IMO, having no reasonable meaning. In practice in PHP, it seems to simply
return null in all cases.

I accidentally accessed an integer which I thought was a string. Because
no error was returned it took me some time to track down the problem.

Therefore, I suggest that trying to access an index on an integer should
throw an E_NOTICE or E_WARNING.

Reproduce code:
---------------
error_reporting(E_ALL | E_STRICT);

$a = 1234;
//This will print "", with no error raised.
echo '"'.$a[0].'"';



Expected result:
----------------
An E_NOTICE or E_WARNING.

Actual result:
--------------
No error raised

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

Reply via email to