From:             jason at amp-design dot net
Operating system: CentOS 4 / RHEL 3
PHP version:      5CVS-2005-04-26 (dev)
PHP Bug Type:     Zend Engine 2 problem
Bug description:  Invalid opcode

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 bug report at http://bugs.php.net/?id=32833&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=32833&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=32833&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=32833&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=32833&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=32833&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=32833&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=32833&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=32833&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=32833&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=32833&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=32833&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=32833&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=32833&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=32833&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=32833&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=32833&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=32833&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=32833&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=32833&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=32833&r=mysqlcfg

Reply via email to