Added when unserialize_callback_func became available (4.2.0) which closes

bug #16582.  Also a few typos and <?php ?> additions.


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@104162 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Philip Olson 2002-11-15 10:04:39 +00:00
parent a7b3ec072f
commit f9c590a15d

View file

@ -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 @@ function mycallback($classname) {
<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 @@ if (!odbc_execute ($stmt, &$sqldata) || !odbc_fetch_into ($stmt, &$tmp)) {
$session_data = array();
}
}
?>
]]>
</programlisting>
</example>