cvs: phpdoc /en/functions var.xml

From: Date: Mon, 10 Dec 2001 00:46:49 +0000
Subject: cvs: phpdoc /en/functions var.xml
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969339594@lists.php.net to get a copy of this message
bernd Sun Dec 9 19:46:49 2001 EDT Modified files: /phpdoc/en/functions var.xml Log: added describtion for unserialize_callback_function Index: phpdoc/en/functions/var.xml diff -u phpdoc/en/functions/var.xml:1.79 phpdoc/en/functions/var.xml:1.80 --- phpdoc/en/functions/var.xml:1.79 Sat Dec 8 16:36:13 2001 +++ phpdoc/en/functions/var.xml Sun Dec 9 19:46:49 2001 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.79 $ --> +<!-- $Revision: 1.80 $ --> <reference id="ref.variables"> <title>Variable Functions</title> <titleabbrev>Variables</titleabbrev> @@ -1150,16 +1150,42 @@ If an object was serialized, its methods are not preserved in the returned value. </simpara> - <note> - <para> - In PHP 3, methods are not preserved when unserializing a - serialized object. PHP 4 removes that limitation and restores - both properties and methods. Please see the <link - linkend="language.oop.serialization">Serializing Objects</link> - section of <link linkend="language.oop">Classes and - Objects</link> or more information. - </para> - </note> + <simpara> + It's possible to set a callback-function which will be called, + if an undefined class should be instanciated during unserializing. + (to prevent getting an incomplete <type>object</type> "__PHP_Incomplete_Class".) + Use your php.ini, <function>ini_set</function> or .htaccess-file + to define 'unserialize_callback_func'. + Everytime an undefined class should be instanciated, it'll be called. + To disable this feature just empty this global variable. + <para> + <example> + <title>unserialize_callback_func example</title> + <programlisting role="php"> +<![CDATA[ +$serialized_object='O:1:"a":1:{s:5:"value";s:3:"100";}'; + +ini_set('unserialize_callback_func','mycallback'); // set your callback_function + +function mycallback($classname) { + // just include a file containing your classdefinition + // you get $classname to figure out which classdefinition is required +} +]]> + </programlisting> + </example> + </para> + </simpara> + <note> + <para> + In PHP 3, methods are not preserved when unserializing a + serialized object. PHP 4 removes that limitation and restores + both properties and methods. Please see the <link + linkend="language.oop.serialization">Serializing Objects</link> + section of <link linkend="language.oop">Classes and + Objects</link> or more information. + </para> + </note> <para> <example> <title><function>unserialize</function> example</title>

« previous php.doc (#969339594) next »