Arquivos
hhvm/hphp/test/quick/builtin_extension_DOMNodeIterator.php.expectf
T
Mike Magruder 8283969d81 Don't serialize cppext instances unless they opt-in, and pass the class name for the debugger
Most CPP extension classes don’t think about serialization, and some require more initialization than the default contractor provides. The result is that on deserialization we end up with a partially initialized object, and undefined behavior after that.

Modified the serializer to emit __PHP_Unserializable_Class instead, and just the class name for the debugger case. Modified the deserializer to create a __PHP_Unserializable_Class, too, if we are given a string with a CPP extension instance in it, so we're safe on both sides. I do not raise a warning; the results are pretty clear, I think, and it's also unlikely that most such warnings could (or should) be corrected. Finally, I also removed the odd behavior of emitting "dummy" classes for Closure and Continuation. I found no use of these in any source tree. Closure had no implementation at all, and Continuation had an implementation that simply raised a fatal on any method call. Thus we can safely assume that even if someone was serializing one of these types, they were receiving an object that was useless to them, or would fatal. So I believe this transformation is safe.
2013-07-23 11:44:16 -07:00

48 linhas
983 B
Plaintext

DOMNodeIterator
object(DOMNodeIterator)#1 (0) {
}
string(100) "O:26:"__PHP_Unserializable_Class":1:{s:31:"__PHP_Unserializable_Class_Name";s:15:"DOMNodeIterator";}"
object(__PHP_Unserializable_Class)#2 (1) {
["__PHP_Unserializable_Class_Name"]=>
string(15) "DOMNodeIterator"
}
array(6) {
[0]=>
string(11) "__construct"
[1]=>
string(7) "current"
[2]=>
string(3) "key"
[3]=>
string(4) "next"
[4]=>
string(6) "rewind"
[5]=>
string(5) "valid"
}
================
A_DOMNodeIterator
object(A_DOMNodeIterator)#3 (1) {
["___x"]=>
NULL
}
string(102) "O:26:"__PHP_Unserializable_Class":1:{s:31:"__PHP_Unserializable_Class_Name";s:17:"A_DOMNodeIterator";}"
object(__PHP_Unserializable_Class)#4 (1) {
["__PHP_Unserializable_Class_Name"]=>
string(17) "A_DOMNodeIterator"
}
array(6) {
[0]=>
string(11) "__construct"
[1]=>
string(7) "current"
[2]=>
string(3) "key"
[3]=>
string(4) "next"
[4]=>
string(6) "rewind"
[5]=>
string(5) "valid"
}