From:             ceo at l-i-e dot com
Operating system: FreeBSD 5.3-RELEASE
PHP version:      5.0.3
PHP Bug Type:     Session related
Bug description:  Session string values are references

Description:
------------
<?php
  session_start();
  if (!isset($_SESSION['name'])){
    $_SESSION['name'] = 'Richard Lynch';
  }
  else{
    $name = $_SESSION['name'];
  }
  /* Assume a ton of code goes here */
  $name = 'Fooey';
  echo "Session name is: ", $_SESSION['name'], "<br />\n";
?>

Now, hit this page, re-load it, and what do *YOU* expect $_SESSION['name']
to output?

A) 'Richard Lynch', because you never re-assigned $_SESSION['name']
B) 'Fooey' because $name is a reference, and you changed it, so that
changed your session data.

*I* expected A)
Alas, the reality is B)


-- 
Edit bug report at http://bugs.php.net/?id=32496&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=32496&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=32496&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=32496&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=32496&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=32496&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=32496&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=32496&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=32496&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=32496&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=32496&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=32496&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=32496&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=32496&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=32496&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=32496&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=32496&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=32496&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=32496&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=32496&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=32496&r=mysqlcfg

Reply via email to