ID:               32088
 Updated by:       [EMAIL PROTECTED]
 Reported By:      karl at posmaster dot com dot au
-Status:           Open
+Status:           Feedback
 Bug Type:         Zend Engine 2 problem
-Operating System: Slackware Linux 2.4.26
+Operating System: *
-PHP Version:      5.0.3
+PHP Version:      5CVS-2005-02-28
 New Comment:

What reference? Please give the _EXACT_ expected result.
(and shorten the example script..)



Previous Comments:
------------------------------------------------------------------------

[2005-02-27 22:51:05] karl at posmaster dot com dot au

No, the bug is still present.  The reference that should be present is
still broken.

------------------------------------------------------------------------

[2005-02-25 14:30:13] [EMAIL PROTECTED]

So it's fixed and working -> closed.


------------------------------------------------------------------------

[2005-02-25 05:19:45] karl at posmaster dot com dot au

Using that snapshot (PHP Version 5.0.4-dev) the second var_dump()
produces:
array(3) {
  [1]=>
  array(2) {
    [0]=>
    string(3) "one"
    [1]=>
    string(3) "two"
  }
  [3]=>
  array(2) {
    [0]=>
    string(4) "five"
    [1]=>
    string(3) "six"
  }
  [5]=>
  array(2) {
    [0]=>
    string(4) "nine"
    [1]=>
    string(3) "ten"
  }
}

Expecting:
array(3) {
  [1]=>
  array(2) {
    [0]=>
    string(3) "one"
    [1]=>
    string(3) "foo"
  }
  [3]=>
  array(2) {
    [0]=>
    string(4) "five"
    [1]=>
    string(3) "foo"
  }
  [5]=>
  array(2) {
    [0]=>
    string(4) "nine"
    [1]=>
    string(3) "foo"
  }
}

Using Apache 1.3.31
PHP Configure string:
'./configure' '--prefix=/usr' '--disable-static'
'--with-apxs=/usr/sbin/apxs' '--sysconfdir=/etc'
'--enable-discard-path' '--with-config-file-path=/etc/apache'
'--enable-safe-mode' '--with-openssl' '--with-mhash' '--enable-bcmath'
'--with-bz2' '--with-pic' '--enable-calendar' '--enable-ctype'
'--with-gdbm' '--with-db3' '--enable-dbase' '--enable-ftp'
'--with-iconv' '--with-exif' '--with-gd' '--enable-gd-native-ttf'
'--with-jpeg-dir=/usr' '--with-png' '--with-gmp'
'--with-gettext=shared,/usr' '--with-expat-dir=/usr' '--with-xml'
'--enable-wddx' '--with-mm=/usr' '--enable-trans-sid' '--enable-shmop'
'--enable-sockets' '--with-regex=php' '--enable-sysvsem'
'--enable-sysvshm' '--enable-yp' '--enable-memory-limit'
'--with-tsrm-pthreads' '--enable-shared' '--disable-debug'
'--with-zlib=/usr' '--with-pgsql' '--with-mysql'

------------------------------------------------------------------------

[2005-02-24 23:50:30] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php5-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.0-win32-latest.zip

I can't reproduce it.

------------------------------------------------------------------------

[2005-02-23 23:30:05] karl at posmaster dot com dot au

Description:
------------
Using "for each" I wanted to remove some items and change others.  It
seems that the reference in the loop no longer works once unset() has
been called on the array.

The commented line achieves the desired end, but circumvents the
reference.

The reference works if the unset() line is commented.

This is reproduced without the use of Zend or 3rd part extensions.

-----------------------



Reproduce code:
---------------
<?php
$stuff = array(array('one','two'),array('one','two'),
array('three','four'),array('five','six'),
array('seven','eight'),array('nine','ten'));

var_dump($stuff);

foreach ($stuff as $key => &$values) {
    print "on key:$key<br>";
        if(($key%2)==0){
            print "Running unset for $key <br>";
            unset ($stuff[$key]);
        }else{
            print "Running change for $key <br>";
            $values[1]='foo';
//          $stuff[$key][1] = 'foo';
        }
}
var_dump($stuff);
?>

Expected result:
----------------
I expected to see elements $stuff[1][1], $stuff[3][1] and $stuff[5][1]
to be set to 'foo'

Actual result:
--------------
The elements are left unchanged. Are values 'two', 'six' and 'ten'
respectively.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=32088&edit=1

Reply via email to