Hi Marcus,
You would need to provide a c level serialization that stores the $this pointer (the easy part) and the zend_function member (not easy). The second part requires storing of all static variables, which again is pretty easy but it also requires to store the function itself, which in case of a user function probably only means the string but then at the time of serialization you only have the compiled opcodes. So you would need APC to serialize the opcodes, which is not yet implemented. Alternatively you could save the implementation string somewhere. And serialize that and compiling it upon unserialization. If you're more interested, c level serialization with multiple serialization inputs is used for: SplObjectStorage::serialize() / unserialize().
thnx for your insight. i've looked at SplObjectStorage::serialize and it seems pretty straight forward - this shouldn't be a problem. as you said it's saving the zend_function member that is tricky. i thought i'd go with saving function string and recompiling it as you suggested (i don't want to mess with APC although i find the idea of opcode serialization much more appealing). anyway it's proving itself, well... tricky ;-) i'm thinking about hooking into zend_do_beging_lambda_function_declaration and saving all until zend_do_end_function_declaration, but i haven't tried that in practice yet (not even sure how to do this at the moment - i'll get to it tonight). thnx marcin -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php