Edit report at https://bugs.php.net/bug.php?id=63358&edit=1
ID: 63358 Updated by: larue...@php.net Reported by: snake at talitasia dot com Summary: Bug session_set_save_handler() in write function -Status: Open +Status: Not a bug Type: Bug Package: Session related Operating System: Linux PHP Version: 5.3.18 Block user comment: N Private report: N New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php this "serialize" is not that "serialize", see: http://php.net/manual/en/function.session-encode.php Previous Comments: ------------------------------------------------------------------------ [2012-10-25 10:22:42] snake at talitasia dot com 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 this bug report at https://bugs.php.net/bug.php?id=63358&edit=1