php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34335 nested array_walk calls fail
Submitted: 2005-09-01 19:56 UTC Modified: 2005-09-01 23:41 UTC
From: gubespam at _NOSPAM_gmail dot com Assigned:
Status: Not a bug Package: Arrays related
PHP Version: 5.0.4 OS: Apache/Unix
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: gubespam at _NOSPAM_gmail dot com
New email:
PHP Version: OS:

 

 [2005-09-01 19:56 UTC] gubespam at _NOSPAM_gmail dot com
Description:
------------
When making nested calls to array_walk, it does not behave as it should. Supposedly this has been fixed, but it doesn't appear so.  Please refer to the now-closed bug report #33286.  To see it working on my server running 5.0.4, go to:

http://web.ics.purdue.edu/~varsity/array_walk.php


Reproduce code:
---------------
<?php
function test_subfunc(&$item1, $key, &$prefix)
{
   echo "&nbsp;&nbsp;test_subfunc<br/>";
}

function test_func($item2, $key)
{
   echo "test_func<br/>";

   $arr = array(1, 2, 3, 4);
   array_walk($arr, 'test_subfunc', 'extra_arg');
}

$x = array(5,6,7);
array_walk($x, 'test_func');
?>

Expected result:
----------------
test_func
  test_subfunc
  test_subfunc
  test_subfunc
  test_subfunc
test_func
  test_subfunc
  test_subfunc
  test_subfunc
  test_subfunc
test_func
  test_subfunc
  test_subfunc
  test_subfunc
  test_subfunc

Actual result:
--------------
test_func
  test_subfunc
  test_subfunc
  test_subfunc
  test_subfunc

Warning: Missing argument 3 for test_subfunc() in array_walk.php on line 2
  test_subfunc

Warning: Missing argument 3 for test_subfunc() in array_walk.php on line 2
  test_subfunc

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-09-01 23:41 UTC] sniper@php.net
It's fixed in CVS. Did you really expect that we get it fixed in your installed 5.0.4 with some magic or what?

 [2005-09-01 23:41 UTC] sniper@php.net
And with CVS I mean PHP 5.1-dev..

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 05 01:01:29 2024 UTC