/* BC for clever users - Deprecate me */ \
ret = SUCCESS; \
} else { \
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Session callback expects true/false return value"); \
+ if (!EG(exception)) { \
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, \
+ "Session callback expects true/false return value"); \
+ } \
ret = FAILURE; \
} \
zval_ptr_dtor(&retval); \
}
}
- if (ret == FAILURE) {
+ if ((ret == FAILURE) && !EG(exception)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to write session data (%s). Please "
"verify that the current setting of session.save_path "
"is correct (%s)",
function close() {
echo "close: goodbye cruel world\n";
+ return true;
}
function read($id) {
function close() {
echo "close: goodbye cruel world\n";
+ return true;
}
function read($id) {
if ($fp = fopen($session_file, "w")) {
$return = fwrite($fp, $session_data);
fclose($fp);
- return $return;
+ return (bool)$return;
}
return false;
}
global $session_save_path, $name;
echo "Destroy [${session_save_path},${id}]\n";
$session_file = "$session_save_path/".SESSION_FILE_PREFIX.$id;
- return unlink($session_file);
+ unlink($session_file);
+ return true;
}
function gc($maxlifetime) {
throw new Exception("Stop...!");
}
-function close() { }
-function read($id) { }
-function write($id, $session_data) { }
-function destroy($id) { }
-function gc($maxlifetime) { }
+function close() { return true; }
+function read($id) { return ''; }
+function write($id, $session_data) { return true; }
+function destroy($id) { return true; }
+function gc($maxlifetime) { return true; }
var_dump(session_module_name("files"));
session_set_save_handler("open", "close", "read", "write", "destroy", "gc");
string(%d) "%s"
string(4) "user"
-Fatal error: Uncaught exception 'Exception' with message 'Stop...!' in %s:%d
+Warning: Uncaught exception 'Exception' with message 'Stop...!' in %s:%d
Stack trace:
#0 [internal function]: open('', 'PHPSESSID')
#1 %s(%d): session_start()
#2 {main}
thrown in %s on line %d
+
+Fatal error: session_start(): Failed to initialize storage module: %s in %s/session_module_name_variation3.php on line %d
}
public function write($id, $data) {
- return file_put_contents($this->path . $id, $data);
+ return (bool)file_put_contents($this->path . $id, $data);
}
public function destroy($id) {
@unlink($this->path . $id);
+ return true;
}
public function gc($maxlifetime) {
Warning: SessionHandler::write(): Parent session handler is not open in %ssession_set_save_handler_class_005.php on line %d
+Warning: session_write_close(): Failed to write session data %s in %ssession_set_save_handler_class_005.php on line %d
+
Warning: SessionHandler::close(): Parent session handler is not open in %ssession_set_save_handler_class_005.php on line %d
public function open($path, $name) {
++$this->i;
echo 'Open ', session_id(), "\n";
- return parent::open();
+ // This test was written for broken return value handling
+ // Mimmick what was actually being tested by returning true here
+ return (null === parent::open());
}
public function read($key) {
++$this->i;
Warning: Unknown: Parent session handler is not open in Unknown on line 0
+Warning: Unknown: Failed to write session data %s in %s on line %d
+
Warning: Unknown: Parent session handler is not open in Unknown on line 0
}
public function write($id, $data) {
- return file_put_contents($this->path . $id, $data);
+ return (bool)file_put_contents($this->path . $id, $data);
}
public function destroy($id) {
--EXPECTF--
*** Testing session_set_save_handler() : error functionality ***
-Fatal error: Uncaught exception 'Exception' with message 'Do something bad..!' in %s:%d
+Warning: Uncaught exception 'Exception' with message 'Do something bad..!' in %s:%d
Stack trace:
#0 [internal function]: open('', 'PHPSESSID')
#1 %s(%d): session_start()
#2 {main}
thrown in %s on line %d
+
+Fatal error: session_start(): Failed to initialize storage module: %s in %ssession_set_save_handler_error3.php on line %d
echo "*** Testing session_set_save_handler() : error functionality ***\n";
-function callback() { }
+function callback() { return true; }
session_set_save_handler("callback", "callback", "callback", "callback", "callback", "callback");
session_set_save_handler("callback", "echo", "callback", "callback", "callback", "callback");
}
public function write($id, $data) {
- return file_put_contents($this->path . $id, $data);
+ return (bool)file_put_contents($this->path . $id, $data);
}
public function destroy($id) {
function noisy_gc($maxlifetime) {
echo("GC [".$maxlifetime."]\n");
gc($maxlifetime);
+ return true;
}
require_once "save_handler.inc";