Fix missing $db when session write on exit #21
Loading…
Reference in a new issue
No description provided.
Delete branch "bug/fix-dba-missing-db"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR fixes the case where
exit;
was called beforesession_write_close()
. The DB was already unloaded, and the session handler tried to write the session data to the DB.Using
killme()
instead avoid this pitfall.Wouldn't it be better to have a
_destruct()
function where the database connection is closed? (Like we do in the core?)It's already done this way: https://github.com/friendica/dir/blob/master/include/dba.php#L99
However, when simply exiting, the DB object is destroyed before the session handler function are called, which prevents the session to be written. The
killme()
function ensures that the session is written before the Database object is destroyed.@annando Can you merge this or do you have further comments?
Sorry, I had forgotten about this.