From: smh at wannafind dot dk Operating system: Linux 2.6.24.3-50.fc8 PHP version: 5.2.9 PHP Bug Type: Feature/Change Request Bug description: Confusing behavior
Description: ------------ Requesting a string index on a string type using the string as an array always returns first character position in string. Reproduce code: --------------- <?php $input = '386'; echo $input . " / " . $input['tessrthwsrtht'] . "\n"; ?> Expected result: ---------------- PHP should generate an error when this occurs, because this situation occurs when you think a method/function returns a string indexed array but really just returns a string. In this situation you get some data, but the data is incorrect and this can be very confusing to debug. Actual result: -------------- PHP casts the string index to an integer with the value: 0 and returns the first character in the string. -- Edit bug report at http://bugs.php.net/?id=48142&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48142&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48142&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48142&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=48142&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48142&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=48142&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=48142&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=48142&r=needscript Try newer version: http://bugs.php.net/fix.php?id=48142&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=48142&r=support Expected behavior: http://bugs.php.net/fix.php?id=48142&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=48142&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=48142&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=48142&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48142&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=48142&r=dst IIS Stability: http://bugs.php.net/fix.php?id=48142&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=48142&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=48142&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=48142&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=48142&r=mysqlcfg
