Autofunc patch (automatically loading functions like autoload)
| From: | Rack-Soft security | Date: | Fri, 16 Oct 2009 14:32:51 +0000 |
| Subject: | Autofunc patch (automatically loading functions like autoload) | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-45829@lists.php.net to get a copy of this message | ||
Hello,
I am submitting quite an interesting patch to PHP 5.2.11 and PHP 5.3.0. It is used in production on
hundreds of machines without any issues.
Basically the patch adds the autofunc function that performs quite in the same way like autofunc,
only that it does it for functions. As do you know, if PHP can not find a function it will issue a
fatal error. With autofunc you can find the function somewhere and load it. Management of large no
OOP projects (or mixed OOP/procedural) is much easier with this. I know that there are workarounds
for loading functions, like adding them static to classes, but this is not efficient and involves
important changes to code.
I have attached some PHP files to test with, you must execute index.php that will load autofunc when
the loaded functions can not be found.
Let me know if you have any questions regarding the patch.
Best regards,
Bogdan
Attachment: [application/x-gzip] autofunc-php-5.2.11.tar.gz
Attachment: [application/x-gzip] autofunctest.tar.gz
Attachment: [application/x-gzip] autofunc-php-5.3.0.tar.gz
Attachment: [application/x-gzip] autofunc-php-5.2.11.tar.gz
Attachment: [application/x-gzip] autofunctest.tar.gz
Attachment: [application/x-gzip] autofunc-php-5.3.0.tar.gz