Ubuntu is now in php7 and I have a pb with my application and I don't know how to resolve this.
Could you help me. Where i can change this element? Thank you.
The errors
Waing: session_regenerate_id(): Session callback expects true/false retu value in /home/www//boutique/includes/functions/sessions.php on line 153
Waing: session_regenerate_id(): Session object destruction failed. ID: user (path: /tmp/) in /home/www//boutique/includes/functions/sessions.php on line 153
the line 153
function osc_session_recreate() {
global $SID;
$old_id = session_id();
session_regenerate_id(true); // =========> line 153
if (!empty($SID)) {
$SID = session_name() . '=' . session_id();
}
WhosOnline::WhosOnlineUpdateSessionId($old_id, session_id());
}
My function use OMHTTP; use SitesShopWhosOnline; use OMRegistry; use OMOSCOM;
if (STORE_SESSIONS == 'mysql') {
function _sess_open($save_path, $session_name) {
retu true;
}
function _sess_close() {
retu true;
}
function _sess_read($key) {
$OSCOM_PDO = Registry::get('Db');
$Qsession = $OSCOM_PDO->prepare('select value
from :table_sessions
where sesskey = :sesskey
');
$Qsession->bindValue(':sesskey', $key);
$Qsession->execute();
if ($Qsession->fetch() !== false) {
retu $Qsession->value('value');
} else {
retu '';
}
}
function _sess_write($key, $value) {
$OSCOM_PDO = Registry::get('Db');
$OSCOM_Mail = Registry::get('Mail');
$Qcheck = $OSCOM_PDO->prepare('select 1
from :table_sessions
where sesskey = :sesskey
');
$Qcheck->bindValue(':sesskey', $key);
$Qcheck->execute();
if (strlen($value) > 65535) {
// administrator email
$email_subject = 'Error Mysql on ' . STORE_NAME;
$message = 'Error Mysql, Data truncated for column value in last session and not saved for keeping stability. there are certainly too many items in your cart <br /><br />Please contact your administrator<br /><br />ClicShopping system has also send an email at your administrator';
$name = STORE_NAME;
$email_address = STORE_OWNER_EMAIL_ADDRESS;
$OSCOM_Mail->oscMail(STORE_NAME, STORE_OWNER_EMAIL_ADDRESS, $email_subject, $message, $name, $email_address, '');
osc_db_error("SQL SESSION ERROR", "<p>Waing: #1265, #1046 Data truncated for column 'value' in last session and not saved for keeping stability", strlen(osc_db_input($value)) . " characters would be truncated to 65535" . '</p><p><font color="#ff0000">Sorry for the inconvenience but ' . STORE_NAME . ' online shopping system has reached its limit of. Probably too many items in cart. We recommend that you remove some products from the basket, and instead do one more after this order.</font></p><br /><p> <a href="' . OSCOM::link('index.php', 'Cart', 'SSL') . '">' . IMAGE_BUTTON_CONTINUE . '</a><br /><br /> <a href="' . OSCOM::link('index.php','Info&Contact', 'SSL') . '">' . 'Contact' . '</a></p>' );
}
if ($Qcheck->fetch() !== false) {
retu $OSCOM_PDO->save('sessions', ['expiry' => time(),
'value' => $value
],
['sesskey' => $key]
);
} else {
retu $OSCOM_PDO->save('sessions', ['sesskey' => $key,
'expiry' => time(),
'value' => $value]
);
}
}
function _sess_destroy($key) {
$OSCOM_PDO = Registry::get('Db');
retu $OSCOM_PDO->delete('sessions', ['sesskey' => $key]);
}
function _sess_gc($maxlifetime) {
$OSCOM_PDO = Registry::get('Db');
$Qdel = $OSCOM_PDO->prepare('delete
from :table_sessions
where expiry < :expiry
');
$Qdel->bindValue(':expiry', time() - $maxlifetime);
$Qdel->execute();
retu $Qdel->rowCount();
}
session_set_save_handler('_sess_open', '_sess_close', '_sess_read', '_sess_write', '_sess_destroy', '_sess_gc');
}
function osc_session_start() {
$sane_session_id = true;
if ( isset($_GET[session_name()]) ) {
if ( (SESSION_FORCE_COOKIE_USE == 'True') || (preg_match('/^[a-zA-Z0-9,-]+$/', $_GET[session_name()]) == false) ) {
unset($_GET[session_name()]);
$sane_session_id = false;
}
}
if ( isset($_POST[session_name()]) ) {
if ( (SESSION_FORCE_COOKIE_USE == 'True') || (preg_match('/^[a-zA-Z0-9,-]+$/', $_POST[session_name()]) == false) ) {
unset($_POST[session_name()]);
$sane_session_id = false;
}
}
if ( isset($_COOKIE[session_name()]) ) {
if ( preg_match('/^[a-zA-Z0-9,-]+$/', $_COOKIE[session_name()]) == false ) {
$session_data = session_get_cookie_params();
setcookie(session_name(), '', time()-42000, $session_data['path'], $session_data['domain']);
unset($_COOKIE[session_name()]);
$sane_session_id = false;
}
}
if ($sane_session_id == false) {
OSCOM::redirect('index.php', '', 'SSL', false);
}
// php7 pb
// register_shutdown_function('session_write_close');
retu session_start();
}
function osc_session_recreate() {
global $SID;
$old_id = session_id();
session_regenerate_id(true);
if (!empty($SID)) {
$SID = session_name() . '=' . session_id();
}
WhosOnline::WhosOnlineUpdateSessionId($old_id, session_id());
}
