Admin notifications cannot be disabled when using PDO

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:

 * 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’ve tested this with PDO and MySQLi, and both PDO and MySQLi return all fetched results as strings, so strict compare works properly here.

Have you made any changes to your installation? What version of PHP are you using?

The bug exists. I have already posted it on the RU forum? Why did you close it without fix?

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.

Happens with MariaDB as well as MySQL.