What happened?
Description
It seems that any use of ownerId results in an Invalid numeric value message. And this issue, for me, started after the upgrade to 5.6.2. My guess is that it has to do with changes to /src/base/NestedElementTrait.php as part of this latest release.
Likely related to #16572 and #16570.
Steps to reproduce
$entries = craft\elements\Entry::find()->limit( 150 )->all();
foreach ( $entries as &$entry ) {
echo "$entry->title ($entry->id) ($entry->ownerId)\n";
}
Expected behavior
A list of entries in the format <title> (<id>) (<ownerId>).
Actual behavior
Exception 'yii\base\InvalidArgumentException' with message '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('elements.id', Array, '=', false, 'integer')
#1 /var/www/html/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1662): craft\helpers\Db::parseNumericParam('elements.id', Array)
#2 /var/www/html/vendor/yiisoft/yii2/db/QueryBuilder.php(227): craft\elements\db\ElementQuery->prepare(Object(craft\db\mysql\QueryBuilder))
#3 /var/www/html/vendor/yiisoft/yii2/db/Query.php(157): yii\db\QueryBuilder->build(Object(craft\elements\db\EntryQuery))
#4 /var/www/html/vendor/yiisoft/yii2/db/Query.php(249): yii\db\Query->createCommand(Object(craft\db\Connection))
#5 /var/www/html/vendor/craftcms/cms/src/db/Query.php(292): yii\db\Query->all(NULL)
#6 /var/www/html/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1848): craft\db\Query->all(NULL)
#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('craft\\elements\\...', Array, Array)
#9 /var/www/html/vendor/craftcms/cms/src/base/NestedElementTrait.php(170): craft\services\Elements->eagerLoadElements('craft\\elements\\...', Array, Array)
#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(false)
#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(5422): craft\elements\Entry->getFieldLayout()
#16 /var/www/html/vendor/craftcms/cms/src/base/Element.php(5312): craft\base\Element->providerHandle()
#17 /var/www/html/vendor/craftcms/cms/src/base/Element.php(2523): craft\base\Element->hasEagerLoadedElements('ownerId')
#18 /var/www/html/modules/custom/console/controllers/JobController.php(27): craft\base\Element->__get('ownerId')
#19 [internal function]: modules\custom\console\controllers\JobController->actionExecute()
#20 /var/www/html/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#21 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#22 /var/www/html/vendor/yiisoft/yii2/console/Controller.php(180): yii\base\Controller->runAction('execute', Array)
#23 /var/www/html/vendor/yiisoft/yii2/base/Module.php(552): yii\console\Controller->runAction('execute', Array)
#24 /var/www/html/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('custom/job/exec...', Array)
#25 /var/www/html/vendor/craftcms/cms/src/console/Application.php(91): yii\console\Application->runAction('custom/job/exec...', Array)
#26 /var/www/html/vendor/yiisoft/yii2/console/Application.php(147): craft\console\Application->runAction('custom/job/exec...', Array)
#27 /var/www/html/vendor/craftcms/cms/src/console/Application.php(122): yii\console\Application->handleRequest(Object(craft\console\Request))
#28 /var/www/html/vendor/yiisoft/yii2/base/Application.php(384): craft\console\Application->handleRequest(Object(craft\console\Request))
#29 /var/www/html/craft(13): yii\base\Application->run()
#30 {main}
Failed to run craft custom/job/execute: exit status 1
Craft CMS version
5.6.2
PHP version
8.2.24
Operating system and version
Linux 5.15.167.4-microsoft-standard-WSL2
Database type and version
MySQL 8.0.36
Image driver and version
Imagick 3.7.0 (ImageMagick 6.9.11-60)
Installed plugins and versions
- Calendar 5.0.13
- Forms 5.9.2
- Navigation 3.0.5
- Redactor 4.2.0
- Retour 5.0.6
What happened?
Description
It seems that any use of
ownerIdresults in anInvalid numeric valuemessage. And this issue, for me, started after the upgrade to 5.6.2. My guess is that it has to do with changes to/src/base/NestedElementTrait.phpas part of this latest release.Likely related to #16572 and #16570.
Steps to reproduce
Expected behavior
A list of entries in the format
<title> (<id>) (<ownerId>).Actual behavior
Craft CMS version
5.6.2
PHP version
8.2.24
Operating system and version
Linux 5.15.167.4-microsoft-standard-WSL2
Database type and version
MySQL 8.0.36
Image driver and version
Imagick 3.7.0 (ImageMagick 6.9.11-60)
Installed plugins and versions