1
0
mirror of https://github.com/php/php-src.git synced 2026-03-25 00:32:23 +01:00
Files
archived-php-src/ext/standard/tests/array/array_walk_rec_objects.phpt
Máté Kocsis 960318ed95 Change argument error message format
Closes GH-5211
2020-02-26 15:00:08 +01:00

48 lines
921 B
PHP
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
--TEST--
array_walk_recursive() and objects
--FILE--
<?php
function walk($key, $value) {
var_dump($value, $key);
}
class test {
private $var_pri = "test_private";
protected $var_pro = "test_protected";
public $var_pub = "test_public";
}
$stdclass = new stdclass;
$stdclass->foo = "foo";
$stdclass->bar = "bar";
array_walk_recursive($stdclass, "walk");
$t = new test;
array_walk_recursive($t, "walk");
$var = array();
array_walk_recursive($var, "walk");
$var = "";
try {
array_walk_recursive($var, "walk");
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
echo "Done\n";
?>
--EXPECT--
string(3) "foo"
string(3) "foo"
string(3) "bar"
string(3) "bar"
string(13) "testvar_pri"
string(12) "test_private"
string(10) "*var_pro"
string(14) "test_protected"
string(7) "var_pub"
string(11) "test_public"
array_walk_recursive(): Argument #1 ($input) must be of type array, string given
Done