php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #65459 Runkit bundle with future PHP versions?
Submitted: 2013-08-16 07:06 UTC Modified: 2013-08-16 21:11 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: worldoffame at hotmail dot com Assigned:
Status: Wont fix Package: runkit (PECL)
PHP Version: Irrelevant OS: Irrelevant
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: worldoffame at hotmail dot com
New email:
PHP Version: OS:

 

 [2013-08-16 07:06 UTC] worldoffame at hotmail dot com
Description:
------------
Runkit is a very useful extension for PHP, as it enables meta-programming. I still do not understand why it does not come with PHP by default, and that we have to install it from PECL. I know some advanced coders will tell me just to get used to PECL, but the fact is that I am making a software for clients/customers who will install my script on their own servers, most are using shared hosts. In this case, its pretty much impossible for them to get runkit from PECL.

It should be bundled with PHP just like PDO and Memcached, which will make things much easier for users. Or perhaps PHP should come with its own built-in meta-programming support? Do not see this in RFC though so I doubt its gonna happen. Anyway I hope to see Runkit bundled with PHP 5.5.x future releases, but if not please at least make it happen with PHP 5.6.0. Thx. 


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-08-16 16:37 UTC] pollita@php.net
-Status: Open +Status: Wont fix
 [2013-08-16 16:37 UTC] pollita@php.net
This has been discussed, and won't happen.  Runkit simply breaks too many of PHP's 
builtin (internal) assumptions.

I'm glad you like it though!
 [2013-08-16 16:49 UTC] worldoffame at hotmail dot com
Umm what internal assumptions are broken if using runkit? And why is this so big of a problem? Also alternatively, it may be possible to extend the functionality of Reflection API so that the Reflection class does what runkit can do by adding/removing/copying methods to the target class. Heres what the user suggested:
https://github.com/zenovich/runkit/issues/54#issuecomment-22764898
 [2013-08-16 21:11 UTC] pollita@php.net
The assumption that once you define a function/constant/class it stays defined.  
That may not sound dangerous, but it is.

Don't get me wrong, I wrote runkit, I don't dislike it from a "use with caution" 
point of view.  You'll have a massive uphill battle getting it (or similar 
manipulation behavior) into the standard distribution bowever.  When you do, what 
will you have?  A couple fewer steps while compiling...

I'm just trying to save you some time with a quick answer.
 [2013-08-17 01:38 UTC] worldoffame at hotmail dot com
I see. From what you are saying this is not only ruling out any possibility to include runkit in PHP's core, but also eliminating metaprogramming from ever being employed in this language? If so, Id say its such a tragedy...

Sure class/method/constant stays defined is a huge assumption, breaking it can cause some serious trouble. However, I do believe there are times we have to turn the tides and move forward. Wasnt PHP assumed to be a mere templating language to begin with, wasnt PHP assumed to be a purely procedural language a few years ago, and wasnt PHP's functions/methods assumed to be passing by value instead of reference until PHP 5? 

Anyway I thank you for your patient replies and for making runkit in the very place. Sad it wont be making the core of PHP, but even so Id at least hope something else can be done to enable metaprogramming.
 [2013-10-24 23:13 UTC] newms87 at gmail dot com
I would like to put in my vote for runkit / metaprogramming integration! I know its unlikely but it would open up a lot of possibilities for dynamic programming. I am writing a CMS / cart system with a MVC structure.  I would like to enable the possibility of extending classes (Controllers) at runtime to enable different plugins to extend the same class to override methods to alter the data passed to template files (Views).

Eg:
I have a class Controller_Product.
I have a plugin class Plugin_Controller_Product extends Controller_Product.
I have a 2nd plugin (built by some other guy) class Plugin2_Controller_Product extends ControllerProduct.

At runtime I would override any calls to Controller_Product with Plugin_Controller_Product. At the same time, with rootkit I could change Plugin2_Controller_Product to extend Plugin_Controller_Product. Therefore I am successfully keeping the functionality for both plugins available at the same time without the plugins ever having to know about each other.

I know I could achieve a simliar effect with composition (and synchronize the data between the 2 classes), but the runkit method would be a cleaner solution in my opinion and I would imagine would have better performance and less complexity.

However, I cannot implement the runkit method because its not packaged with PHP! This CMS / Cart will be installed on shared hosting systems which will not have the option to install runkit. 


Hoping that this real world example would help add some relevancy to the argument! PHP is always evolving, so even ideas about PHP's core functionality should be open for change! Especially since you would have to actually call these runkit / metaprogramming functions to notice any difference in PHP functionality. If you're using meta-programming code it is your responsibility to understand the consequences!
 [2013-10-24 23:15 UTC] worldoffame at hotmail dot com
Well it seems highly unlikely though, PHP internals are doing whatever they can to prevent every little chance for possible metaprogramming. Look at this bug ticket and you will understand why:
https://bugs.php.net/bug.php?id=50029

I'd understand if runkits is not possible to integrate with PHP, but the above issue is just plainly annoying. *sigh*
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Tue Nov 24 16:01:24 2020 UTC