#49296 [Bgs]: spl_autoload throws an exception instead of fatal error
| From: | christopheb156 at hotmail dot com | Date: | Thu, 20 Aug 2009 10:26:38 +0000 |
| Subject: | #49296 [Bgs]: spl_autoload throws an exception instead of fatal error | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-141289@lists.php.net to get a copy of this message | ||
ID: 49296
User updated by: christopheb156 at hotmail dot com
Reported By: christopheb156 at hotmail dot com
Status: Bogus
Bug Type: SPL related
Operating System: xp
PHP Version: 5.2SVN-2009-08-19 (snap)
New Comment:
aah okay but was wondering why in phpt bug38325.phpt it returns a fatal
error, looking at the source it says:
/* For internal errors, we generate E_ERROR, for direct calls an
*exception is thrown. The "scope" is determined by an opcode, if it is
*ZEND_FETCH_CLASS we know function was called indirectly by the Zend
*engine.
*/
so class_exist would result in an indirect call to spl_autoload?
Previous Comments:
------------------------------------------------------------------------
[2009-08-19 14:28:50] colder@php.net
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
We're dealing with OOP here, exceptions feels like the natural way to
report/handle such errors.
------------------------------------------------------------------------
[2009-08-19 13:54:06] christopheb156 at hotmail dot com
Description:
------------
spl_autoload should produce a fatal error when called indirectly,
internal errors should generate E_ERROR, however in
spl_autoload_001.phpt a call to class_exists throws an exception.
Reproduce code:
---------------
<?php
spl_autoload_register();
try {
var_dump(class_exists("TestClass", true));
} catch(Exception $e) {
echo $e->getMessage() . "\n";
}
?>
Expected result:
----------------
Fatal Error....
Actual result:
--------------
Class TestClass could not be loaded
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=49296&edit=1