<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="sessionhandlerinterface.read" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
 <refnamediv>
  <refname>SessionHandlerInterface::read</refname>
  <refpurpose>Read session data</refpurpose>
 </refnamediv>

 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis role="SessionHandlerInterface">
   <modifier>public</modifier> <type class="union"><type>string</type><type>false</type></type><methodname>SessionHandlerInterface::read</methodname>
   <methodparam><type>string</type><parameter>id</parameter></methodparam>
  </methodsynopsis>
  <para>
   Reads the session data from the session storage, and returns the results.
   Called right after the session starts or when <function>session_start</function> is called.
   Please note that before this method is called <function>SessionHandlerInterface::open</function> is invoked.
  </para>
  <para>
   This method is called by PHP itself when the session is started.
   This method should retrieve the session data from storage by the
   session ID provided. The string returned by this method must be in the same
   serialized format as when originally passed to the <function>SessionHandlerInterface::write</function>
   If the record was not found, return &false;.
  </para>
  <para>
   The data returned by this method will be decoded internally by PHP using the
   unserialization method specified in <link linkend="ini.session.serialize-handler">session.serialize_handler</link>.
   The resulting data will be used to populate the <varname>$_SESSION</varname> superglobal.
  </para>
  <para>
   Note that the serialization scheme is not the same as <function>unserialize</function>
   and can be accessed by <function>session_decode</function>.
  </para>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <variablelist>
   <varlistentry>
    <term><parameter>id</parameter></term>
    <listitem>
     <para>
      The session id.
     </para>
    </listitem>
   </varlistentry>
  </variablelist>
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   Returns an encoded string of the read data. If nothing was read, it must return &false;. Note this value is returned internally to PHP for processing.
  </para>
 </refsect1>

 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <member>
     The <link linkend="ini.session.serialize-handler">session.serialize_handler</link>
     configuration directive.
    </member>
   </simplelist>
  </para>
 </refsect1>

</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
