autoload - confusing "cannot redeclare class" error (PHP) -


I have a strange problem. I have a static method that loads classes (load_library) when it comes to a particular class It loads, it gives me a fatal error "can not recapture the class", but checking that if it is present before using the load_ library method to load the class, it says that the class not available. The load_library method works elsewhere without such errors.

If I call load_library, then it says that the class is not actually used later after some lines stranger still, if I have my registered class autoload Instead of function, everything works perfectly, even if it does not check the autoload function directory that class I is trying to load.

This is a complex problem involving many complex files, so posting this code is difficult, but can anyone be aware of this problem?

My load_library method:

  public static function load_library ($ name) {if (! Class_exists ($ name)} {if (file_exists ('application / library /' . $ Name. '.php')) {Include ('App / Library /' $ name '.php'); } Else {trigger_error ('Requested non-existent library ('. $. ').', E_USER_ERROR); }}}   

My call to the load_library method:

  lev :: load_library ('lev_unit_tester / lev_base_test');   

My registered autolode method:

  public static function autoloader ($ name) {if (class_exists ($ name) is returned); If (file_exists ('app / library /' $ name. '.php')) {insert ('app / library /'. $ Name '.php'); I'm trying to load that square (this is where the error occurs):  
  abstract class lev_base_test {}   

actual error Message:

Fatal Error: Class can not rearrange lev_base_test on /some/path/application/libraries/lev_unit_tester/lev_base_test.php on line 5

try it

  class if (class_exists ($ square, wrong)). .}    

Comments