2003-10-27 12:52:37 +00:00
|
|
|
--TEST--
|
|
|
|
Test 3: Exception Test
|
|
|
|
--SKIPIF--
|
|
|
|
<?php require_once('skipif.inc'); ?>
|
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
|
|
|
|
$dom = new domdocument;
|
|
|
|
$dom->load(dirname(__FILE__)."/book.xml");
|
|
|
|
$rootNode = $dom->documentElement;
|
|
|
|
print "--- Catch exception with try/catch\n";
|
|
|
|
try {
|
|
|
|
$rootNode->appendChild($rootNode);
|
|
|
|
} catch (domexception $e) {
|
|
|
|
var_dump($e);
|
|
|
|
}
|
|
|
|
print "--- Don't catch exception with try/catch\n";
|
|
|
|
$rootNode->appendChild($rootNode);
|
|
|
|
|
|
|
|
|
|
|
|
?>
|
|
|
|
--EXPECTF--
|
|
|
|
--- Catch exception with try/catch
|
2004-03-29 20:54:13 +00:00
|
|
|
object(DOMException)#%d (6) {
|
2004-05-20 21:13:14 +00:00
|
|
|
["message:protected"]=>
|
|
|
|
string(23) "Hierarchy Request Error"
|
|
|
|
["string:private"]=>
|
|
|
|
string(0) ""
|
|
|
|
["file:protected"]=>
|
|
|
|
string(%d) "%s/ext/dom/tests/dom003.php"
|
|
|
|
["line:protected"]=>
|
|
|
|
int(8)
|
|
|
|
["trace:private"]=>
|
|
|
|
array(0) {
|
|
|
|
}
|
2003-10-27 12:52:37 +00:00
|
|
|
["code"]=>
|
|
|
|
int(3)
|
|
|
|
}
|
|
|
|
--- Don't catch exception with try/catch
|
|
|
|
|
2004-03-29 20:54:13 +00:00
|
|
|
Fatal error: Uncaught exception 'DOMException' with message 'Hierarchy Request Error' in %sdom003.php:%d
|
2003-10-27 12:52:37 +00:00
|
|
|
Stack trace:
|
|
|
|
#0 {main}
|
2003-12-11 13:36:42 +00:00
|
|
|
thrown in %sdom003.php on line %d
|