Req #61265 [Com]: __autoload should know about traits
| From: | gron@php.net | Date: | Sun, 04 Mar 2012 17:11:11 +0000 |
| Subject: | Req #61265 [Com]: __autoload should know about traits | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-168093@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=61265&edit=1
ID: 61265
Comment by: gron@php.net
Reported by: manchokapitancho at gmail dot com
Summary: __autoload should know about traits
Status: Open
Type: Feature/Change Request
Package: Class/Object related
PHP Version: 5.4.0
Block user comment: N
Private report: N
New Comment:
Could you elaborate a bit on the usecase?
Until now, there didn't seem to be the need to handle interfaces differently in an
autoloader. Why would you treat traits differently from classes and interfaces?
Previous Comments:
------------------------------------------------------------------------
[2012-03-03 13:10:25] manchokapitancho at gmail dot com
Description:
------------
Currently, __autoload is automatically called when a class is not found. As of
5.4.0, it is also called when a trait is not found. It is also called when an
interface is not found.
Unfortunately, there is no way to understand what type of resource is being
autoloaded.
So I suggest that a second optional argument is added to __autoload. It can
receive three possible values from the PHP engine - for example:
AUTOLOAD_CLASS, AUTOLOAD_TRAIT and AUTOLOAD_INSTANCE.
This way, a better autoload handling can be achieved.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=61265&edit=1