Voting

: one plus three?
(Example: nine)

The Note You're Voting On

biba dot vasyl at gmail dot com
1 year ago
if you use the interface (SessionHandlerInterface) to implement the storage of the session in the mysql database, it is not clear what the read method should return, because the return is specified in the interface: string|false, that is, if I refer to the type:
public function read(string $id): string|false {
if ($id) {
$sql = "SELECT `session_id`, `data` FROM `session` WHERE `session_id` = '" . $this->db->escape($id) . "'";
pp($sql);
$query = $this->db->query($sql);
if ($query->num_rows) {
//return (isset($query->one['data']) ? (array)json_decode($query->one['data'], true) : []);
return $query->one['session_id'];
} else {
return '';
}
}
return false;
}
ref.: https://www.php.net/manual/ru/sessionhandlerinterface.read.php
then I will receive an error response of the following plan: Error #: 2, message: session_start(): Failed to decode session object. Session has been destroyed

<< Back to user notes page

To Top