Edit report at http://bugs.php.net/bug.php?id=50613&edit=1
ID: 50613 Updated by: j...@php.net Reported by: felix at amerimerchant dot com Summary: Invalid array access on non-arrays should cause warning/notice -Status: Open +Status: Bogus Type: Feature/Change Request Package: Scripting Engine problem Operating System: Linux PHP Version: 5.3.1 New Comment: See bug #41195 and stop beating the dead horse please. Previous Comments: ------------------------------------------------------------------------ [2010-03-08 15:27:16] rbetta at amerimerchant dot com My apologies; I meant "5.4.0 or 6.0.0" obviously, and my email address is at the .com TLD (not .net). Insufficient morning caffeination, clearly. ------------------------------------------------------------------------ [2010-03-08 15:21:59] rbetta at amerimerchant dot net I suppose the resource type might be affected as well; it did not occur to me to test it at the time. I am not certain that a new notice would constitute a BC break; production servers should never have display_errors on, and any code that would actually generate the new notices or warnings would already be broken by the very fact that it is attempting to read scalar values as arrays (therefore, subtle but as-yet undiscovered logical bugs in userland code may be made known by these new notices or warnings). I suppose custom error handler routines could react strongly to notices, though. Webpages suddenly disappearing with "Sorry, there has been an internal error" messages generated by their core frameworks might be a somewhat unpleasant experience. If this does qualify as a BC break under the Zend engine maintainers' policies, would 3.4 or 6.0 be the first candidate for a fix? ------------------------------------------------------------------------ [2010-03-06 17:23:56] ar...@php.net The following patch has been added/updated: Patch Name: scalar-array-read.50613.HEAD.patch Revision: 1267892636 URL: http://bugs.php.net/patch-display.php?bug=50613&patch=scalar-array-read.50613.HEAD.patch&revision=1267892636&display=1 ------------------------------------------------------------------------ [2010-03-06 17:23:01] ar...@php.net I think there is a bug here as an error is raised when writing to ints and floats as arrays but not when reading from them. The fix is trivial however it's a BC break. This exists in at least 5.2, 5.3 and HEAD. ------------------------------------------------------------------------ [2010-01-02 02:08:41] felix at amerimerchant dot com Same behavior using the most recent build I just tried: C:\php5.3.3-dev>php.exe -v PHP 5.3.3-dev (cli) (built: Jan 2 2010 01:06:43) Copyright (c) 1997-2009 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies C:\php5.3.3-dev>php.exe "C:\Documents and Settings\Administrator\Desktop\test.php" Notice: Uninitialized string offset: 9 in C:\Documents and Settings\Administrator\Desktop test.php on line 6 Notice: Undefined offset: 9 in C:\Documents and Settings\Administrator\Desktop\test.php o line 9 Fatal error: Cannot use object of type stdClass as array in C:\Documents and Settings\Adm nistrator\Desktop\test.php on line 24 C:\php5.3.3-dev> ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/bug.php?id=50613 -- Edit this bug report at http://bugs.php.net/bug.php?id=50613&edit=1