#50793 [Opn->Ver]: Note about not being able to serialize internal objects needs clarifiaction
| From: | bjori@php.net | Date: | Mon, 18 Jan 2010 19:33:53 +0000 |
| Subject: | #50793 [Opn->Ver]: Note about not being able to serialize internal objects needs clarifiaction | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-3746@lists.php.net to get a copy of this message | ||
ID: 50793
Updated by: bjori@php.net
Reported By: weirdan at gmail dot com
-Status: Open
+Status: Verified
Bug Type: Documentation problem
PHP Version: 5.3.1
New Comment:
$ php -n -r '$d = new DOMDocument("1.0", "UTF-8"); $s = serialize($d);
var_dump(unserialize($s)->encoding, $d->encoding);'
Warning: Unknown: Invalid State Error in Command line code on line 1
NULL
string(5) "UTF-8"
See bug#30323 &&
http://svn.php.net/viewvc/phpdoc/en/trunk/reference/var/functions/seri
alize.xml?r1=164053&r2=172271
I guess the simplest way to fix this is to say something along the
lines of "classes that do not implement Serializable or the
__sleep()/__wakeUp() functions cannot be reliably serialized"?
Previous Comments:
------------------------------------------------------------------------
[2010-01-18 19:16:09] weirdan at gmail dot com
Description:
------------
Manual says 'It is not possible to serialize PHP built-in objects',
however some of internal classes support serialization:
weirdan@virtual-debian:/home/sam/trunk$ php -r
'var_dump(phpversion());
$c = new ReflectionClass("ArrayObject");
var_dump("is internal", $c->isInternal());
$q = new ArrayObject();
var_dump(serialize($q));'
string(5) "5.3.1"
string(11) "is internal"
bool(true)
string(45) "C:11:"ArrayObject":21:{x:i:0;a:0:{};m:a:0:{}}"
weirdan@virtual-debian:/home/sam/trunk$
Reproduce code:
---------------
---
From manual page: function.serialize#Notes
---
See description
Expected result:
----------------
Explicitly list serializable/non-serializable classes for extensions
enabled by default (possibly in appendix).
Actual result:
--------------
The note is misleading.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=50793&edit=1