Req->Doc #54207 [Opn->Csd]: autoload parameter for class_alias?
| From: | reeze@php.net | Date: | Mon, 08 Oct 2012 08:40:26 +0000 |
| Subject: | Req->Doc #54207 [Opn->Csd]: autoload parameter for class_alias? | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-8940@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=54207&edit=1
ID: 54207
Updated by: reeze@php.net
Reported by: offshore at aopdg dot ru
Summary: autoload parameter for class_alias?
-Status: Open
+Status: Closed
-Type: Feature/Change Request
+Type: Documentation Problem
Package: Performance problem
PHP Version: 5.3.5
-Assigned To:
+Assigned To: reeze
Block user comment: N
Private report: N
New Comment:
There is a autoload parameter but not documented.
This have been fixed in documentation.
Previous Comments:
------------------------------------------------------------------------
[2011-03-09 18:44:31] offshore at aopdg dot ru
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 this bug report at https://bugs.php.net/bug.php?id=54207&edit=1