| Server IP : 198.38.94.67 / Your IP : 216.73.217.142 Web Server : LiteSpeed System : Linux d6054.dxb1.stableserver.net 5.14.0-570.25.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jul 9 04:57:09 EDT 2025 x86_64 User : azfilmst ( 1070) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /opt/cpanel/ea-php82/root/usr/share/tests/pecl/yaml/tests/ |
Upload File : |
--TEST--
Test PECL bug #59860
--SKIPIF--
<?php if(!extension_loaded('yaml')) die('skip yaml n/a'); ?>
--FILE--
<?php
/**
* Parsing callback for yaml tag.
* @param mixed $value Data from yaml file
* @param string $tag Tag that triggered callback
* @param int $flags Scalar entity style (see YAML_*_SCALAR_STYLE)
* @return mixed Value that YAML parser should emit for the given value
*/
function tag_callback ($value, $tag, $flags) {
var_dump(func_get_args());
return $tag;
}
$yaml = <<<YAML
implicit_map:
a: b
explicit_map: !!map
c: d
implicit_seq: [e, f]
explicit_seq: !!seq [g, h]
YAML;
yaml_parse($yaml, 0, $ndocs, array(
YAML_MAP_TAG => 'tag_callback',
YAML_SEQ_TAG => 'tag_callback',
));
?>
--EXPECT--
array(3) {
[0]=>
array(1) {
["a"]=>
string(1) "b"
}
[1]=>
string(21) "tag:yaml.org,2002:map"
[2]=>
int(0)
}
array(3) {
[0]=>
array(1) {
["c"]=>
string(1) "d"
}
[1]=>
string(21) "tag:yaml.org,2002:map"
[2]=>
int(0)
}
array(3) {
[0]=>
array(2) {
[0]=>
string(1) "e"
[1]=>
string(1) "f"
}
[1]=>
string(21) "tag:yaml.org,2002:seq"
[2]=>
int(0)
}
array(3) {
[0]=>
array(2) {
[0]=>
string(1) "g"
[1]=>
string(1) "h"
}
[1]=>
string(21) "tag:yaml.org,2002:seq"
[2]=>
int(0)
}
array(3) {
[0]=>
array(4) {
["implicit_map"]=>
string(21) "tag:yaml.org,2002:map"
["explicit_map"]=>
string(21) "tag:yaml.org,2002:map"
["implicit_seq"]=>
string(21) "tag:yaml.org,2002:seq"
["explicit_seq"]=>
string(21) "tag:yaml.org,2002:seq"
}
[1]=>
string(21) "tag:yaml.org,2002:map"
[2]=>
int(0)
}