vrana           Sat Mar 24 08:23:49 2007 UTC

  Modified files:              
    /phpdoc/en/language oop.xml 
    /phpdoc/en/language/oop5    magic.xml 
  Log:
  What if __sleep doesn't return anything, fix example (bug #40344)
  
http://cvs.php.net/viewvc.cgi/phpdoc/en/language/oop.xml?r1=1.66&r2=1.67&diff_format=u
Index: phpdoc/en/language/oop.xml
diff -u phpdoc/en/language/oop.xml:1.66 phpdoc/en/language/oop.xml:1.67
--- phpdoc/en/language/oop.xml:1.66     Thu Apr 27 07:29:20 2006
+++ phpdoc/en/language/oop.xml  Sat Mar 24 08:23:48 2007
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.66 $ -->
+<!-- $Revision: 1.67 $ -->
  <chapter id="language.oop">
   <title>Classes and Objects (PHP 4)</title>
 
@@ -755,11 +755,12 @@
    being run prior to any serialization. It can clean up the object
    and is supposed to return an array with the names of all variables
    of that object that should be serialized.
+   If the method doesn't return anything then &null; is serialized and
+   E_NOTICE is issued.
   </para>
   
   <para>
-   The intended use of <literal>__sleep</literal> is to close any
-   database connections that object may have, committing pending
+   The intended use of <literal>__sleep</literal> is to commit pending
    data or perform similar cleanup tasks. Also, the function is
    useful if you have very large objects which need not be
    saved completely.
http://cvs.php.net/viewvc.cgi/phpdoc/en/language/oop5/magic.xml?r1=1.13&r2=1.14&diff_format=u
Index: phpdoc/en/language/oop5/magic.xml
diff -u phpdoc/en/language/oop5/magic.xml:1.13 
phpdoc/en/language/oop5/magic.xml:1.14
--- phpdoc/en/language/oop5/magic.xml:1.13      Sat Aug 12 16:09:29 2006
+++ phpdoc/en/language/oop5/magic.xml   Sat Mar 24 08:23:49 2007
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.13 $ -->
+<!-- $Revision: 1.14 $ -->
  <sect1 id="language.oop5.magic">
   <title>Magic Methods</title>
   <para>
@@ -41,15 +41,20 @@
     executed prior to any serialization. It can clean up the object
     and is supposed to return an array with the names of all variables
     of that object that should be serialized.
+    If the method doesn't return anything then &null; is serialized and
+    E_NOTICE is issued.
    </para>
    <para>
-    The intended use of <literal>__sleep</literal> is to close any
-    database connections that the object may have, commit pending
+    The intended use of <literal>__sleep</literal> is to commit pending
     data or perform similar cleanup tasks. Also, the function is
     useful if you have very large objects which do not need to be
     saved completely.
    </para>
    <para>
+    The <literal>__sleep</literal> method should return the value to serialize
+    (usually <literal>$this</literal>), otherwise &null; is serialized.
+   </para>
+   <para>
     Conversely, <function>unserialize</function> checks for the
     presence of a function with the magic name 
     <literal>__wakeup</literal>. If present, this function can
@@ -87,7 +92,7 @@
     
     public function __sleep()
     {
-        mysql_close($this->link);
+        return array('server', 'username', 'password', 'db');
     }
     
     public function __wakeup()

Reply via email to