note 111602 added to function.serialize
| From: | allan666atgmail.com | Date: | Thu, 07 Mar 2013 13:28:37 +0000 |
| Subject: | note 111602 added to function.serialize | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-193976@lists.php.net to get a copy of this message | ||
Oddly, if you serialize a class that was previously unserialized, the class of the variable changes
to string... Example:
$R = unserialize($serialized_object);
$R->method(); // this is ok
$str = serialize($R);
echo(get_class($R));
this will output "string"!!!!! whereas if the first line was
$R = new my_class();
it would output "my_class"!
I don't know if that is a bug, but the manual is not clear about that! (somehow $R in
serialize($R) is being passed by reference, since it changes class).
----
Server IP: 69.147.83.199
Probable Submitter: 189.124.207.62
----
Manual Page -- http://php.net/manual/en/function.serialize.php
Edit -- https://master.php.net/note/edit/111602
Del: integrated -- https://master.php.net/note/delete/111602/integrated
Del: useless -- https://master.php.net/note/delete/111602/useless
Del: bad code -- https://master.php.net/note/delete/111602/bad+code
Del: spam -- https://master.php.net/note/delete/111602/spam
Del: non-english -- https://master.php.net/note/delete/111602/non-english
Del: in docs -- https://master.php.net/note/delete/111602/in+docs
Del: other reasons-- https://master.php.net/note/delete/111602
Reject -- https://master.php.net/note/reject/111602
Search -- https://master.php.net/manage/user-notes.php