xref: /PHP-5.6/ext/simplexml/tests/bug37565.phpt (revision 610c7fbe)
1--TEST--
2Bug #37565 (Using reflection::export with simplexml causing a crash)
3--SKIPIF--
4<?php if (!extension_loaded("simplexml") || !extension_loaded('reflection')) print "skip"; ?>
5--FILE--
6<?php
7
8function my_error_handler($errno, $errstr, $errfile, $errline) {
9	    echo "Error: $errstr\n";
10}
11
12set_error_handler('my_error_handler');
13
14class Setting extends ReflectionObject
15{
16}
17
18Reflection::export(simplexml_load_string('<test/>', 'Setting'));
19
20Reflection::export(simplexml_load_file('data:,<test/>', 'Setting'));
21
22?>
23===DONE===
24--EXPECTF--
25Error: simplexml_load_string() expects parameter 2 to be a class name derived from SimpleXMLElement, 'Setting' given
26Error: Argument 1 passed to Reflection::export() must implement interface Reflector, null given
27Error: Reflection::export() expects parameter 1 to be Reflector, null given
28Error: simplexml_load_file() expects parameter 2 to be a class name derived from SimpleXMLElement, 'Setting' given
29Error: Argument 1 passed to Reflection::export() must implement interface Reflector, null given
30Error: Reflection::export() expects parameter 1 to be Reflector, null given
31===DONE===
32