From: thomas at ecommerce dot com
Operating system: SuSE Linux 10.0
PHP version: 5.1.4
PHP Bug Type: Session related
Bug description: OOP -> Maximum function nesting error
Description:
------------
I didn't find anything in the documentation that is related to the
following script. Its not possible to update the $_SESSION var after the
call 'dummy($_SESSION)'.
The var will be set during the runtime, but when you refresh the
page/script, the vars setted after the function call will be gone.
just put the bottom code in an test.php script and run it 1 time and
refresh it again via browser. You will see, second var will be gone after
refresh.
Reproduce code:
---------------
<?php
ob_start(); //-- enshure headers don't get sended
session_start(); //-- start session
//-- dummy function, that make it impossible to set an $_SESSION var after
it
function dummy($var = null)
{
static $tmp = array();
$tmp[] = $var;
}
//-- dump current value
var_dump($_SESSION);
//-- set new value
$_SESSION['test'] = "cool";
//-- call dummy function
dummy($_SESSION);
//-- simeple var
$cool = "yes";
//-- set var in session
$_SESSION['whatever'] = $cool;
//-- dump current value
var_dump($_SESSION);
?>
Expected result:
----------------
Expected result after refresh:
array(2) {
["test"]=>
string(4) "cool"
["whatever"]=>
string(3) "yes"
}
array(2) {
["test"]=>
string(4) "cool"
["whatever"]=>
string(3) "yes"
}
Actual result:
--------------
Current result after refresh:
array(1) {
["test"]=>
string(4) "cool"
}
array(2) {
["test"]=>
string(4) "cool"
["whatever"]=>
string(3) "yes"
}
--
Edit bug report at http://bugs.php.net/?id=37926&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=37926&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=37926&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=37926&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=37926&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=37926&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=37926&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=37926&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=37926&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=37926&r=support
Expected behavior: http://bugs.php.net/fix.php?id=37926&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=37926&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=37926&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=37926&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37926&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=37926&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=37926&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=37926&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=37926&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=37926&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=37926&r=mysqlcfg