1--TEST-- 2Catching an exception in a constructor 3--FILE-- 4<?php 5 6class MyObject 7{ 8 function __construct() 9 { 10 throw new Exception(); 11 echo __METHOD__ . "() Must not be reached\n"; 12 } 13 14 function __destruct() 15 { 16 echo __METHOD__ . "() Must not be called\n"; 17 } 18} 19 20try 21{ 22 new MyObject(); 23} 24catch(Exception $e) 25{ 26 echo "Caught\n"; 27} 28 29?> 30--EXPECT-- 31Caught 32