ID: 32833 User updated by: jason at amp-design dot net Reported By: jason at amp-design dot net Status: Verified Bug Type: Zend Engine 2 problem Operating System: CentOS 4 / RHEL 3 PHP Version: 5CVS-2005-04-26 (dev) New Comment:
I don't know what is defined by 'HEAD', but I have I have tested this bug on older versions of of the PHP 5.1 branch admittedly they are only a week or so old, as well as the latest snapshot and I get the same problem. It doesn't happen on 5.0.4 or older. HOWEVER... older versions of PHP also have inconsistent behavior, as the test code surely should display a notice / warning... much like <?php $f .= 'foo bar'; ?> produces a notice on version 5.0.4 and probably other older versions. Previous Comments: ------------------------------------------------------------------------ [2005-04-26 13:28:34] [EMAIL PROTECTED] Confirmed with HEAD only. ------------------------------------------------------------------------ [2005-04-26 12:11:57] 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 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=32833&edit=1