When disabling notifications in /admin.php?dispatch=notification_settings.manage&receiver_type=A, the changes are not applied and previously disabled check boxes end up being checked again. This does not happen when mysqli is used - only with pdo. The changes are reflected in the database but they don’t take effect.
I found that the issue is with the following function:
app/functions/fn.common.php:fn_get_notification_settings
/**
* Gets all rules about notifications
*
* @return array Rules for notifications about all events to all receivers by all transports
*/
function fn_get_notification_settings()
{
$table = db_get_array('SELECT * FROM ?:notification_settings');
$result = [];
foreach ($table as $events) {
$result[$events['event_id']][$events['receiver']][$events['transport_id']] = ($events['is_allowed'] !== '0');
}
return $result;
}
It checks if $events[‘is_allowed’] !== ‘0’. is_allowed is an int field in the db and pdo returns the value as number. However this check compares it to a string ‘0’ in a typesafe way, which then always evaluates to true. Therefore notifications cannot be disabled.
I’m unable to reproduce this issue, so I cannot agree with your statement.
The topic is not closed. It is moved to the Not enough information branch. If someone will be able to provide enough information for me so I will be able to reproduce it, I will be able to confirm this issue.
This is strange, I can easily reproduce the issue. Fresh install of CS-Cart MultiVendor 4.18.1 with the mysqli PHP extension disabled → open admin console → Settings → Notifications → uncheck some boxes → click Save → boxes are checked again.
By a fortunate coincidence, I was able to reproduce this problem. And it turned out to be directly related to the PHP version. The PDO behaviour changed in PHP 8.1.
I have notified the developers of this issue and as soon as it is fixed, someone from our team will post the news here.