From:             antphill at uk dot ibm dot com
Operating system: Linux
PHP version:      5.2.6RC5
PHP Bug Type:     Session related
Bug description:  Encoding $_SESSION crashes with recusive arrays

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 bug report at http://bugs.php.net/?id=44720&edit=1
-- 
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=44720&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=44720&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=44720&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=44720&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=44720&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=44720&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=44720&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=44720&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=44720&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=44720&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=44720&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=44720&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=44720&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=44720&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=44720&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=44720&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=44720&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=44720&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=44720&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=44720&r=mysqlcfg

Reply via email to