#44720 [Opn->Bgs]: Encoding $_SESSION crashes with recusive arrays
ID: 44720
Updated by: jani@php.net
Reported By: antphill at uk dot ibm dot com
-Status: Open
+Status: Bogus
Bug Type: Session related
Operating System: Linux
PHP Version: 5.2.6RC5
New Comment:
session_register() is deprecated. DO NOT USE. Ever. RTFM about
$_SESSION.
Previous Comments:
------------------------------------------------------------------------
[2008-04-14 16:04:14] antphill at uk dot ibm dot com
Description:
------------
If I add create a global variable array which contains recursive
entries it causes PHP to crash when I register it by calling
session_register. This appears to be because the PS_ENCODE_LOOP macro
does not check for recursion.
Reproduce code:
---------------
<?php
$array = array();
$array["foo"] = NULL;
$array["bar"] = NULL;
$array["guff"] = NULL;
$array["blah"] = &$array;
var_dump(session_start());
var_dump(session_register($array));
echo "Done!\n";
?>
Expected result:
----------------
Perhaps we should check for recusion rather like the JSON extension
does (see json_encode_array() in JSON.c)?
Actual result:
--------------
bool(true)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44720&edit=1
Thread (3 messages)