#38165 [NEW]: no error to return non-existent index of a non-array variable
| From: | aurelien dot riche at ac-lille dot fr | Date: | Thu, 20 Jul 2006 15:58:31 +0000 |
| Subject: | #38165 [NEW]: no error to return non-existent index of a non-array variable | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-99683@lists.php.net to get a copy of this message | ||
From: aurelien dot riche at ac-lille dot fr
Operating system: linux
PHP version: 5.1.4
PHP Bug Type: Arrays related
Bug description: no error to return non-existent index of a non-array variable
Description:
------------
There's no error reporting for this code below...
'index' is interpreted as 1 and the value returned is the first letter of
string 'hello world'
If it's a normal behavior, can you specify this in the documentation ?
Reproduce code:
---------------
$var = 'hello world';
echo $var['index'];
echo '<br/><br/>';
if(isset($var['index']))
echo 'OK';
Expected result:
----------------
Notice: Undefined offset: 'index'
Actual result:
--------------
h
OK
--
Edit bug report at http://bugs.php.net/?id=38165&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=38165&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=38165&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=38165&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=38165&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=38165&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=38165&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=38165&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=38165&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=38165&r=support
Expected behavior: http://bugs.php.net/fix.php?id=38165&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=38165&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=38165&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=38165&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38165&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=38165&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=38165&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=38165&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=38165&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=38165&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=38165&r=mysqlcfg