ID: 25996
Comment by: kevin at hatry dot com
Reported By: hongnk at hotmail dot com
Status: Verified
Bug Type: Zend Engine 2 problem
Operating System: Irrelevant
PHP Version: 5CVS, 4CVS
New Comment:

As i didnt find this bug before submitting mine (surely because we
didnt experience it in the same way), i was asked to add a comment here
with my version of the bug so here it is:

When passing a non-existing portion of an array by reference this
portion gets created even if the function does not touch the array =>
is modified in the calling line.

It works with string indexes as well.

Reproduce code:

$tab2 = array( );

function do_nothing ( &$var ) {
// code here doesnt matter


Expected result:
array(0) {

Actual result:
array(1) {

Previous Comments:

[2003-10-29 14:13:04] [email][/email]

Related to bug #26030


[2003-10-26 21:33:23] hongnk at hotmail dot com

Accessing array with uninitialized index will normally trigger error:

$b=$a['unknown']; => undefined index error

but if I assign by reference:


then PHP no longer throw error. (The same goes for assigning undefined
property to an object.)

This makes it difficult to debug scripts.


Edit this bug report at [url][/url]