Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.6.2]: "Invalid numeric value" error in template #16572

Closed
thupsi opened this issue Jan 29, 2025 · 3 comments
Closed

[5.6.2]: "Invalid numeric value" error in template #16572

thupsi opened this issue Jan 29, 2025 · 3 comments
Assignees
Labels

Comments

@thupsi
Copy link

thupsi commented Jan 29, 2025

What happened?

Description

After updating a site from 5.6.0.2 to 5.6.2 there's an error thrown in some of my templates:

yii\base\InvalidArgumentException: Invalid numeric value:  in /var/www/html/vendor/craftcms/cms/src/helpers/Db.php:621
Stack trace:
#0 /var/www/html/vendor/craftcms/cms/src/helpers/Db.php(891): craft\helpers\Db::parseParam()
#1 /var/www/html/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1662): craft\helpers\Db::parseNumericParam()
#2 /var/www/html/vendor/yiisoft/yii2/db/QueryBuilder.php(227): craft\elements\db\ElementQuery->prepare()
#3 /var/www/html/vendor/yiisoft/yii2/db/Query.php(157): yii\db\QueryBuilder->build()
#4 /var/www/html/vendor/yiisoft/yii2/db/Query.php(249): yii\db\Query->createCommand()
#5 /var/www/html/vendor/craftcms/cms/src/db/Query.php(292): yii\db\Query->all()
#6 /var/www/html/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1848): craft\db\Query->all()
#7 /var/www/html/vendor/craftcms/cms/src/services/Elements.php(3304): craft\elements\db\ElementQuery->all()
#8 /var/www/html/vendor/craftcms/cms/src/services/Elements.php(3180): craft\services\Elements->_eagerLoadElementsInternal()
#9 /var/www/html/vendor/craftcms/cms/src/base/NestedElementTrait.php(170): craft\services\Elements->eagerLoadElements()
#10 /var/www/html/vendor/craftcms/cms/src/base/NestedElementTrait.php(236): craft\elements\Entry->getPrimaryOwner()
#11 /var/www/html/vendor/craftcms/cms/src/base/NestedElementTrait.php(302): craft\elements\Entry->getOwner()
#12 /var/www/html/vendor/craftcms/cms/src/elements/Entry.php(1488): craft\elements\Entry->getField()
#13 /var/www/html/vendor/craftcms/cms/src/elements/Entry.php(1529): craft\elements\Entry->getAvailableEntryTypes()
#14 /var/www/html/vendor/craftcms/cms/src/elements/Entry.php(1410): craft\elements\Entry->getType()
#15 /var/www/html/vendor/craftcms/cms/src/base/Element.php(1711): craft\elements\Entry->getFieldLayout()
#16 [internal function]: craft\base\Element::craft\base\{closure}()
#17 /var/www/html/vendor/craftcms/cms/src/base/Element.php(1710): array_filter()
#18 /var/www/html/vendor/craftcms/cms/src/base/NestedElementTrait.php(60): craft\base\Element::eagerLoadingMap()
#19 /var/www/html/vendor/craftcms/cms/src/elements/Entry.php(732): craft\elements\Entry::traitEagerLoadingMap()
#20 /var/www/html/vendor/craftcms/cms/src/services/Elements.php(3218): craft\elements\Entry::eagerLoadingMap()
#21 /var/www/html/vendor/craftcms/cms/src/services/Elements.php(3180): craft\services\Elements->_eagerLoadElementsInternal()
#22 /var/www/html/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1805): craft\services\Elements->eagerLoadElements()
#23 /var/www/html/vendor/craftcms/cms/src/elements/db/EntryQuery.php(948): craft\elements\db\ElementQuery->afterPopulate()
#24 /var/www/html/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1776): craft\elements\db\EntryQuery->afterPopulate()
#25 /var/www/html/vendor/yiisoft/yii2/db/Query.php(251): craft\elements\db\ElementQuery->populate()
#26 /var/www/html/vendor/craftcms/cms/src/db/Query.php(292): yii\db\Query->all()
#27 /var/www/html/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1848): craft\db\Query->all()
#28 /var/www/html/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1857): craft\elements\db\ElementQuery->all()
#29 /var/www/html/vendor/twig/twig/src/Extension/CoreExtension.php(1861): craft\elements\db\ElementQuery->collect()
#30 /var/www/html/vendor/craftcms/cms/src/helpers/Template.php(148): Twig\Extension\CoreExtension::getAttribute()
#31 /var/www/html/storage/runtime/compiled_templates/38/3888320676199db1a4fa214d1d0eccae.php(431): craft\helpers\Template::attribute()
#32 /var/www/html/vendor/twig/twig/src/Template.php(431): __TwigTemplate_65afdaa499a57b46ad8bb9362b5b9eb4->block_content()
#33 /var/www/html/storage/runtime/compiled_templates/fe/fef15792cc0876b692c6b94cd06b14c7.php(331): Twig\Template->yieldBlock()
#34 /var/www/html/vendor/twig/twig/src/Template.php(387): __TwigTemplate_c66e757c3619fcfbdfde127ad4cf3cf3->doDisplay()
#35 /var/www/html/storage/runtime/compiled_templates/38/3888320676199db1a4fa214d1d0eccae.php(52): Twig\Template->yield()
#36 /var/www/html/vendor/twig/twig/src/Template.php(387): __TwigTemplate_65afdaa499a57b46ad8bb9362b5b9eb4->doDisplay()
#37 /var/www/html/vendor/twig/twig/src/Template.php(343): Twig\Template->yield()
#38 /var/www/html/vendor/twig/twig/src/Template.php(358): Twig\Template->display()
#39 /var/www/html/vendor/twig/twig/src/TemplateWrapper.php(35): Twig\Template->render()
#40 /var/www/html/vendor/twig/twig/src/Environment.php(320): Twig\TemplateWrapper->render()
#41 /var/www/html/vendor/craftcms/cms/src/web/View.php(576): Twig\Environment->render()
#42 /var/www/html/vendor/craftcms/cms/src/web/View.php(629): craft\web\View->renderTemplate()
#43 /var/www/html/vendor/craftcms/cms/src/web/TemplateResponseFormatter.php(57): craft\web\View->renderPageTemplate()
#44 /var/www/html/vendor/yiisoft/yii2/web/Response.php(1109): craft\web\TemplateResponseFormatter->format()
#45 /var/www/html/vendor/craftcms/cms/src/web/Response.php(341): yii\web\Response->prepare()
#46 /var/www/html/vendor/yiisoft/yii2/web/Response.php(340): craft\web\Response->prepare()
#47 /var/www/html/vendor/yiisoft/yii2/base/Application.php(390): yii\web\Response->send()
#48 /var/www/html/web/index.php(12): yii\base\Application->run()
#49 {main}

Steps to reproduce

I'm not sure if this is the case for all problematic templates but at least on two of them the error is displayed when I'm trying to fetch entries with the value of a custom lightswitch field set to false.

Simplified example:

{% set articles = craft.entries.relatedTo({element: category, field: 'articleCategory'}) %}
{% set notFeaturedPosts = articles.isFeatured(false) %}
{% for entry in notFeaturedPosts.collect() %}
    {% include 'partials/entry-teaser' %}
{% endfor %}

Probably related: #16570

Craft CMS version

5.6.2

PHP version

8.3.16

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

@thupsi thupsi added the bug label Jan 29, 2025
@i-just
Copy link
Contributor

i-just commented Jan 29, 2025

Hi, thanks for getting in touch! I’m not able to replicate this with the info you provided.

Do you have any plugins or modules installed? If yes, do you still get this error after turning on safeMode? If not, can you share a bit more about the setup of the entries you see this with?

@i-just
Copy link
Contributor

i-just commented Jan 29, 2025

Actually, don’t worry about that. I think I can reproduce it now. Working on a fix.

@brandonkelly
Copy link
Member

Craft 5.6.3 is out with a fix for this. Thanks for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants