ElkArte Community

Elk Development => Bug Reports => Exterminated Bugs => Topic started by: scripple on October 21, 2017, 10:27:24 pm

Title: Post Error in 1.1
Post by: scripple on October 21, 2017, 10:27:24 pm
I get the following error when I load the reply page in 1.1

    Type of error: Undefined
    Notice: Undefined index: attachments
    forum/index.php?action=post;topic=xxx.0;last_msg=yyy
    File: forum/themes/default/Post.template.php
    Line: 329

Also lines 336,740,and 741
$context['attachments'] is not defined. 

I run with attachments disabled but enabling them didn't help.  This is on an upgrade from 1.0.10 and yes I uninstalled all mods other than the various upgrades (1.0.8,1.0.9, etc.) before the upgrade.
Title: Re: Post Error in 1.1
Post by: emanuele on October 22, 2017, 08:06:17 am
Darn, that one I guess is a big oversight on my side.
The original idea was to actually extract the parts of the template dealing with attachments and put them into different functions, but I didn't track the idea and lost track of it... :-[
Sorry about that.

As a quick workaround, I would change:
Code: [Select]
', $context['attachments']['can']['post'] ?
to:
Code: [Select]
', isset($context['attachments']) && $context['attachments']['can']['post'] ?

and:
Code: [Select]
if ($context['attachments']['can']['post'] || !empty($context['attachments']['current']))
to:
Code: [Select]
if (isset($context['attachments']) && $context['attachments']['can']['post'] || !empty($context['attachments']['current']))

Tracked at https://github.com/elkarte/Elkarte/issues/3015