Documented the __sleep and __wakeup member functions when

serializing/unserializing objects in both function references.


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@104987 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
John Coggeshall 2002-11-20 02:45:02 +00:00
parent 496e65509c
commit 906adbe7fa
2 changed files with 10 additions and 2 deletions

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<!-- splitted from ./en/functions/var.xml, last change in rev 1.28 -->
<refentry id="function.serialize">
<refnamediv>
@ -31,6 +31,13 @@
references to itself. References inside the array/object you
are <function>serialize</function>ing will also be stored.
</simpara>
<simpara>
When serializing objects, PHP will attempt to call the member function
__sleep() prior to serialization. This is to allow the object to do any
last minute clean-up, etc. prior to being serialized. Likewise, when the
object is restored using <function>unserialize</function> the __wakeup()
member function is called.
</simpara>
<!-- TODO
in 4.0.4pl1 this didn't work properly, however, there
been some fixes. I don't know whether this all

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.6 $ -->
<!-- $Revision: 1.7 $ -->
<!-- splitted from ./en/functions/var.xml, last change in rev 1.2 -->
<refentry id="function.unserialize">
<refnamediv>
@ -37,6 +37,7 @@
</para>
</note>
<para>
If the variable being unserialized is an object, after successfully reconstructing the object PHP will automatically attempt to call the __wakeup() member function (if it exists).
<example>
<title>unserialize_callback_func example</title>
<programlisting role="php">