diff options
Diffstat (limited to 'Zend/tests/bug29368_1.phpt')
-rw-r--r-- | Zend/tests/bug29368_1.phpt | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Zend/tests/bug29368_1.phpt b/Zend/tests/bug29368_1.phpt new file mode 100644 index 0000000000..09cf334384 --- /dev/null +++ b/Zend/tests/bug29368_1.phpt @@ -0,0 +1,29 @@ +--TEST-- +Bug #29368.1 (The destructor is called when an exception is thrown from the constructor). +--FILE-- +<?php +function throwme($arg) +{ + throw new Exception; +} + +class foo { + function __construct() { + echo "Inside constructor\n"; + throwme($this); + } + + function __destruct() { + echo "Inside destructor\n"; + } +} + +try { + $bar = new foo; +} catch(Exception $exc) { + echo "Caught exception!\n"; +} +?> +--EXPECT-- +Inside constructor +Caught exception! |