unset($_SESSION[var]) works and is prefered even with register_globals

register_globals globalizes $_SESSION (bug #34732)


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@198348 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Jakub Vrana 2005-10-13 12:40:08 +00:00
parent 43080398da
commit 42c237469b

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.53 $ -->
<!-- $Revision: 1.54 $ -->
<!-- Purpose: basic.session -->
<!-- Membership: core -->
@ -228,25 +228,6 @@ unset($_SESSION['count']);
to restore a reference to another variable.
</para>
</warning>
<para>
<example>
<title>
Unregistering a variable with <link
linkend="ini.register-globals">register_globals</link>
enabled, after registering it using
<varname>$_SESSION</varname>.
</title>
<programlisting role="php">
<![CDATA[
<?php
session_start();
// With PHP 4.3 and later, you can also simply use the prior example.
session_unregister('count');
?>
]]>
</programlisting>
</example>
</para>
<para>
If <link
linkend="ini.register-globals">register_globals</link>
@ -264,13 +245,7 @@ session_unregister('count');
don't use <function>session_register</function>,
<function>session_is_registered</function> or
<function>session_unregister</function>.
</para>
<para>
If you enable <link
linkend="ini.register-globals">register_globals</link>,
<function>session_unregister</function> should be used since
session variables are registered as global variables when
session data is deserialized. Disabling <link
Disabling <link
linkend="ini.register-globals">register_globals</link>
is recommended for both security and performance reasons.
</para>
@ -282,6 +257,8 @@ session_unregister('count');
is enabled, then the global variables and the
<varname>$_SESSION</varname> entries will automatically reference the
same values which were registered in the prior session instance.
However, if the variable is registered by <varname>$_SESSION</varname>
then the global variable is available since the next request.
</para>
<para>
There is a defect in PHP 4.2.3 and earlier. If you register a new