-
Notifications
You must be signed in to change notification settings - Fork 7.8k
/
Copy pathxml_set_object_multiple_times.phpt
61 lines (53 loc) · 1.62 KB
/
xml_set_object_multiple_times.phpt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
--TEST--
Swap underlying object to call methods with xml_set_object()
--EXTENSIONS--
xml
--FILE--
<?php
function end_handler(XMLParser $parser, string $tag) {
echo "end_handler($tag)\n";
}
class A {
public function start_element($parser, $name, $attributes) {
global $b;
xml_set_object($parser, $b);
echo "A::start_element($name)\n";
}
public function PIHandler($parser, $target, $data) {
echo "A::PIHandler($target)\n";
}
}
class B {
public function start_element($parser, $name) {
echo "B::start_element($name)\n";
}
public function end_element($parser, $name) {
echo "B::end_element($name)\n";
}
public function PIHandler($parser, $target, $data) {
echo "B::PIHandler($target)\n";
}
}
$a = new A;
$b = new B;
$parser = xml_parser_create();
xml_set_object($parser, $a);
xml_set_element_handler($parser, "start_element", "end_handler");
xml_set_processing_instruction_handler($parser, [$a, "PIHandler"]);
xml_parse($parser, <<<XML
<?xml version="1.0"?>
<container>
<child/>
</container>
<?pi-test data ?>
XML);
?>
--EXPECTF--
Deprecated: Function xml_set_object() is deprecated since 8.4, provide a proper method callable to xml_set_*_handler() functions in %s on line %d
Deprecated: xml_set_element_handler(): Passing non-callable strings is deprecated since 8.4 in %s on line %d
Deprecated: Function xml_set_object() is deprecated since 8.4, provide a proper method callable to xml_set_*_handler() functions in %s on line %d
A::start_element(CONTAINER)
B::start_element(CHILD)
end_handler(CHILD)
end_handler(CONTAINER)
A::PIHandler(pi-test)