Re: [PATCH] Closures and reflection improvements
| From: | Marcus Boerger | Date: | Mon, 11 Aug 2008 19:01:39 +0000 |
| Subject: | Re: [PATCH] Closures and reflection improvements | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-39835@lists.php.net to get a copy of this message | ||
Hello Christian,
Monday, August 11, 2008, 8:43:31 PM, you wrote:
> Hi,
>> all submitted now. Thanks everyone for their help and especially
>> Christian for getting this started.
> Thanks for making my patch work after the modifications in
> zend_closures.c. I'm sorry I couldn't do it myself but I was kind of
> busy the last few days and the "simple fix" created memory leaks and I
> didn't want to post a knowingly broken patch.
> Anyway, there are still segfaults in the current version:
> $foo = function ($a) {};
> $o = new ReflectionMethod ($foo);
> $p = $o->getParameters ();
> unset ($o);
> $m = $p[0]->getDeclaringFunction ();
> Reflection::export ($m);
> $foo = function ($a) {};
> $p = new ReflectionParameter ($foo, 'a');
> $m = $p->getDeclaringFunction ();
> unset ($p);
> Reflection::export ($m);
> This is due to the fact that getParameters() / getDeclaringFunction()
> don't copy the fptr and fptr->common.function_name pointers if it's a
> closure. Here are patches for PHP 5.3 and HEAD that fix the problem:
>
> http://www.christian-seiler.de/temp/php/2008-08-11-reflection/segfaults-5.3.patch
>
> http://www.christian-seiler.de/temp/php/2008-08-11-reflection/segfaults-6.patch
> Also, the following test that I already posted should be added to
> PHP_5_2, PHP_5_3 and HEAD:
>
> http://www.christian-seiler.de/temp/php/2008-07-24-reflection/reflectionParameter_invalidMethodInConstructor.phpt
> The test already works for PHP_5_3 (since the fix for that was included
> in my original patch) but a segfault still occurs in PHP_5_2 and HEAD,
> my patch that I already posted fixes that problem for 5.2:
>
> http://www.christian-seiler.de/temp/php/2008-07-24-reflection/reflection-segfault-fix-5.2.patch
> My original patch also fixed the problem for HEAD, I readded that part
> to the above segfault patch for HEAD.
>> Also, it appears you do not have a cvs account, or did I overlook
>> something?
> No, I don't. Dmitry also mentioned that - should I request one?
Yes, please do and the seg fix patch should have a function to do the
copying as it is not complete, so we can add to it as necessary.
Best regards,
Marcus