#50250 [Opn->Csd]: Exceptions can be thrown and caught in an autoload function
| From: | rquadling@php.net | Date: | Wed, 25 Nov 2009 11:00:40 +0000 |
| Subject: | #50250 [Opn->Csd]: Exceptions can be thrown and caught in an autoload function | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-3340@lists.php.net to get a copy of this message | ||
ID: 50250
Updated by: rquadling@php.net
Reported By: brandon@php.net
-Status: Open
+Status: Closed
Bug Type: Documentation problem
Operating System: *
PHP Version: 5.3.1
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation
better.
Previous Comments:
------------------------------------------------------------------------
[2009-11-25 11:00:13] svn@php.net
Automatic comment from SVN on behalf of rquadling
Revision: http://svn.php.net/viewvc/?view=revision&revision=291300
Log: Autoload and exceptions work. Mostly. Fix#50250
------------------------------------------------------------------------
[2009-11-25 07:37:26] jani@php.net
So now it's working, document it.
------------------------------------------------------------------------
[2009-11-24 21:08:31] brandon@php.net
This report is about the fact that the PHP team closed a bug as
"wontfix" when someone complained that exceptions raised in autoloaders
could not be caught.
See http://bugs.php.net/bug.php?id=26193
Thus, there is an inconsistency in PHP, and one that should be resolved
to ensure that this isn't deemed a hole later on that must be "fixed,"
breaking code for those that thought this was by design.
------------------------------------------------------------------------
[2009-11-24 20:22:52] jani@php.net
So what is this report about? Are you really complaining because
something WORKS? If so, please change this to documentation issue.
------------------------------------------------------------------------
[2009-11-23 11:55:13] rquadling@php.net
Amendeded the code slightly ...
<?php
echo "\n", PHP_VERSION;
if (function_exists('spl_autoload_register')) {
function autoload($class) {
throw new Exception('test');
require $class . '.php';
}
spl_autoload_register('autoload');
} else {
function __autoload($class) {
throw new Exception('test');
require $class . '.php';
}
}
try {
new NoExist();
}
catch (Exception $e) {
echo "unable to load the class.\n";
}
5.0.0
Fatal error: __autoload(NoExist) threw an exception of type
'Exception' in Z:\testauto.php on line 29
5.0.1 - 5.0.5
Fatal error: Function __autoload(NoExist) threw an exception of type
'Exception' in Z:\testauto.php on line 29
5.1.0 - 5.2.11
Fatal error: Class 'NoExist' not found in Z:\testauto.php on line 29
5.3.0 - 5.3.1
unable to load the class.
And using MissingException
5.0.0 - 5.0-5
Fatal error: Class 'MissingException' not found in Z:\testauto.php on
line 12
5.1.0 - 5.3.1
Fatal error: Class 'MissingException' not found in Z:\testauto.php on
line 6
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/50250
--
Edit this bug report at http://bugs.php.net/?id=50250&edit=1