ElkArte Community

Title: Errors Undefined index: unread_messages and Undefined index: id
Post by: augras on April 23, 2018, 04:59:15 am
Hi,
Each time a user click on Messages i get an error in the logs : Undefined index: unread_messages.
These errors are all the same and are linked to the line 307 in the PersonnalMessage.controller.php.
307:    $label_counters = array('unread_messages' => $context['labels'][-1]['unread_messages']);
How can i solve it please ?
Thank you,
Philippe

EDIT1
In the same file there are also the errors Undefined index: id in the lines
1616: if ($label['id'] != -1)
1617: {                                                                        //not in error, just to see the code
1618: $the_labels[$label['id']] = $label['name'];

2874: 'id' => $label['id'],

Something with $label['id'] seems to be wrong, but what ?
Philippe
Title: Re: Errors Undefined index: unread_messages and Undefined index: id
Post by: emanuele on April 24, 2018, 08:06:25 am
Yep, it's reported and there is a fix, it was not added to 1.1.3 because it was too late.
I can't search right now, as soon as I can I'll post here the topic.
Title: Re: Errors Undefined index: unread_messages and Undefined index: id
Post by: augras on April 24, 2018, 09:16:54 am
Ok, thank you emmanuele.
All the errors are fixed, even the Undefined index: id errors in the EDIT1 ?
Philippe
Title: Re: Errors Undefined index: unread_messages and Undefined index: id
Post by: augras on May 05, 2018, 04:57:19 am
Hi, just to remember to post the fix please :D
Philippe
Title: Re: Errors Undefined index: unread_messages and Undefined index: id
Post by: Spuds on May 05, 2018, 05:04:47 pm
I believe it was this issue ... https://github.com/elkarte/Elkarte/issues/3124
Title: Re: Errors Undefined index: unread_messages and Undefined index: id
Post by: augras on May 06, 2018, 04:11:04 am
Hi Spuds,
it seems to be the same thing.
This issue is in fact still on and there is not yet a patch ? (Github is not clear for me ).
Philippe
Title: Re: Errors Undefined index: unread_messages and Undefined index: id
Post by: Spuds on May 06, 2018, 09:27:22 am
it will be in 1.1.4

the fix is to edit sources/subs/PersonalMessage.subs.php and remove line 84 which says
Code: [Select]
$labels = array();

Please note as you make edits to 1.1.3, when the 1.1.4 patch arrives you will likely get some errors during installation since some fixes will have already been applied, ... so just keep that in mind.
Title: Re: Errors Undefined index: unread_messages and Undefined index: id
Post by: augras on May 06, 2018, 09:43:43 am
Thank you again Spuds,
I will try to remember all the changes in my files and not come here to ask for errors coming from these changes.
Philippe