posenato
03-23-2010, 05:30 PM
I have just filled a bug track instead of to post here :confused:
Problem: The execution of 'array_walk' raises the "required argument missing [array_walk]" when array_walk has 3 parameters (the third optional one is specified).
How to reproduce this error:
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
====
I would like to find a way to patch the Quercus source or to avoid the error without to alter the application PHP source.
Thank's in advance for any suggestions!
Problem: The execution of 'array_walk' raises the "required argument missing [array_walk]" when array_walk has 3 parameters (the third optional one is specified).
How to reproduce this error:
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
====
I would like to find a way to patch the Quercus source or to avoid the error without to alter the application PHP source.
Thank's in advance for any suggestions!