Calendar Fixed PHP 8.0 error - Template error: Array to string conversion [...] nf_calendar_calendar_index.php

Affected version
2.4.1

Mouth

Well-Known Member
Code:
Server error log
ErrorException: Template error: [E_WARNING] Array to string conversion internal_data/code_cache/templates/l3/s18/public/nf_calendar_calendar_index.php:104
Generated by: Unknown account Nov 2, 2021 at 14:24
Stack trace
#0 internal_data/code_cache/templates/l3/s18/public/nf_calendar_calendar_index.php(104): XF\Template\Templater->handleTemplateError(2, '[E_WARNING] Arr...', '/var/www/netrid...', 104)
#1 src/XF/Template/Templater.php(1651): XF\Template\Templater->{closure}(Object(MaZ\AMP\XF\Template\XF22\Templater), Array, NULL)
#2 src/addons/MaZ/AMP/XF/Template/XF22/Templater.php(52): XF\Template\Templater->renderTemplate('nf_calendar_cal...', Array, true, NULL)
#3 src/XF/Template/Template.php(24): MaZ\AMP\XF\Template\XF22\Templater->renderTemplate('public:nf_calen...', Array)
#4 src/XF/Mvc/Renderer/Html.php(50): XF\Template\Template->render()
#5 src/XF/Mvc/Dispatcher.php(460): XF\Mvc\Renderer\Html->renderView('NF\\Calendar:Eve...', 'public:nf_calen...', Array)
#6 src/XF/Mvc/Dispatcher.php(442): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#7 src/XF/Mvc/Dispatcher.php(402): XF\Mvc\Dispatcher->renderReply(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#8 src/XF/Mvc/Dispatcher.php(60): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#9 src/XF/App.php(2345): XF\Mvc\Dispatcher->run()
#10 src/XF.php(512): XF\App->run()
#11 index.php(20): XF::runApp('XF\\Pub\\App')
#12 {main}
Request state
array(4) {
  ["url"] => string(124) "/events/?layout=list&location_boundary[location]=Canberra&location_boundary[distance]=50&location_boundary[distance_unit]=km"
  ["referrer"] => bool(false)
  ["_GET"] => array(3) {
    ["/events/"] => string(0) ""
    ["layout"] => string(4) "list"
    ["location_boundary"] => array(3) {
      ["location"] => string(8) "Canberra"
      ["distance"] => string(2) "50"
      ["distance_unit"] => string(2) "km"
    }
  }
  ["_POST"] => array(0) {
  }
}
 

Nix

Administrator
Staff member
Can you open the file and show me what line 104 is (and what's around it): internal_data/code_cache/templates/l3/s18/public/nf_calendar_calendar_index.php

It's a dynamically generated file for the template and it's not clear what's problematic.
 

Mouth

Well-Known Member
Can you open the file and show me what line 104 is (and what's around it):
PHP:
                $__finalCompiled .= trim('
                                ' . $__templater->func('page_nav', array(array(
                        'page' => $__vars['page'],
                        'total' => $__vars['total'],
                        'link' => 'events',
                        'params' => (array('layout' => $__vars['layout'], ) + $__vars['filters']),
                        'wrapperclass' => 'block-outer-main',
                        'perPage' => $__vars['perPage'],
                ))) . '

                                ' . $__compilerTemp2 . '
                        ') . '
                </div>

                <div class="block-container">
                        ' . $__templater->callMacro('nf_calendar_calendar_index_macros', 'list_filter_bar', array(
                        'filters' => $__vars['filters'],
                        'baseLinkPath' => 'events',
                        'creatorFilter' => $__vars['creatorFilter'],
104:                        'linkData' => '{\'layout\': $layout} + ' . $__vars['filters'],
                ), $__vars) . '

                        <div class="block-body">
                                ';
                if (!$__templater->test($__vars['events'], 'empty', array())) {
                        $__finalCompiled .= '
                                        ';
                        if (($__vars['layout'] == 'grid')) {
                                $__finalCompiled .= '
                                                <div class="structItemContainer">
                                                        ';
                                if ($__templater->isTraversable($__vars['events'])) {
                                        foreach ($__vars['events'] AS $__vars['event']) {
                                                $__finalCompiled .= '
                                                                ' . $__templater->callMacro('nf_calendar_event_list_macros', 'event_grid', array(
                                                        'event' => $__vars['event'],
                                                ), $__vars) . '
                                                        ';
                                        }
                                }
                                $__finalCompiled .= '
                                                </div>
                                        ';
                        } else {

I've prefixed line 104 with "104:" at the beginning of the line.
 
Top