Annotation of embedaddon/php/ext/dom/tests/dom003.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test 3: Exception Test
3: --SKIPIF--
4: <?php require_once('skipif.inc'); ?>
5: --FILE--
6: <?php
7:
8: $dom = new domdocument;
9: $dom->load(dirname(__FILE__)."/book.xml");
10: $rootNode = $dom->documentElement;
11: print "--- Catch exception with try/catch\n";
12: try {
13: $rootNode->appendChild($rootNode);
14: } catch (domexception $e) {
15: var_dump($e);
16: }
17: print "--- Don't catch exception with try/catch\n";
18: $rootNode->appendChild($rootNode);
19:
20:
21: ?>
22: --EXPECTF--
23: --- Catch exception with try/catch
24: object(DOMException)#%d (%d) {
25: ["message":protected]=>
26: string(23) "Hierarchy Request Error"
27: ["string":"Exception":private]=>
28: string(0) ""
29: ["file":protected]=>
30: string(%d) "%sdom003.php"
31: ["line":protected]=>
32: int(8)
33: ["trace":"Exception":private]=>
34: array(1) {
35: [0]=>
36: array(6) {
37: ["file"]=>
38: string(%d) "%sdom003.php"
39: ["line"]=>
40: int(8)
41: ["function"]=>
42: string(11) "appendChild"
43: ["class"]=>
44: string(7) "DOMNode"
45: ["type"]=>
46: string(2) "->"
47: ["args"]=>
48: array(1) {
49: [0]=>
50: object(DOMElement)#%d (0) {
51: }
52: }
53: }
54: }
55: ["previous":"Exception":private]=>
56: NULL
57: ["code"]=>
58: int(3)
59: }
60: --- Don't catch exception with try/catch
61:
62: Fatal error: Uncaught exception 'DOMException' with message 'Hierarchy Request Error' in %sdom003.php:%d
63: Stack trace:
64: #0 %sdom003.php(13): DOMNode->appendChild(Object(DOMElement))
65: #1 {main}
66: thrown in %sdom003.php on line %d
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>