Getting the following exception whenever I try to save an entry with one or more rows in a matrix field:
yii\base\ErrorException: Undefined property: craft\elements\db\MatrixBlockQuery::$criteria in /vendor/yiisoft/yii2/base/ArrayableTrait.php:126
Stack trace:
#0 /vendor/craftcms/cms/src/web/ErrorHandler.php(76): yii\base\ErrorHandler->handleError(8, 'Undefined prope...', '...', 126)
#1 /vendor/yiisoft/yii2/base/ArrayableTrait.php(126): craft\web\ErrorHandler->handleError(8, 'Undefined prope...', '...', 126, Array)
#2 /vendor/craftcms/cms/src/elements/db/ElementQuery.php(1638): craft\elements\db\ElementQuery->toArray(Array, Array, false)
#3 /vendor/yiisoft/yii2/base/Component.php(139): craft\elements\db\ElementQuery->getCriteria()
#4 /vendor/craftcms/cms/src/elements/db/ElementQuery.php(512): yii\base\Component->__get('criteria')
#5 /vendor/yiisoft/yii2/base/ArrayableTrait.php(126): craft\elements\db\ElementQuery->__get('criteria')
#6 /vendor/craftcms/cms/src/elements/db/ElementQuery.php(1638): craft\elements\db\ElementQuery->toArray(Array, Array, false)
#7 /vendor/craftcms/cms/src/elements/db/ElementQuery.php(1611): craft\elements\db\ElementQuery->getCriteria()
#8 /vendor/craftcms/cms/src/fields/Matrix.php(501): craft\elements\db\ElementQuery->setCachedResult(Array)
#9 /vendor/craftcms/cms/src/base/Element.php(3345): craft\fields\Matrix->normalizeValue(Array, Object(craft\elements\Entry))
#10 /vendor/craftcms/cms/src/base/Element.php(2788): craft\base\Element->normalizeFieldValue('body')
#11 /vendor/craftcms/cms/src/controllers/EntryRevisionsController.php(430): craft\base\Element->setFieldValuesFromRequest('fields')
#12 [internal function]: craft\controllers\EntryRevisionsController->actionPublishDraft()
#13 /vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#14 /vendor/yiisoft/yii2/base/Controller.php(180): yii\base\InlineAction->runWithParams(Array)
#15 /vendor/craftcms/cms/src/web/Controller.php(190): yii\base\Controller->runAction('publish-draft', Array)
#16 /vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('publish-draft', Array)
#17 /vendor/craftcms/cms/src/web/Application.php(274): yii\base\Module->runAction('entry-revisions...', Array)
#18 /vendor/craftcms/cms/src/web/Application.php(577): craft\web\Application->runAction('entry-revisions...', Array)
#19 /vendor/craftcms/cms/src/web/Application.php(253): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#20 /vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#21 /web/index.php(27): yii\base\Application->run()
#22 {main}
I tried rolling back to 3.5.16 where the entry gets saved as you would expect. The problem only occurs on 3.5.17.*.
Do you happen to have a custom field with the handle criteria?
Was able to reproduce with a Matrix field named criteria. Fixed now for the next release.
To get the fix early, change your craftcms/cms requirement in composer.json to:
"require": {
"craftcms/cms": "dev-develop as 3.5.17.1",
"...": "..."
}
Then run composer update.
Yes, there was a matrix block with the handle criteria which also had a custom field with the handle criteria. Missed reporting that 😁. This fixed the bug! Thanks Brandon.
Craft 3.5.18 is out now with that fix ✨