Skip to content
● Grav 2.2 is out: 2x faster cold starts and 96% less memory on big sites. Read the announcement →

Critical failure with "batch" filter expects an array or "Traversable", got "NULL"

Solved by pg@grav View solution

Started by pg@grav 1 year ago · 2 replies · 345 views
1 year ago

Hello,
perhaps somebody could help and give me a hint. I transfered a Website to Xampp. After updating the theme "Landio" i get a critical failure from the "batch" filter (twig):

PHP
grav.CRITICAL: The "batch" filter expects an array or "Traversable", got "NULL". - Trace: #0
D:\Xampp8117\htdocs\testfolder\cache\twig\e4\e4b630d6876bd248f5507081e1a793969ba9008e894791cdc4e3c5a868e2ec34.php(39): twig_array_batch(NULL, 2) #1 
D:\Xampp8117\htdocs\testfolder\vendor\twig\twig\src\Template.php(453): __TwigTemplate_30efb5231938f21eabbaa16a7993d72390a3b2e63463c877c555038f344746b0->doDisplay(Array, Array) #2
D:\Xampp8117\htdocs\testfolder\vendor\twig\twig\src\Template.php(420): Twig\Template->displayWithErrorHandling(Array, Array) #3
D:\Xampp8117\htdocs\testfolder\vendor\twig\twig\src\Template.php(432): Twig\Template->display(Array) #4
D:\Xampp8117\htdocs\testfolder\vendor\twig\twig\src\TemplateWrapper.php(47): Twig\Template->render(Array, Array) #5
D:\Xampp8117\htdocs\testfolder\vendor\twig\twig\src\Environment.php(384): Twig\TemplateWrapper->render(Array) #6
D:\Xampp8117\htdocs\testfolder\system\src\Grav\Common\Twig\Twig.php(340): Twig\Environment->render('modular/text.ht...', Array) #7
D:\Xampp8117\htdocs\testfolder\system\src\Grav\Common\Page\Page.php(987): Grav\Common\Twig\Twig->processPage(Object(Grav\Common\Page\Page), '') #8
.. more code here..
D:\Xampp8117\htdocs\testfolder\index.php(47): Grav\Common\Grav->process() #69 {main} [] []
1 year ago

Not only you didn't provide any context (was it admin, main page, other page with some custom theme template?), you even managed to remove part of the error, where I believe it actually showed where the error was

👍 1
1 year ago Solution

Thanks Karmalakas for the advice
The problem is solved.
it was the failure with /modular/text.html.twig connected with the line

TWIG
{# {% for row in page.header.text|batch(2) %}

i corrected my twig. Now theres is no failure
Thanks again

Suggested topics

Topic Participants Replies Views Activity
Support · by stell, 7 days ago
4 235 5 days ago
Support · by gravinator, 1 month ago
4 441 5 days ago
Support · by Gravver, 2 weeks ago
6 278 1 week ago
Support · by Marcel, 4 weeks ago
2 337 1 week ago
Support · by blu3prince, 2 weeks ago
1 251 2 weeks ago