Every day we get 4 errors in ScheduledTasks.php
It happens on line 1413 & 1416
Undefined array key with a number after it.
What is it and what can i do about this?
we need more information, such as what mods you have installed?
Quote from: Deaks on February 14, 2024, 05:49:41 AMwe need more information, such as what mods you have installed?
No mods
Its referring to these 2
if lines, yes we use paid subscriptions but why is it giving these errors on it every night
if ($notifyPrefs[$row['id_member']] & 0x02)
sendmail($row['email_address'], $emaildata['subject'], $emaildata['body'], null, 'paid_sub_remind', $emaildata['is_html'], 2);
if ($notifyPrefs[$row['id_member']] & 0x01)
{
$alert_rows[] = array(
'alert_time' => time(),
'id_member' => $row['id_member'],
'id_member_started' => $row['id_member'],
'member_name' => $row['member_name'],
'content_type' => 'paidsubs',
'content_id' => $row['id_sublog'],
'content_action' => 'expiring',
'is_read' => 0,
'extra' => $smcFunc['json_encode'](array(
'subscription_name' => $row['name'],
'end_time' => $row['end_time'],
)),
);
updateMemberData($row['id_member'], array('alerts' => '+'));
}
}
What are the ACTUAL, FULL error messages?
I'll take a guess since you're not posting enough information about your error.
Is this your issue? (https://github.com/SimpleMachines/SMF/pull/7778)
Well, i just found a setting to show more info.
Currently this is the only info i got
https://www.******/forum/cron.php
/home/*********/domains/******/public_html/forum/Sources/ScheduledTasks.php (Regel 1416) Backtrace informatie
Fouttype: Cron
FoutmeldingSelecteer
2: Undefined array key 1485
mods installed?
And if you click on the 'backtrace information' button?
Quote from: Arantor on February 15, 2024, 03:33:03 PMAnd if you click on the 'backtrace information' button?
Then i got this:
#0: smf_error_handler()
Aangeroepen van /home/****/domains/****/public_html/forum/Sources/ScheduledTasks.php op regel 1416
#1: scheduled_paid_subscriptions()
Aangeroepen van /home/****/domains/****/public_html/forum/Sources/ScheduledTasks.php op regel 116
#2: AutoTask()
Aangeroepen van /home/****/domains/****/public_html/forum/Sources/Load.php op regel 2638
#3: loadTheme()
Aangeroepen van /home/****/domains/****/public_html/forum/Sources/Load.php op regel 1340
#4: loadBoard()
Aangeroepen van /home/****/domains/****/public_html/forum/index.php op regel 217
#5: smf_main()
Aangeroepen van /home/****/domains/****/public_html/forum/index.php op regel 184
And the URL causing the problem seems for the same day this
https://****/forum/index.php?topic=80350.0
But yesterday it was
https://www.****/forum/index.phphttps://www.****/forum/cron.php
and the day before that its 3-4 times
https://www.****/forum/index.php?topic=109984.msg251301
It's a bug. Somehow you have people who have paid subscriptions but no preferences set up for paid subscriptions to be told about them.
I'll try to give you some better debug notes later (am at work, using an iPad, writing code is hard)
In ScheduledTasks.php, find that troublesome code on the line indicated.
This adds a new bit above the first if statement you found, and will solve the problem (I added the first if block for reference how it should look)
if (!isset($notifyPrefs[$row['id_member']]))
continue;
if ($notifyPrefs[$row['id_member']] & 0x02)
sendmail($row['email_address'], $emaildata['subject'], $emaildata['body'], null, 'paid_sub_remind', $emaildata['is_html'], 2);
I've moved this to the Bug Reports board to bring it to the attention of our developers.
Quote from: Arantor on February 19, 2024, 01:00:41 PMIn ScheduledTasks.php, find that troublesome code on the line indicated.
This adds a new bit above the first if statement you found, and will solve the problem (I added the first if block for reference how it should look)
if (!isset($notifyPrefs[$row['id_member']]))
continue;
if ($notifyPrefs[$row['id_member']] & 0x02)
sendmail($row['email_address'], $emaildata['subject'], $emaildata['body'], null, 'paid_sub_remind', $emaildata['is_html'], 2);
Thank you sir!
I have updated the code and will let you know if the error persists tomorrow.
But i'm wondering in the first place
A) why did this happen
B) shouldn't we fix the main cause instead of working on error hiding
C) What is the downside?
A) Somehow you got users who have subscriptions but no preferences for those subscriptions.
B) It's a data error not a code error.
C) I don't see one.
Quote from: Arantor on February 20, 2024, 03:30:58 AMA) Somehow you got users who have subscriptions but no preferences for those subscriptions.
B) It's a data error not a code error.
C) I don't see one.
Okay, but how did they do A in the first place? Isn't that the main bug that the data of B is missing?
*shrug* I could see a failure state if the people in question took out subscriptions but never went to the notification settings page.
The reality is that, honestly, I don't care to investigate it that hard. I already regret how much time I sank into 2.1 as it was.
All my code change did was say "if there's no notification settings for this user, skip them". A sensible precaution in all cases, frankly.
Just for the record, there is a related issue about ScheduledTasks: #7784 (https://github.com/SimpleMachines/SMF/issues/7784)