Skip to main content
Topic: Error message "Warning: Undefined array key "time" " (Read 552 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Error message "Warning: Undefined array key "time" "

I've been getting a new error message since today, even though I haven't changed anything anywhere.
It is reported at the very bottom of the index page even when logged out, and in the admin centre this is displayed in the error log:

v3Gw8EFIKGU039r48Rc4JaLG20XmFhfj
Type of error: Undefined
Warning: Undefined array key "time"

File: /www/htdocs/w0xxxx5/forum-xyz/themes/default/BoardIndex.template.php
Line: 309

Code: [Select]
302	echo '
303 <li class="board_row">
304 <h3 class="ic_section_header">
305 ', $context['show_stats'] ? '<a href="' . $scripturl . '?action=stats" title="' . $txt['more_stats'] . '"><i class="icon i-pie-chart"></i>' . $txt['forum_stats'] . '</a>' : $txt['forum_stats'], '
306 </h3>
307 <p class="inline">
308 ', $context['common_stats']['boardindex_total_posts'], '', !empty($settings['show_latest_member']) ? ' - ' . $txt['latest_member'] . ': <strong> ' . $context['common_stats']['latest_member']['link'] . '</strong>' : '', ' - ', $txt['most_online_today'], ': ', comma_format($modSettings['mostOnlineToday']), '<br />
309 ', (!empty($context['latest_post']) ? $txt['latest_post'] . ': <strong>&quot;' . $context['latest_post']['link'] . '&quot;</strong>  ( ' . $context['latest_post']['time'] . ' )' : ''), ' - <a href="', $scripturl, '?action=recent">', $txt['recent_view'], '</a>
310 </p>
311 </li>';


What's not longer correct there?

Re: Error message "Warning: Undefined array key "time" "

Reply #1

Looking at the code I don't have a quick answer as to why that may be suddenly occurring.    Is the latest post on a child board or recycle board or other special board?

You can change line 309 to be:
Code: [Select]
					', (!empty($context['latest_post']) ? $txt['latest_post'] . ': <strong>&quot;' . $context['latest_post']['link'] . '&quot;</strong>  ( ' . ($context['latest_post']['time'] ?? '') . ' )' : ''), ' - <a href="', $scripturl, '?action=recent">', $txt['recent_view'], '</a>
and that should top the error.

 

Re: Error message "Warning: Undefined array key "time" "

Reply #2

Thanks, that helped and the error messages are now gone.
I had posted in a child child board. A normal text post that contained a link. Which is actually nothing unusual and I have done several times before.
As I had also noticed after posting here yesterday, the error had also paralyzed the scroll/jump down arrow on the index page. Just there. It didn't work anymore, but the arrow up did. Now everything works there again, too. :)

Re: Error message "Warning: Undefined array key "time" "

Reply #3

Thanks for the extra details ... I'll do some more testing on nested boards and see if I can see reproduce the exact error.   Glad the quick fix got you going again :D