Req #73202 [NEW]: Pass origin (callee) as second parameter to autoloading implementations
| From: | philippwrann at gmail dot com | Date: | Thu, 29 Sep 2016 08:54:41 +0000 |
| Subject: | Req #73202 [NEW]: Pass origin (callee) as second parameter to autoloading implementations | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-204332@lists.php.net to get a copy of this message | ||
From: philippwrann at gmail dot com
Operating system: all
PHP version: Next Major Version
Package: SPL related
Bug Type: Feature/Change Request
Bug description:Pass origin (callee) as second parameter to autoloading implementations
Description:
------------
At the moment it is not possible to implement dependency managers that
can handle different versions of the same package. If the callee (file
location) would be provided as second parameter for autoload callbacks a
autoloading implementation could determine the correct version to load.
Some real world example:
You start a new composer based project and require some third party
package.
That package requires another package, for example some api.
So long all is good
Now you require one more package, that requires the same package but in
another version => not possible.
A fix would be downwards compatible because the additional parameter
would simply be ignored by current implementations.
Test script:
---------------
// something like this
spl_autoload_register(function($className, $originPath){
get_real_autoloader($originPath)->load($className);
});
--
Edit bug report at https://bugs.php.net/bug.php?id=73202&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73202&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73202&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73202&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=73202&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=73202&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=73202&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=73202&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=73202&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=73202&r=support
Expected behavior: https://bugs.php.net/fix.php?id=73202&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=73202&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=73202&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=73202&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73202&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=73202&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=73202&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=73202&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=73202&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=73202&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=73202&r=mysqlcfg