????JFIF??x?x????'
| Server IP : 79.136.114.73 / Your IP : 216.73.216.191 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/self/root/home/b8009/php-5.6.22/ext/spl/tests/ |
Upload File : |
--TEST--
SPL: iterator_apply()
--FILE--
<?php
function my_error_handler($errno, $errstr, $errfile, $errline) {
echo "Error: $errstr\n";
}
set_error_handler('my_error_handler');
function test_arg($arg)
{
if ($arg instanceof Iterator)
{
var_dump($arg->key());
var_dump($arg->current());
}
else
{
var_dump($arg);
}
return true;
}
function test()
{
static $arg = 0;
var_dump($arg++);
return true;
}
$it = new RecursiveArrayIterator(array(1, array(21, 22), 3));
var_dump(iterator_apply($it, 'test', NULL));
echo "===ARGS===\n";
var_dump(iterator_apply($it, 'test_arg', array($it)));
echo "===RECURSIVE===\n";
$it = new RecursiveIteratorIterator($it);
var_dump(iterator_apply($it, 'test'));
echo "===ERRORS===\n";
var_dump(iterator_apply($it, 'test', 1));
var_dump(iterator_apply($it, 'non_existing_function'));
var_dump(iterator_apply($it, 'non_existing_function', NULL, 2));
?>
===DONE===
<?php exit(0); ?>
--EXPECT--
int(0)
int(1)
int(2)
int(3)
===ARGS===
int(0)
int(1)
int(1)
array(2) {
[0]=>
int(21)
[1]=>
int(22)
}
int(2)
int(3)
int(3)
===RECURSIVE===
int(3)
int(4)
int(5)
int(6)
int(4)
===ERRORS===
Error: Argument 3 passed to iterator_apply() must be of the type array, integer given
Error: iterator_apply() expects parameter 3 to be array, integer given
NULL
Error: iterator_apply() expects parameter 2 to be a valid callback, function 'non_existing_function' not found or invalid function name
NULL
Error: iterator_apply() expects at most 3 parameters, 4 given
NULL
===DONE===