XF 2.2 Cannot call method getFullRequestUri on a non-object

Cylon

Member
Hi!

I'm getting this exception every time a page is loaded on my XF 2.2.4 installation.

Code:
ErrorException: Template error: [E_USER_WARNING] Cannot call method getFullRequestUri on a non-object (NULL) src/XF/Template/Templater.php:1151
#1 src/XF/Template/Templater.php(1151): trigger_error('Cannot call met...', 512)
#2 internal_data/code_cache/templates/l5/s5/public/helper_js_global.php(276): XF\Template\Templater->method(NULL, 'getFullRequestU...', Array)
#3 src/XF/Template/Templater.php(799): XF\Template\Templater->{closure}(Object(ThemeHouse\UIX\XF\Template\Templater), Array, NULL)
#4 internal_data/code_cache/templates/l5/s5/public/PAGE_CONTAINER.php(3603): XF\Template\Templater->callMacro('helper_js_globa...', 'body', Array, Array)
#5 src/XF/Template/Templater.php(1626): XF\Template\Templater->{closure}(Object(ThemeHouse\UIX\XF\Template\Templater), Array, NULL)
#6 src/XF/Pub/App.php(562): XF\Template\Templater->renderTemplate('PAGE_CONTAINER', Array)
#7 src/XF/App.php(2131): XF\Pub\App->renderPageHtml('
    

        

        
    


...', Array, Object(XF\Mvc\Reply\View), Object(XF\Mvc\Renderer\Html))
#8 src/XF/Mvc/Dispatcher.php(402): XF\App->renderPage('
    

        

        
    


...', Object(XF\Mvc\Reply\View), Object(XF\Mvc\Renderer\Html))
#9 src/XF/Mvc/Dispatcher.php(58): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#10 src/XF/App.php(2326): XF\Mvc\Dispatcher->run()
#11 src/XF.php(488): XF\App->run()
#12 index.php(20): XF::runApp('XF\\Pub\\App')
#13 {main}


The affected template is the helper_js_global.php. I'm having the same error on my local dev installation, where I use the default XF theme, because of that I suppose it is not related to the theme.

I looked at the template, but I don't know how to fix the problem. I suppose the problem is not originated in the template, but in other place:
I suppose the object $xf.request is null, but I don't have idea why.

Code:
<xf:if is="$xf.visitor.canSearch() && $xf.request.getFullRequestUri() === link('full:index')">
        <script type="application/ld+json">
        {
            "@context": "https://schema.org",
            "@type": "WebSite",
            "url": "{{ link('canonical:index')|escape('js') }}",
            "potentialAction": {
                "@type": "SearchAction",
                "target": "{{ link('canonical:search/search')|escape('js') . ($xf.options.useFriendlyUrls ? '?' : '&') . 'keywords={search_keywords}' }}",
                "query-input": "required name=search_keywords"
            }
        }
        </script>
    </xf:if>

Any help is appreciated. The forum is working well, but there are a lot of exceptions being logged in the dashboard, and they are hiding other exceptions that are more important

Thanks
 
Thank you for your reply.

No, the local dev installation does not have the uix addon. It is a vanilla Xf installation. I suppose the exception will be slightly different. Tomorrow I can post the exception of my local environment.

If this exception is caused by an addon, disabling the addon should make the exception disappear right?
 
Top Bottom