Req #70643 [NEW]: Allow update of class alias
| From: | remyfox at hotmail dot com | Date: | Mon, 05 Oct 2015 14:40:10 +0000 |
| Subject: | Req #70643 [NEW]: Allow update of class alias | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-196402@lists.php.net to get a copy of this message | ||
From: remyfox at hotmail dot com
Operating system: irrelevant
PHP version: Next Major Version
Package: Class/Object related
Bug Type: Feature/Change Request
Bug description:Allow update of class alias
Description:
------------
Since a class alias is assigned during run time, I suppose it would make
sense to allow a class alias's update.
Use case:
E.g. in a system where multiple classes of different code versions
(temporarily) exist to ensure backward compatibility when importing a
number of updates. The versions of the class could all be put in
separate temporarily generated uniquely named namespaces. During the
execution of the updates, the class alias could be updated once it
reaches an update which needs to use a newer version of a class that was
also used by previous updates - albeit in an older state.
Might be a good idea to include this in PHP 7. It seems like a small
enhancement.
Test script:
---------------
class A {}
class B {}
class_alias("A", "X");
class_alias("B", "X");
Expected result:
----------------
Class alias X becomes B's alias.
Actual result:
--------------
Fatal error: Cannot redeclare class A
--
Edit bug report at https://bugs.php.net/bug.php?id=70643&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70643&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70643&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70643&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=70643&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=70643&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=70643&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=70643&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=70643&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=70643&r=support
Expected behavior: https://bugs.php.net/fix.php?id=70643&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=70643&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=70643&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=70643&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70643&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=70643&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=70643&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=70643&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=70643&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=70643&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=70643&r=mysqlcfg