feature request/bug for anonymous function #36

Closed
supercentenarian opened this Issue Sep 13, 2012 · 4 comments

Projects

None yet

2 participants

First, thank you for this tool. It's wonderful!

I was just playing in the interactive mode; php -a
Php crash when referencing a redefine function from an anonymous function. Here is what I mean:

php > function greet(){echo "hey";}
php > greet();
hey
php > runkit_function_redefine("greet",'$name',"echo "hey $name\n";");
php > greet("you");
hey you
php > function parent(){ $localvar = "john"; $af = function() use ($localvar){greet($localvar);}; return $af;}
php > $greet1 = parent();
php > $greet1();
hey john
php > runkit_function_redefine("greet",'$name',"echo "hello $name\n";");
php > $greet1();
segmentation fault

@zenovich zenovich added a commit that referenced this issue Sep 15, 2012
@zenovich zenovich functions and methods redefining in PHP 5.4 was corrected in all plac…
…es, new tests were added (#36, #32)
1a3af5e
Owner

Thanks for the report. Your code should work fine now, please check this again.

Awesome, thank you. Php is more like Lisp now, thanks to runkit. Works great!

If you come to Dallas,Tx in USA one day, send me email. You can stay in my little apartment anytime.

Owner

Thank you so much. I'm really touched.

I think everyone using runkit is very thankful of your work. I'm very thankful for what you've done. Thank you again sir for your work. :-)

@tony2001 tony2001 added a commit to tony2001/runkit that referenced this issue Sep 18, 2012
@tony2001 tony2001 Merge git://github.com/zenovich/runkit
* git://github.com/zenovich/runkit:
  Adding and redefining functions and methods, which return references, were fully implemented (#12). New optional argument 'return_ref' of functions runkit_function_add and runkit_function_redefine was introduced. New constant RUNKIT_ACC_RETURN_REFERENCE was introduced for use with functions runkit_method_add and runkit_method_redefine. New tests were added.
  The possible crash on manipulating constants having length less than two characters was eliminated. Functions manipulating constants were corrected to work in PHP5.4, new tests were added.
  All ways of adding and removing magic methods and old-style constructors were reworked and corrected (issue #35). Magic methods __isset, __unset, __callStatic, and __toString are now supported. Functions runkit_class_adopt & runkit_class_emancipate now change class-hierarchy (issue #13). tony2001's patch d63c984 was applied and reworked. New tests were added.
  functions and methods redefining in PHP 5.4 was corrected in all places, new tests were added (#36, #32)
  a fix was added to package.xml
  mad casing of classnames in different versions of PHP
  compilation bug (gcc 4.3+) with definition of internal function was fixed
3c35dda
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment