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.