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

Cannot save an entry with a Matrix row in 3.5.17.1 #7335

Closed
rungta opened this issue Dec 25, 2020 · 4 comments
Closed

Cannot save an entry with a Matrix row in 3.5.17.1 #7335

rungta opened this issue Dec 25, 2020 · 4 comments
Labels

Comments

@rungta
Copy link

rungta commented Dec 25, 2020

Description

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.*.

Steps to reproduce

  1. Create an entry type with a matrix field
  2. Create a new entry, add a row to the matrix field
  3. Save the new entry

Additional info

  • Craft version: 3.5.17.1
  • PHP version: 7.1.19
  • Database driver & version: MySQL 5.7.17
@rungta rungta added the bug label Dec 25, 2020
@brandonkelly
Copy link
Member

Do you happen to have a custom field with the handle criteria?

@brandonkelly
Copy link
Member

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.

@rungta
Copy link
Author

rungta commented Dec 31, 2020

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.

@brandonkelly
Copy link
Member

Craft 3.5.18 is out now with that fix ✨

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

2 participants