1

I have a large site that I've finally got all the deprecation errors fixed except for 1. There is no origin.

enter image description here

I opened up the stack trace but am unable to find which template the deprecated code is in. How do I resolve this final warning?

Steps leading up to the deprecation error:

38  Deprecation error: Looping through element queries directly has been deprecated. Use the all() function to fetch the query results before looping over them.
Called from /path/to/httpdocs/vendor/craftcms/cms/src/elements/db/ElementQuery.php:464
37  craft\elements\db\EntryQuery::getIterator()
36  iterator_to_array(craft\elements\db\EntryQuery, true)
Called from /path/to/httpdocs/vendor/twig/twig/src/Extension/CoreExtension.php:1120
35  twig_to_array(craft\elements\db\EntryQuery, true)
Called from /path/to/httpdocs/vendor/twig/twig/src/Extension/CoreExtension.php:1288
34  twig_array_batch(craft\elements\db\EntryQuery, 3)
Called from /path/to/httpdocs/storage/runtime/compiled_templates/38/38acd345bac4f191994499bfe7e62d331a84af06b5a4ace739819932939d6058.php:52
33  __TwigTemplate_d251f3d068d749b1a0f4eee6f98ddd26064c049f83d9199ef4bccf7686601dee::doDisplay(["entry" => craft\elements\Entry, "variables" => ["entry" => craft\elements\Entry], "view" => craft\web\View, "devMode" => false, ...], [])
Called from /path/to/httpdocs/vendor/twig/twig/src/Template.php:407
32  __TwigTemplate_d251f3d068d749b1a0f4eee6f98ddd26064c049f83d9199ef4bccf7686601dee::displayWithErrorHandling(["entry" => craft\elements\Entry, "variables" => ["entry" => craft\elements\Entry], "view" => craft\web\View, "devMode" => false, ...], [])
Called from /path/to/httpdocs/vendor/craftcms/cms/src/web/twig/Template.php:52
31  __TwigTemplate_d251f3d068d749b1a0f4eee6f98ddd26064c049f83d9199ef4bccf7686601dee::displayWithErrorHandling(["entry" => craft\elements\Entry, "variables" => ["entry" => craft\elements\Entry], "view" => craft\web\View, "devMode" => false, ...], [])
Called from /path/to/httpdocs/vendor/twig/twig/src/Template.php:380
30  __TwigTemplate_d251f3d068d749b1a0f4eee6f98ddd26064c049f83d9199ef4bccf7686601dee::display(["entry" => craft\elements\Entry, "variables" => ["entry" => craft\elements\Entry], "view" => craft\web\View, "devMode" => false, ...], [])
Called from /path/to/httpdocs/vendor/craftcms/cms/src/web/twig/Template.php:34
29  __TwigTemplate_d251f3d068d749b1a0f4eee6f98ddd26064c049f83d9199ef4bccf7686601dee::display(["entry" => craft\elements\Entry, "variables" => ["entry" => craft\elements\Entry], "view" => craft\web\View, "devMode" => false, ...])
Called from /path/to/httpdocs/storage/runtime/compiled_templates/d5/d5884e1e24dec7ff702d623116bb58998ad5dca6f03051643ac5ba0eea7f957f.php:683
28  __TwigTemplate_712544c9008ab179e898ab48b6f69c483b586c60af648c06961221a7eaf8c859::block_content(["entry" => craft\elements\Entry, "variables" => ["entry" => craft\elements\Entry], "view" => craft\web\View, "devMode" => false, ...], ["head" => [__TwigTemplate_712544c9008ab179e898ab48b6f69c483b586c60af648c06961221a7eaf8c859, "block_head"], "content" => [__TwigTemplate_712544c9008ab179e898ab48b6f69c483b586c60af648c06961221a7eaf8c859, "block_content"], "pageJs" => [__TwigTemplate_712544c9008ab179e898ab48b6f69c483b586c60af648c06961221a7eaf8c859, "block_pageJs"]])
Called from /path/to/httpdocs/vendor/twig/twig/src/Template.php:184
27  __TwigTemplate_4e994cc5367055b091d48b770f56afdbf44ad62c879220c6de19951d32165abe::displayBlock("content", ["entry" => craft\elements\Entry, "variables" => ["entry" => craft\elements\Entry], "view" => craft\web\View, "devMode" => false, ...], ["head" => [__TwigTemplate_712544c9008ab179e898ab48b6f69c483b586c60af648c06961221a7eaf8c859, "block_head"], "content" => [__TwigTemplate_712544c9008ab179e898ab48b6f69c483b586c60af648c06961221a7eaf8c859, "block_content"], "pageJs" => [__TwigTemplate_712544c9008ab179e898ab48b6f69c483b586c60af648c06961221a7eaf8c859, "block_pageJs"]])
Called from /path/to/httpdocs/storage/runtime/compiled_templates/3a/3acba1d39bd77fb2e778f9f42b9494f379e1ef989b68a67e709d113de2a8a94f.php:158
26  __TwigTemplate_4e994cc5367055b091d48b770f56afdbf44ad62c879220c6de19951d32165abe::doDisplay(["entry" => craft\elements\Entry, "variables" => ["entry" => craft\elements\Entry], "view" => craft\web\View, "devMode" => false, ...], ["head" => [__TwigTemplate_712544c9008ab179e898ab48b6f69c483b586c60af648c06961221a7eaf8c859, "block_head"], "content" => [__TwigTemplate_712544c9008ab179e898ab48b6f69c483b586c60af648c06961221a7eaf8c859, "block_content"], "pageJs" => [__TwigTemplate_712544c9008ab179e898ab48b6f69c483b586c60af648c06961221a7eaf8c859, "block_pageJs"]])
Called from /path/to/httpdocs/vendor/twig/twig/src/Template.php:407
25  __TwigTemplate_4e994cc5367055b091d48b770f56afdbf44ad62c879220c6de19951d32165abe::displayWithErrorHandling(["entry" => craft\elements\Entry, "variables" => ["entry" => craft\elements\Entry], "view" => craft\web\View, "devMode" => false, ...], ["head" => [__TwigTemplate_712544c9008ab179e898ab48b6f69c483b586c60af648c06961221a7eaf8c859, "block_head"], "content" => [__TwigTemplate_712544c9008ab179e898ab48b6f69c483b586c60af648c06961221a7eaf8c859, "block_content"], "pageJs" => [__TwigTemplate_712544c9008ab179e898ab48b6f69c483b586c60af648c06961221a7eaf8c859, "block_pageJs"]])
Called from /path/to/httpdocs/vendor/craftcms/cms/src/web/twig/Template.php:52
24  __TwigTemplate_4e994cc5367055b091d48b770f56afdbf44ad62c879220c6de19951d32165abe::displayWithErrorHandling(["entry" => craft\elements\Entry, "variables" => ["entry" => craft\elements\Entry], "view" => craft\web\View, "devMode" => false, ...], ["head" => [__TwigTemplate_712544c9008ab179e898ab48b6f69c483b586c60af648c06961221a7eaf8c859, "block_head"], "content" => [__TwigTemplate_712544c9008ab179e898ab48b6f69c483b586c60af648c06961221a7eaf8c859, "block_content"], "pageJs" => [__TwigTemplate_712544c9008ab179e898ab48b6f69c483b586c60af648c06961221a7eaf8c859, "block_pageJs"]])
Called from /path/to/httpdocs/vendor/twig/twig/src/Template.php:380
23  __TwigTemplate_4e994cc5367055b091d48b770f56afdbf44ad62c879220c6de19951d32165abe::display(["entry" => craft\elements\Entry, "variables" => ["entry" => craft\elements\Entry], "view" => craft\web\View, "devMode" => false, ...], ["content" => [__TwigTemplate_712544c9008ab179e898ab48b6f69c483b586c60af648c06961221a7eaf8c859, "block_content"], "head" => [__TwigTemplate_712544c9008ab179e898ab48b6f69c483b586c60af648c06961221a7eaf8c859, "block_head"], "pageJs" => [__TwigTemplate_712544c9008ab179e898ab48b6f69c483b586c60af648c06961221a7eaf8c859, "block_pageJs"]])
Called from /path/to/httpdocs/vendor/craftcms/cms/src/web/twig/Template.php:34
22  __TwigTemplate_4e994cc5367055b091d48b770f56afdbf44ad62c879220c6de19951d32165abe::display(["entry" => craft\elements\Entry, "variables" => ["entry" => craft\elements\Entry], "view" => craft\web\View, "devMode" => false, ...], ["content" => [__TwigTemplate_712544c9008ab179e898ab48b6f69c483b586c60af648c06961221a7eaf8c859, "block_content"], "head" => [__TwigTemplate_712544c9008ab179e898ab48b6f69c483b586c60af648c06961221a7eaf8c859, "block_head"], "pageJs" => [__TwigTemplate_712544c9008ab179e898ab48b6f69c483b586c60af648c06961221a7eaf8c859, "block_pageJs"]])
Called from /path/to/httpdocs/storage/runtime/compiled_templates/d5/d5884e1e24dec7ff702d623116bb58998ad5dca6f03051643ac5ba0eea7f957f.php:48
21  __TwigTemplate_712544c9008ab179e898ab48b6f69c483b586c60af648c06961221a7eaf8c859::doDisplay(["entry" => craft\elements\Entry, "variables" => ["entry" => craft\elements\Entry], "view" => craft\web\View, "devMode" => false, ...], ["content" => [__TwigTemplate_712544c9008ab179e898ab48b6f69c483b586c60af648c06961221a7eaf8c859, "block_content"], "head" => [__TwigTemplate_712544c9008ab179e898ab48b6f69c483b586c60af648c06961221a7eaf8c859, "block_head"], "pageJs" => [__TwigTemplate_712544c9008ab179e898ab48b6f69c483b586c60af648c06961221a7eaf8c859, "block_pageJs"]])
Called from /path/to/httpdocs/vendor/twig/twig/src/Template.php:407
20  __TwigTemplate_712544c9008ab179e898ab48b6f69c483b586c60af648c06961221a7eaf8c859::displayWithErrorHandling(["entry" => craft\elements\Entry, "variables" => ["entry" => craft\elements\Entry], "view" => craft\web\View, "devMode" => false, ...], ["content" => [__TwigTemplate_712544c9008ab179e898ab48b6f69c483b586c60af648c06961221a7eaf8c859, "block_content"], "head" => [__TwigTemplate_712544c9008ab179e898ab48b6f69c483b586c60af648c06961221a7eaf8c859, "block_head"], "pageJs" => [__TwigTemplate_712544c9008ab179e898ab48b6f69c483b586c60af648c06961221a7eaf8c859, "block_pageJs"]])
Called from /path/to/httpdocs/vendor/craftcms/cms/src/web/twig/Template.php:52
19  __TwigTemplate_712544c9008ab179e898ab48b6f69c483b586c60af648c06961221a7eaf8c859::displayWithErrorHandling(["entry" => craft\elements\Entry, "variables" => ["entry" => craft\elements\Entry], "view" => craft\web\View, "devMode" => false, ...], ["content" => [__TwigTemplate_712544c9008ab179e898ab48b6f69c483b586c60af648c06961221a7eaf8c859, "block_content"], "head" => [__TwigTemplate_712544c9008ab179e898ab48b6f69c483b586c60af648c06961221a7eaf8c859, "block_head"], "pageJs" => [__TwigTemplate_712544c9008ab179e898ab48b6f69c483b586c60af648c06961221a7eaf8c859, "block_pageJs"]])
Called from /path/to/httpdocs/vendor/twig/twig/src/Template.php:380
18  __TwigTemplate_712544c9008ab179e898ab48b6f69c483b586c60af648c06961221a7eaf8c859::display(["entry" => craft\elements\Entry, "variables" => ["entry" => craft\elements\Entry]], [])
Called from /path/to/httpdocs/vendor/craftcms/cms/src/web/twig/Template.php:34
17  __TwigTemplate_712544c9008ab179e898ab48b6f69c483b586c60af648c06961221a7eaf8c859::display(["entry" => craft\elements\Entry, "variables" => ["entry" => craft\elements\Entry]])
Called from /path/to/httpdocs/vendor/twig/twig/src/Template.php:392
16  __TwigTemplate_712544c9008ab179e898ab48b6f69c483b586c60af648c06961221a7eaf8c859::render(["entry" => craft\elements\Entry, "variables" => ["entry" => craft\elements\Entry]], [])
Called from /path/to/httpdocs/vendor/twig/twig/src/TemplateWrapper.php:45
15  Twig\TemplateWrapper::render(["entry" => craft\elements\Entry, "variables" => ["entry" => craft\elements\Entry]])
Called from /path/to/httpdocs/vendor/twig/twig/src/Environment.php:318
14  craft\web\twig\Environment::render("improve-your-club/_topic", ["entry" => craft\elements\Entry, "variables" => ["entry" => craft\elements\Entry]])
Called from /path/to/httpdocs/vendor/craftcms/cms/src/web/View.php:343
13  craft\web\View::renderTemplate("improve-your-club/_topic", ["entry" => craft\elements\Entry, "variables" => ["entry" => craft\elements\Entry]])
Called from /path/to/httpdocs/vendor/craftcms/cms/src/web/View.php:393
12  craft\web\View::renderPageTemplate("improve-your-club/_topic", ["entry" => craft\elements\Entry, "variables" => ["entry" => craft\elements\Entry]])
Called from /path/to/httpdocs/vendor/craftcms/cms/src/web/Controller.php:166
11  craft\controllers\TemplatesController::renderTemplate("improve-your-club/_topic", ["entry" => craft\elements\Entry, "variables" => ["entry" => craft\elements\Entry]])
Called from /path/to/httpdocs/vendor/craftcms/cms/src/controllers/TemplatesController.php:78
10  craft\controllers\TemplatesController::actionRender("improve-your-club/_topic", ["entry" => craft\elements\Entry, "variables" => ["entry" => craft\elements\Entry]])
9   call_user_func_array([craft\controllers\TemplatesController, "actionRender"], ["improve-your-club/_topic", ["entry" => craft\elements\Entry]])
Called from /path/to/httpdocs/vendor/yiisoft/yii2/base/InlineAction.php:57
8   yii\base\InlineAction::runWithParams(["template" => "improve-your-club/_topic", "variables" => ["entry" => craft\elements\Entry], "p" => "improve-your-club/topic/technology/"])
Called from /path/to/httpdocs/vendor/yiisoft/yii2/base/Controller.php:157
7   craft\controllers\TemplatesController::runAction("render", ["template" => "improve-your-club/_topic", "variables" => ["entry" => craft\elements\Entry], "p" => "improve-your-club/topic/technology/"])
Called from /path/to/httpdocs/vendor/craftcms/cms/src/web/Controller.php:110
6   craft\controllers\TemplatesController::runAction("render", ["template" => "improve-your-club/_topic", "variables" => ["entry" => craft\elements\Entry], "p" => "improve-your-club/topic/technology/"])
Called from /path/to/httpdocs/vendor/yiisoft/yii2/base/Module.php:528
5   craft\web\Application::runAction("templates/render", ["template" => "improve-your-club/_topic", "variables" => ["entry" => craft\elements\Entry], "p" => "improve-your-club/topic/technology/"])
Called from /path/to/httpdocs/vendor/craftcms/cms/src/web/Application.php:297
4   craft\web\Application::runAction("templates/render", ["template" => "improve-your-club/_topic", "variables" => ["entry" => craft\elements\Entry], "p" => "improve-your-club/topic/technology/"])
Called from /path/to/httpdocs/vendor/yiisoft/yii2/web/Application.php:103
3   craft\web\Application::handleRequest(craft\web\Request)
Called from /path/to/httpdocs/vendor/craftcms/cms/src/web/Application.php:286
2   craft\web\Application::handleRequest(craft\web\Request)
Called from /path/to/httpdocs/vendor/yiisoft/yii2/base/Application.php:386
1   craft\web\Application::run()
Called from /path/to/httpdocs/siteroot/index.php:48
1

I've run into something similar before and usually what I have to do is dig into the compiled_templates folder and look in the file(s) that are mentioned in the stack trace to get an idea of which bit of code it's complaining about.

From your stack trace, I'd try looking at line 52 of storage/runtime/compiled_templates/38/38acd345bac4f191994499bfe7e62d331a84af06b5a4ace739819932939d6058.php and then find the Twig template that contains the compiled PHP you're seeing in that file.

  • Perfect - found and fixed – CreateSean Sep 25 at 13:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.