PHP :: Bug #32833 :: Invalid opcode
| Bug #32833 | Invalid opcode | ||||
|---|---|---|---|---|---|
| Submitted: | 2005-04-26 12:11 UTC | Modified: | 2005-04-27 14:20 UTC | ||
| From: | jason at amp-design dot net | Assigned: | |||
| Status: | Closed | Package: | Scripting Engine problem | ||
| PHP Version: | 5CVS-2005-04-26 (dev) | OS: | CentOS 4 / RHEL 3 | ||
| Private report: | No | CVE-ID: | None | ||
[2005-04-26 12:11 UTC] jason at amp-design dot net
Description: ------------ Trying to concatenate on to a new/empty array element with the array push assignment operator, [] =, causes PHP to create a fatal error. This is tested with the CVS snapshot http://snaps.php.net/php5-200504260830.tar.gz Although the code I have given below is technically not correct because you can not concatenate a string on to an empty/new array element, it should be seen as an warning and not a fatal error (See notes on expected result). Also, the error is not very descriptive from a end user's point of view. I assume the invalid opcode error is obviously a generic error message that is used by you guys at Zend for debugging. Previous versions of PHP seem to inconsistent. The reproducable code doesn't even give me a warning message when tested under PHP5.0.4. Surely it would be right to make this consistent with concatenating an undefined variable, by making a "Notice: Undefined variable: test[]" error. Reproduce code: --------------- <?php $test = array(); $test[] .= 'blah'; ?> Expected result: ---------------- Some form of warning stating that you can not concatenate to an empty/undefined array element. This should be consistent with the fact that if you did... <?php $f .= 'foo bar'; ?> that you would get a warning message because $f has not been defined before. (i.e. Notice: Undefined variable: f) Actual result: -------------- Fatal error: Invalid opcode 30/16/8
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2005-04-26 15:55 UTC] jason at amp-design dot net