SMF
SMF copied to clipboard
Paid Subscriptions notification error
Description
Fatal error: Uncaught TypeError: Unsupported operand types: array & int in /Sources/ScheduledTasks.php:1413 Stack trace: #0 /Sources/ScheduledTasks.php(116): scheduled_paid_subscriptions() #1 /Sources/Load.php(2649): AutoTask()
Looking at the code we are doing a bitwise operation:
if ($notifyPrefs[$row['id_member']] & 0x02)
If we look up, $notifyPrefs
is being populated as such:
$notifyPrefs = getNotifyPrefs(array_keys($members), 'paidsubs_expiring', true);
However, the code and documentation for the call says:
* @return array An array of user ids => array (pref name -> value), with user id 0 representing the defaults
Which leads me to believe that we are doing the call wrong. I think we should be doing:
if ($notifyPrefs[$row['id_member']]['paidsubs_expiring'] & 0x02)
As well as a early on check to ensure paidsubs_expiring key exists.
Steps to reproduce
Environment (complete as necessary)
- Version/Git revision: 2.1.4
- Database Type: MySQL
- Database Version: 8.0
- PHP Version: 8.1
Additional information/references
There is a related topic on the Bug Reports board: https://www.simplemachines.org/community/index.php?topic=588241.0
If possible, I would suggest assigning this issue to a milestone.