cvs: phpdoc /en/reference/var/functions unserialize.xml

From: Date: Fri, 15 Nov 2002 10:04:39 +0000
Subject: cvs: phpdoc /en/reference/var/functions unserialize.xml
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969349689@lists.php.net to get a copy of this message
philip Fri Nov 15 05:04:39 2002 EDT Modified files: /phpdoc/en/reference/var/functions unserialize.xml Log: Added when unserialize_callback_func became available (4.2.0) which closes bug #16582. Also a few typos and <?php ?> additions. Index: phpdoc/en/reference/var/functions/unserialize.xml diff -u phpdoc/en/reference/var/functions/unserialize.xml:1.4 phpdoc/en/reference/var/functions/unserialize.xml:1.5 --- phpdoc/en/reference/var/functions/unserialize.xml:1.4 Sat Oct 12 10:34:59 2002 +++ phpdoc/en/reference/var/functions/unserialize.xml Fri Nov 15 05:04:39 2002 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <!-- splitted from ./en/functions/var.xml, last change in rev 1.2 --> <refentry id="function.unserialize"> <refnamediv> @@ -23,14 +23,16 @@ In case the passed string is not unserializeable, &false; is returned. </simpara> <note> + <title>unserialize_callback_func directive</title> <para> It's possible to set a callback-function which will be called, - if an undefined class should be instanciated during unserializing. + if an undefined class should be instantiated 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 setting. + to define 'unserialize_callback_func'. Everytime an undefined class + should be instantiated, it'll be called. To disable this feature just + empty this setting. Also note that the directive + unserialize_callback_func became available in PHP 4.2.0. </para> </note> <para> @@ -38,14 +40,17 @@ <title>unserialize_callback_func example</title> <programlisting role="php"> <![CDATA[ +<?php $serialized_object='O:1:"a":1:{s:5:"value";s:3:"100";}'; +// unserialize_callback_func directive available as of PHP 4.2.0 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> @@ -65,6 +70,7 @@ <title><function>unserialize</function> example</title> <programlisting role="php"> <![CDATA[ +<?php // Here, we use unserialize() to load session data to the // $session_data array from the string selected from a database. // This example complements the one described with serialize(). @@ -83,6 +89,7 @@ $session_data = array(); } } +?> ]]> </programlisting> </example>

« previous php.doc (#969349689) next »