php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #30323 serialize doesn't work on internal classes
Submitted: 2004-10-04 16:58 UTC Modified: 2004-11-08 16:08 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: matthias dot hoseit at comline dot de Assigned:
Status: Closed Package: Documentation problem
PHP Version: 5.0.2 OS: Windows 2000
Private report: No CVE-ID: None
 [2004-10-04 16:58 UTC] matthias dot hoseit at comline dot de
Description:
------------
The function serialize() doesn't work on internal classes.

For example serializing a DOMDocument object return a byte-stream with an empty value ("O:11:"DOMDocument":0:{}").

It should be mentioned in the PHP Manual of serialize(), that this function only work on user defined classes.

Best Regards Matthias hoseit


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-10-27 04:16 UTC] curt@php.net
DOMDocument doesn't have any properties thus none are stored in the searilzed string. unserializing the string creates a DOMDocument object perfectly fine:

  $k = unserialize('O:11:"DOMDocument":0:{}');
  var_dump($k);
 [2004-11-08 16:08 UTC] vrana@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.

"It is not possible to serialize PHP built-in objects."

Curt, I think you are not right. You are right that properties of internal classes are stored (visible e.g. with Directory class) but methods are not reconstructed after unserializing with e.g. Warning: Couldn't fetch DOMDocument.

So serailizing built-in object is useless.

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 15 23:01:33 2025 UTC