From:             
Operating system: any (debian)
PHP version:      5.3.3RC2
Package:          SPL related
Bug Type:         Bug
Bug description:SPL autoloader breaks class_exists()

Description:
------------
Using PHP 5.3 from svn.



When SPL's default autoloader is the only loader in the stack it triggers
an error or throws an exception when it can't find a class.  This means
that you get an exception when calling class_exists() for a class that
doesn't exist.  This behaviour seems pointless anyway since PHP will
trigger its own fatal error if the class still doesn't exist after
attempting to autoload, so the attached patch simply removes it.





Test script:
---------------
spl_autoload_register();

class_exists('foo\bar');



Expected result:
----------------
No error



Actual result:
--------------
b...@arctor:~/src/php-5.3$ sapi/cli/php ~/code/cram/test.php 

PHP Fatal error:  Uncaught exception 'LogicException' with message 'Class
foo\bar could not be loaded' in /home/ben/code/cram/test.php:4

Stack trace:

#0 [internal function]: spl_autoload('foo\bar')

#1 /home/ben/code/cram/test.php(4): class_exists('foo\bar')

#2 {main}

  thrown in /home/ben/code/cram/test.php on line 4



-- 
Edit bug report at http://bugs.php.net/bug.php?id=52339&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=52339&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=52339&r=trysnapshot53
Try a snapshot (trunk):              
http://bugs.php.net/fix.php?id=52339&r=trysnapshottrunk
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=52339&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=52339&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=52339&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=52339&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=52339&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=52339&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=52339&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=52339&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=52339&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=52339&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=52339&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=52339&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=52339&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=52339&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=52339&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=52339&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=52339&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=52339&r=mysqlcfg

Reply via email to