#47088 [NEW]: Problems w/ session_set_save_handler when changing $_SESSION from a function
From: guido_jansen at gmx dot de
Operating system: Win XP
PHP version: 5.2.8
PHP Bug Type: Session related
Bug description: Problems w/ session_set_save_handler when changing $_SESSION from a function
Description:
------------
I'm using a custom save handler to store my session information in a
database.
The save handler is much like the one on
http://www.zend.com/zend/spotlight/code-gallery-wade8.php
Everything works fine except one thing
If I change the $_SESSION from within a function, then the argument which
should contain the session_data is emtpy
Reproduce code:
---------------
session_start();
session_set_save_handler( [...] array(&$ses_class, '_write' [...]);
// ...
$_SESSION['a'] = 'b';
function temp() {
$_SESSION['c'] = 'd';
}
// ...
session_write_close(); // this will call custom _write function
-------------------------------------
class Session() {
// ...
function _write($id, $data) {
var_dump($data); // <---- here is the output
// ...
}
// ...
}
Expected result:
----------------
Inside the custom session write function, the second argument should dump
as
string(20) "a|s:1:"b";c|s:1:"d";"
Actual result:
--------------
Actually the output is
string(0) ""
--
Edit bug report at http://bugs.php.net/?id=47088&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=47088&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=47088&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=47088&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=47088&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=47088&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=47088&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=47088&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=47088&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=47088&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=47088&r=support
Expected behavior: http://bugs.php.net/fix.php?id=47088&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=47088&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=47088&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=47088&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47088&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=47088&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=47088&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=47088&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=47088&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=47088&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=47088&r=mysqlcfg
Thread (3 messages)
- guido_jansen at gmx dot de