summaryrefslogtreecommitdiff
path: root/ext/simplexml/tests/bug37565.phpt
blob: 0af93deaf3219b2d3da0806c2e87f8d273233cc5 (plain)
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
--TEST--
Bug #37565 (Using reflection::export with simplexml causing a crash)
--SKIPIF--
<?php if (!extension_loaded("simplexml")) print "skip"; ?>
--FILE--
<?php

function my_error_handler($errno, $errstr, $errfile, $errline) {
	    echo "Error: $errstr\n";
}

set_error_handler('my_error_handler');

class Setting extends ReflectionObject
{
}

try {
	Reflection::export(simplexml_load_string('<test/>', 'Setting'));
} catch (Error $e) {
	my_error_handler($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine());
}

try {
	Reflection::export(simplexml_load_file('data:,<test/>', 'Setting'));
} catch (Error $e) {
	my_error_handler($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine());
}

?>
===DONE===
--EXPECT--
Error: simplexml_load_string() expects parameter 2 to be a class name derived from SimpleXMLElement, 'Setting' given
Error: Argument 1 passed to Reflection::export() must implement interface Reflector, null given
Error: simplexml_load_file() expects parameter 2 to be a class name derived from SimpleXMLElement, 'Setting' given
Error: Argument 1 passed to Reflection::export() must implement interface Reflector, null given
===DONE===