#47213 [NEW]: include rename_function() in standard library
| From: | rasmus at mindplay dot dk | Date: | Sun, 25 Jan 2009 16:35:04 +0000 |
| Subject: | #47213 [NEW]: include rename_function() in standard library | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-133205@lists.php.net to get a copy of this message | ||
From: rasmus at mindplay dot dk
Operating system: all
PHP version: 5.2.8
PHP Bug Type: Feature/Change Request
Bug description: include rename_function() in standard library
Description:
------------
Please consider including this function in the standard library:
http://us3.php.net/rename_function
This would enable techniques as shown below.
I know this is a duplicate of feature request #37078, which was bluntly
rejected without explanation, before anyone had a chance to review or
comment on this idea.
Reproduce code:
---------------
<?php
// example -
// install an autoload handler that preserves an existing handler:
if (function_exists('__autoload')) {
rename_function('__autoload', '__autoload_old');
}
function __autoload($class_name) {
if (function_exists('__autoload_old') {
try {
__autoload_old($class_name);
catch ($e) {
// my own autoloader here..
}
}
}
?>
Another example would be the ability to extend existing PHP functions with
new functionality, like calculating default arguments or enhancing the
behavior of certain functions. Example: the array_chunk function only works
with real arrays - you could override it with a function that works with
iterable objects as well.
Expected result:
----------------
This would work - you could override this magic function and preserve any
existing autoloader.
This would enable you to combine autoloaders from different projects.
Actual result:
--------------
The function is not generally available on standard PHP installations.
--
Edit bug report at http://bugs.php.net/?id=47213&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=47213&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=47213&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=47213&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=47213&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=47213&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=47213&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=47213&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=47213&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=47213&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=47213&r=support
Expected behavior: http://bugs.php.net/fix.php?id=47213&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=47213&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=47213&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=47213&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47213&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=47213&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=47213&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=47213&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=47213&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=47213&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=47213&r=mysqlcfg