I've just run into a problem with a brand new OpenCart 3.0.3.7 install.
The stats: OpenCart 3.0.3.7, completely stock install on a Dreamhost VPS with PHP 7.3, no extensions, default template.
I've run into this problem multiple times and it's 100% repeatable. Install OpenCart. Create an administrator during the install. Log on once the install is done. Go to store settings. Change the time zone from the default to America/Los Angeles.
Boom. Instantly on hitting Save, you'll be taken to the Login screen. From that point on, you can never log in to the administrator dashboard again. Typing a valid administrator username and password silently takes you back to the login screen.
Tested multiple times with Chrome, Firefox, and Safari.
The stats: OpenCart 3.0.3.7, completely stock install on a Dreamhost VPS with PHP 7.3, no extensions, default template.
I've run into this problem multiple times and it's 100% repeatable. Install OpenCart. Create an administrator during the install. Log on once the install is done. Go to store settings. Change the time zone from the default to America/Los Angeles.
Boom. Instantly on hitting Save, you'll be taken to the Login screen. From that point on, you can never log in to the administrator dashboard again. Typing a valid administrator username and password silently takes you back to the login screen.
Tested multiple times with Chrome, Firefox, and Safari.
Already been reported, https://github.com/opencart/opencart/issues/9237
If locked out you can find a temp workaround below or otherwise wait for an official fix -
viewtopic.php?f=201&t=222369#p813699
If locked out you can find a temp workaround below or otherwise wait for an official fix -
viewtopic.php?f=201&t=222369#p813699
Full Stack Web Developer :: Send a PM for Custom Work.
Backup and learn how to recover before you make any changes!
See if this workaround resolves the issue: viewtopic.php?f=201&t=222369#p813324 .
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
As stated in viewtopic.php?f=201&t=222369&start=20#p816440. You can change date_timezone in system/config/default.php timezone to match what you selected in store settings. https://github.com/opencart/opencart/bl ... lt.php#L14
Or try https://github.com/opencart/opencart/pull/9633.
Or try https://github.com/opencart/opencart/pull/9633.
If you look the file "system/framework.php." When set de default timezone for php (line 15) it take value from the file "system/config/default.php" and not from the database setting configuration (if is different show the error). The quick solution is changing the value from default.php file but if you change on setting page you'll need update this file again.
Another solution is changing the order of code in "system/framework.php" (until official fix). This is what I do:
// replece the line 15
date_default_timezone_set($config->get('date_timezone'));
// with this code:
// Sync PHP and DB time zones
if ($config->get('db_autostart')) {
$db = new DB($config->get('db_engine'), $config->get('db_hostname'), $config->get('db_username'), $config->get('db_password'), $config->get('db_database'), $config->get('db_port'));
$registry->set('db', $db);
$query = $db->query("SELECT value FROM " . DB_PREFIX . "setting WHERE `code` = 'config' AND `key` = 'config_timezone' ");
if (!empty($query->row)) {
$timezone = $query->row['value'];
date_default_timezone_set($timezone);
} else {
date_default_timezone_set($config->get('date_timezone'));
}
$db->query("SET time_zone = '" . $db->escape(date('P')) . "'");
} else {
date_default_timezone_set($config->get('date_timezone'));
}
// comment or delete this lines because is not usefull (included on solution before) start on line 78, finish on 85
// Database
if ($config->get('db_autostart')) {
$db = new DB($config->get('db_engine'), $config->get('db_hostname'), $config->get('db_username'), $config->get('db_password'), $config->get('db_database'), $config->get('db_port'));
$registry->set('db', $db);
// Sync PHP and DB time zones
$db->query("SET time_zone = '" . $db->escape(date('P')) . "'");
}
Another solution is changing the order of code in "system/framework.php" (until official fix). This is what I do:
// replece the line 15
date_default_timezone_set($config->get('date_timezone'));
// with this code:
// Sync PHP and DB time zones
if ($config->get('db_autostart')) {
$db = new DB($config->get('db_engine'), $config->get('db_hostname'), $config->get('db_username'), $config->get('db_password'), $config->get('db_database'), $config->get('db_port'));
$registry->set('db', $db);
$query = $db->query("SELECT value FROM " . DB_PREFIX . "setting WHERE `code` = 'config' AND `key` = 'config_timezone' ");
if (!empty($query->row)) {
$timezone = $query->row['value'];
date_default_timezone_set($timezone);
} else {
date_default_timezone_set($config->get('date_timezone'));
}
$db->query("SET time_zone = '" . $db->escape(date('P')) . "'");
} else {
date_default_timezone_set($config->get('date_timezone'));
}
// comment or delete this lines because is not usefull (included on solution before) start on line 78, finish on 85
// Database
if ($config->get('db_autostart')) {
$db = new DB($config->get('db_engine'), $config->get('db_hostname'), $config->get('db_username'), $config->get('db_password'), $config->get('db_database'), $config->get('db_port'));
$registry->set('db', $db);
// Sync PHP and DB time zones
$db->query("SET time_zone = '" . $db->escape(date('P')) . "'");
}
Code: Select all
$query = $db->query("SELECT value FROM " . DB_PREFIX . "setting WHERE `code` = 'config' AND `key` = 'config_timezone' ");
Code: Select all
$query = $db->query("SELECT `value` FROM `" . DB_PREFIX . "setting` WHERE `code` = 'config' AND `key` = 'config_timezone' ");
Code: Select all
if (!empty($query->row)) {
Code: Select all
if ($query->num_rows) {
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Who is online
Users browsing this forum: No registered users and 95 guests