From: snake at talitasia dot com Operating system: Linux PHP version: 5.3.18 Package: Session related Bug Type: Bug Bug description:Bug session_set_save_handler() in write function
Description: ------------ write(string $sessionId, string $data) The write callback is called when the session needs to be saved and closed. This callback receives the current session ID a serialized version the $_SESSION superglobal. When the variable $_SESSION hasn't got a value the value returned is string(0). Test script: --------------- <?php class Handler { public function write( $SessionID, $sData ) { var_dump( serialize( $_SESSION ) ); // Real $sData Value var_dump( $sData ); // Return string(0)... } public function open( $sSavePath, $sSessionName ){return true;} public function close(){} public function read( $SessionID ){} public function destroy( $SessionID ){} public function gc( $iMaxLifeTime ){return true;} } $Handler = new Handler(); session_set_save_handler( array( $Handler, 'open' ), array( $Handler, 'close' ), array( $Handler, 'read' ), array( $Handler, 'write' ), array( $Handler, 'destroy' ), array( $Handler, 'gc' ) ); session_start(); session_write_close(); ?> Expected result: ---------------- string(6) "a:0:{}" string(6) "a:0:{}" Actual result: -------------- string(6) "a:0:{}" string(0) "" -- Edit bug report at https://bugs.php.net/bug.php?id=63358&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=63358&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=63358&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=63358&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=63358&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=63358&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=63358&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=63358&r=needscript Try newer version: https://bugs.php.net/fix.php?id=63358&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=63358&r=support Expected behavior: https://bugs.php.net/fix.php?id=63358&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=63358&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=63358&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=63358&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63358&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=63358&r=dst IIS Stability: https://bugs.php.net/fix.php?id=63358&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=63358&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=63358&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=63358&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=63358&r=mysqlcfg