1
0
mirror of https://github.com/php/php-src.git synced 2026-03-26 17:22:15 +01:00
Files
archived-php-src/ext/simplexml/tests/bug37565.phpt
Gabriel Caruso ded3d984c6 Use EXPECT instead of EXPECTF when possible
EXPECTF logic in run-tests.php is considerable, so let's avoid it.
2018-02-20 21:53:48 +01:00

38 lines
1.1 KiB
PHP

--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===