From: Christian Stocker Date: Mon, 27 Oct 2003 12:52:37 +0000 (+0000) Subject: exception/try/catch test X-Git-Tag: RELEASE_2_0_0RC1~52 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e311179b72316342358857111b49fcfe0abcff2e;p=php exception/try/catch test --- diff --git a/ext/dom/tests/dom003.phpt b/ext/dom/tests/dom003.phpt new file mode 100644 index 0000000000..731c2ee133 --- /dev/null +++ b/ext/dom/tests/dom003.phpt @@ -0,0 +1,46 @@ +--TEST-- +Test 3: Exception Test +--SKIPIF-- + +--FILE-- +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 +object(domexception)#3 (7) { + [""]=> + string(23) "Hierarchy Request Error" + [""]=> + string(0) "" + [""]=> + string(%d) "%s" + [""]=> + int(8) + [""]=> + NULL + ["code"]=> + int(3) + ["trace"]=> + array(0) { + } +} +--- Don't catch exception with try/catch + +Fatal error: Uncaught exception 'domexception' with message 'Hierarchy Request Error' in %s/dom003.php:%d +Stack trace: +#0 {main} + thrown in %s/dom003.php on line %d