From: aaron dot hawley at uvm dot edu
Operating system: Debian GNU/Linux
PHP version: 4.3.4
PHP Bug Type: Variables related
Bug description: give notice when storing to an undefined array
Description:
------------
When the left-hand-side of an assignment expression is an array location
using square-brackets, PHP should check that the array variable was
previously defined, and give a notice if E_NOTICE is flagged in
error_reporting.
This would find mistyped variables, and help with those attempting to
write more stable and secure PHP code with E_ALL.
Reproduce code:
---------------
<?php
error_reporting(E_ALL);
$not_an_array_yet[1] = 'a' . "\n";
exit("done\n");
?>
Expected result:
----------------
Notice: Undefined variable: not_an_array_yet in my_file.php on line 3
done
Actual result:
--------------
done
--
Edit bug report at http://bugs.php.net/?id=28151&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=28151&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=28151&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=28151&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=28151&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=28151&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=28151&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=28151&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=28151&r=support
Expected behavior: http://bugs.php.net/fix.php?id=28151&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=28151&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=28151&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=28151&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28151&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=28151&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=28151&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=28151&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28151&r=float