ID:               21998
 Comment by:       nilsen at softease dot no
 Reported By:      php at alterego dot dp dot ua
 Status:           Closed
 Bug Type:         Documentation problem
 Operating System: all
 PHP Version:      4.3.0
 New Comment:

I just upgraded a machine here from 4.1.2 (redhat default installation)
to 4.3.4.

while (count($tree) > 1){
        $tree[count($tree) - 2]["SELECTED"]["Children"] =
$tree[count($tree) - 1];
        array_pop($tree);
}

The above doesn't work after upgrading. We had to change it to this:

while (count($tree) > 1){
        $tree[count($tree) - 2]["SELECTED"]["Children"] =
$tree[count($tree) - 1];
        $tree = array_slice($tree,0,count($tree) - 1);
}

Wasn't this bug sorted out?


Thanks.


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

[2003-02-05 03:10:20] php at alterego dot dp dot ua

Thanks for the best web scripting language...

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

[2003-02-05 01:26:09] [EMAIL PROTECTED]

This has been fixed in CVS.  See:
http://cvs.php.net/cvs.php/phpdoc/en/reference/array/functions/array-shift.xml
http://cvs.php.net/cvs.php/phpdoc/en/reference/array/functions/array-pop.xml
http://cvs.php.net/diff.php/phpdoc/en/language-snippets.ent?r1=1.38&r2=1.39

Thank you for the report :)

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

[2003-02-03 11:02:08] [EMAIL PROTECTED]

I have fixed this now in CVS. But the docs should mention
that the pointer is reset by array_pop/array_shift.



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

[2003-02-03 10:51:39] [EMAIL PROTECTED]

Clarification: In PHP 4.2.3, the current array position
was reset after array_pop() and array_shift().


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

[2003-02-03 00:39:14] [EMAIL PROTECTED]

[EMAIL PROTECTED]: I reverted my changes, not my fault. :-p

But there is indeed some bug in this, since array_pop()
should not affect the current key. 



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

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/21998

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

Reply via email to