#28151 [Opn]: give notice when storing to an undefined array
| From: | aaron dot hawley at uvm dot edu | Date: | Mon, 26 Apr 2004 02:56:12 +0000 |
| Subject: | #28151 [Opn]: give notice when storing to an undefined array | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-58759@lists.php.net to get a copy of this message | ||
ID: 28151
User updated by: aaron dot hawley at uvm dot edu
Reported By: aaron dot hawley at uvm dot edu
Status: Open
Bug Type: Variables related
Operating System: Debian GNU/Linux
PHP Version: 4.3.4
New Comment:
don't let the concatenated endline character confuse you.
sorry about that.
Previous Comments:
------------------------------------------------------------------------
[2004-04-26 04:54:51] aaron dot hawley at uvm dot edu
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 this bug report at http://bugs.php.net/?id=28151&edit=1