Edit report at https://bugs.php.net/bug.php?id=30324&edit=1

 ID:                 30324
 Updated by:         ni...@php.net
 Reported by:        matthias dot hoseit at comline dot de
 Summary:            serialize() should work on internal classes
-Status:             Open
+Status:             Closed
 Type:               Feature/Change Request
-Package:            Feature/Change Request
+Package:            *General Issues
 Operating System:   *
 PHP Version:        5.0.*
-Assigned To:        
+Assigned To:        nikic
 Block user comment: N
 Private report:     N

 New Comment:

Closing as serialization for internal classes is already supported if the class 
implements it.


Previous Comments:
------------------------------------------------------------------------
[2004-10-04 19:40:36] he...@php.net

serialize() works on internal classes. It doesn't work on virtual properties 
and this problem usually occurs with internal classes.

What you want is more control over serialization. Eventually the solution is a 
set of new magic callbacks 
function /* string */ __serialize()
static function /* instance */ __unserialize(string $data)

__serialze() would need to return the string used to recreate the instance and 
__unserialize() would recreate it from the passed string. We could also make 
__unserialize() a non static fucntion in which case the instance would be 
created prior to calling the function. However the static functionality allows 
much more flexibility. 

For example the static functionality allows instance creation through factory 
methods and they could store the information needed to reread a xml document or 
reopen a database connection.


------------------------------------------------------------------------
[2004-10-04 17:00:56] matthias dot hoseit at comline dot de

Description:
------------
The function serialize() should work on internal classes like DOMDocument. I my 
opinion this could be a nice Feature.

Best Regards Matthias Hoseit



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=30324&edit=1

Reply via email to