throwing an exception on failed require

From: Date: Sat, 08 May 2004 09:56:24 +0000
Subject: throwing an exception on failed require
Groups: php.internals 
Request: Send a blank email to internals+get-9731@lists.php.net to get a copy of this message
Hi, I think it would be useful if require would throw an exception on failure. Currently one would use @include in order to load in a file that could be missing or could contain parse errors. However it is impossible to easy find out if the file was missing, had parse errors or returned false. Please also note that file_exists() doesnt check the include path and a check like this also opens up the chance for race conditions etc. By throwing an exception inside require with the necessary information it would be able to cleanly handle this situation without having to silence this error and then parsing the error message. And it would obviously be BC compatible as uncaught exceptions are fatal. regards, Lukas Smith

« previous php.internals (#9731) next »