[Patch] Allow __sleep to return NULL
| From: | Andrew Minerd | Date: | Tue, 06 Nov 2007 20:51:19 +0000 |
| Subject: | [Patch] Allow __sleep to return NULL | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-33041@lists.php.net to get a copy of this message | ||
I've attached a patch (both for HEAD and the PHP_5_3 branch) that allows the magic __sleep()
method to return NULL to continue the normal serialization process (all members are serialized).
This allows the __sleep() method to do meaningful cleanup without having to resort to Reflection
overhead. The patch retains the original behavior (E_NOTICE) if anything other than an array or NULL
is returned from the function.
I check the results of a "make test" on the PHP_5_3 branch with and without the patch. I
skipped the results from HEAD because there were so many unrelated failures it was pointless. The
one additional failure in 5.3 with the patch is actually a reverse unit test. I've included a
patch (separately, because it's the same for HEAD and PHP_5_3) to correct the expected result
from this test.
Thanks,
Andrew
Attachment: [text/x-patch] andrewm.sleep_null.53.patch
Attachment: [text/x-patch] andrewm.sleep_null.HEAD.patch
Attachment: [text/x-patch] andrewm.sleep_null.test.patch
Attachment: [text/x-patch] andrewm.sleep_null.53.patch
Attachment: [text/x-patch] andrewm.sleep_null.HEAD.patch
Attachment: [text/x-patch] andrewm.sleep_null.test.patch