ID:               50246
 Updated by:       j...@php.net
 Reported By:      krzysztof dot talajko at gmail dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Scripting Engine problem
 Operating System: Windows 7 RC
 PHP Version:      5.2.11
 New Comment:

Thank you for not reading the manual or searching existing bug reports.
RTFM: http://php.net/autoload



Previous Comments:
------------------------------------------------------------------------

[2009-11-20 16:05:47] krzysztof dot talajko at gmail dot com

Simpler reproduce code is (results same as in original code):

<?php

function __autoload($class) {
    throw new Exception("Class ".$class." not found");
}

try{
  new Foo;
}
catch (Exception $e) {
  echo "Caught load class failed exception (".$e->getMessage().").";
}

------------------------------------------------------------------------

[2009-11-20 15:58:12] krzysztof dot talajko at gmail dot com

Description:
------------
Throw exception in __autoload() implementation is impossible. Instead
fatal error "Class (...) not found" is reported.

Reproduce code:
---------------
<?php

function loader($class) {
    @include_once($class.'.php');

    if (!class_exists($class, false)) {
        throw new Exception("Class ".$class." not found");
    }
}

spl_autoload_register('loader');

try{
  class FooClass extends Some_Not_Existing_Class {}
}
catch (Exception $e) {
  echo "Caught load class failed exception (".$e->getMessage().").";
}


Expected result:
----------------
Caught load class failed exception (Class Some_Not_Existing_Class not
found).

Actual result:
--------------
Fatal error: Class 'Some_Not_Existing_Class' not found in
C:\dev\workspace\foo.php on line 19


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=50246&edit=1

Reply via email to