ID: 48142 Updated by: scott...@php.net Reported By: smh at wannafind dot dk -Status: Open +Status: Bogus Bug Type: Feature/Change Request Operating System: Linux 2.6.24.3-50.fc8 PHP Version: 5.2.9 New Comment:
Adding new errors would result in breaking backwards compatibility so it isn't really practical to change. You could add an array typehint to parameters to add extra checking. Previous Comments: ------------------------------------------------------------------------ [2009-05-04 09:46:44] smh at wannafind dot dk 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 this bug report at http://bugs.php.net/?id=48142&edit=1