1--TEST-- 2user defined error handler + set_error_handling(EH_THROW) 3--SKIPIF-- 4<?php 5if (substr(PHP_OS, 0, 3) != "WIN") die("skip Windows only"); 6if (is_dir('c:\\not\\exists\\here')) die("skip directory c:\\not\\exists\\here already exists"); 7?> 8--FILE-- 9<?php 10$dir = 'c:\\not\\exists\\here'; 11 12set_error_handler('my_error_handler'); 13function my_error_handler() {$a = func_get_args(); print "in error handler\n"; } 14 15try { 16 print "before\n"; 17 $iter = new DirectoryIterator($dir); 18 print get_class($iter) . "\n"; 19 print "after\n"; 20} catch (Exception $e) { 21 print "in catch: ".$e->getMessage()."\n"; 22} 23?> 24==DONE== 25<?php exit(0); ?> 26--EXPECTF-- 27before 28in catch: DirectoryIterator::__construct(c:\not\exists\here): %s (code: 3) 29==DONE== 30