Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0003961 [Quercus] minor always 03-23-10 06:19 04-02-10 20:11
Reporter posenato View Status public  
Assigned To nam
Priority normal Resolution fixed Platform
Status closed   OS Linux
Projection none   OS Version
ETA none Fixed in Version 4.0.6 Product Version 4.0.5
  Product Build
Summary 0003961: The PHP function "array_walk" doesn't work when there is the third parameter
Description The execution of 'array_walk' raises the "required argument missing [array_walk]" when array_walk has 3 parameters (the third optional one is specified).
Steps To Reproduce Take the first example of array_walk manuale:

<?php
$fruits = array("d" => "lemon", "a" => "orange", "b" => "banana", "c" => "apple");
function test_alter(&$item1, $key, $prefix) {
    $item1 = "$prefix: $item1";
}

function test_print($item2, $key) {
    echo "$key. $item2
\n";
}

echo "Before ...:\n";
array_walk($fruits, 'test_print');

array_walk($fruits, 'test_alter', 'fruit');
echo "... and after:\n";

array_walk($fruits, 'test_print');
?>

The output should be:
Before ...:
d. lemon
a. orange
b. banana
c. apple
... and after:
d. fruit: lemon
a. fruit: orange
b. fruit: banana
c. fruit: apple

The actual output is:
Before ...: . lemon
. orange
. banana
. apple
/usr/local/resin/webapps/php/aw1.php:17: Warning: required argument missing [array_walk] /usr/local/resin/webapps/php/aw1.php:17: Warning: required argument missing [array_walk] /usr/local/resin/webapps/php/aw1.php:17: Warning: required argument missing [array_walk] /usr/local/resin/webapps/php/aw1.php:17: Warning: required argument missing [array_walk] ... and after: . : lemon
. : orange
. : banana
. : apple
Additional Information
Attached Files

- Relationships

- Notes
(0004483)
posenato
03-23-10 23:44

Since I'm interested to have a right implementation when the callback function has 3 parameters, I didn't notice that the implementation ignores the second one silently.
 
(0004516)
nam
04-02-10 20:11

php/174a
 

- Issue History
Date Modified Username Field Change
03-23-10 06:19 posenato New Issue
03-23-10 07:05 posenato Issue Monitored: posenato
03-23-10 23:44 posenato Note Added: 0004483
04-02-10 20:11 nam Status new => assigned
04-02-10 20:11 nam Assigned To  => nam
04-02-10 20:11 nam Status assigned => closed
04-02-10 20:11 nam Note Added: 0004516
04-02-10 20:11 nam Resolution open => fixed
04-02-10 20:11 nam Fixed in Version  => 4.0.6


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
32 total queries executed.
27 unique queries executed.
Powered by Mantis Bugtracker