From:             
Operating system: 
PHP version:      5.3.5
Package:          Performance problem
Bug Type:         Feature/Change Request
Bug description:autoload parameter for class_alias?

Description:
------------
While inspecting the class_alias() functionality I discovered that when
declaring an alias of a class, it invokes an __autoload routine for all
base class tree even if the aliased class not used in code. It may be
inappropriate for huge frameworks when them used for
quick/small/performance scripts that does not need alias functionality.

Test script:
---------------
A.php:

class A { }

B.php:

class B extends A { }

C1.php:

class C1 extends B { }

C2.php:

class C2 extends B { }



main.php:

function __autoload($className) { include($className . '.php'); }

function included_files() { return implode(', ', array_map('basename',
get_included_files())) . "\n"; }

    

    echo included_files();

    class_alias('C1', 'C');

    echo included_files();

    $c = new C();

    echo included_files();



Expected result:
----------------
main.php

main.php

main.php, C1.php, B.php, A.php

Actual result:
--------------
main.php

main.php, C1.php, B.php, A.php

main.php, C1.php, B.php, A.php



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

Reply via email to