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

Craft 4.0 - Cannot assign string to property $imageId of type ?array #57

Closed
davidwebca opened this issue May 9, 2022 · 1 comment
Closed
Labels

Comments

@davidwebca
Copy link
Contributor

Describe the bug

I've just upgraded to Craft 4.0 and I can't access to the panel to edit a recipe.

To reproduce

Steps to reproduce the behaviour:

  1. Upgrade an existing Craft 3.7.x website to 4.0
  2. Navigate to your recipe entries
  3. See "Cannot assign string to property $imageId ..." error message (see below)

Expected behaviour

Being able to access the admin panel to edit the recipe.

Versions

  • Plugin version: 4.0.0-beta.3
  • Craft version: 4.0.0-beta.1

Stack trace

TypeError: Cannot assign string to property nystudio107\recipe\models\Recipe::$imageId of type ?array in vendor/nystudio107/craft-recipe/src/fields/Recipe.php:142
Stack trace:
#0 vendor/craftcms/cms/src/fieldlayoutelements/CustomField.php(257): nystudio107\recipe\fields\Recipe->getInputHtml(Object(nystudio107\recipe\models\Recipe), Object(craft\elements\Entry))
#1 vendor/craftcms/cms/src/fieldlayoutelements/BaseField.php(215): craft\fieldlayoutelements\CustomField->inputHtml(Object(craft\elements\Entry), false)
#2 vendor/craftcms/cms/src/fieldlayoutelements/CustomField.php(210): craft\fieldlayoutelements\BaseField->formHtml(Object(craft\elements\Entry), false)
#3 vendor/craftcms/cms/src/web/View.php(1544): craft\fieldlayoutelements\CustomField->craft\fieldlayoutelements\{closure}()
#4 vendor/craftcms/cms/src/fieldlayoutelements/CustomField.php(211): craft\web\View->namespaceInputs(Object(Closure), 'fields')
#5 vendor/craftcms/cms/src/models/FieldLayout.php(681): craft\fieldlayoutelements\CustomField->formHtml(Object(craft\elements\Entry), false)
#6 vendor/craftcms/cms/src/web/View.php(1539): craft\models\FieldLayout->craft\models\{closure}()
#7 vendor/craftcms/cms/src/models/FieldLayout.php(680): craft\web\View->namespaceInputs(Object(Closure), NULL)
#8 vendor/craftcms/cms/src/controllers/ElementsController.php(717): craft\models\FieldLayout->createForm(Object(craft\elements\Entry), false, Array)
#9 vendor/craftcms/cms/src/controllers/ElementsController.php(426): craft\controllers\ElementsController->_prepareEditor(Object(craft\elements\Entry), true, Object(craft\web\Response), 'main-form', Object(Closure), Object(Closure), Object(Closure))
#10 [internal function]: craft\controllers\ElementsController->craft\controllers\{closure}(Object(craft\web\Response), 'main-form')
#11 vendor/craftcms/cms/src/web/CpScreenResponseFormatter.php(108): call_user_func(Object(Closure), Object(craft\web\Response), 'main-form')
#12 vendor/craftcms/cms/src/web/CpScreenResponseFormatter.php(48): craft\web\CpScreenResponseFormatter->_formatTemplate(Object(craft\web\Response), Object(craft\web\CpScreenResponseBehavior))
#13 vendor/yiisoft/yii2/web/Response.php(1095): craft\web\CpScreenResponseFormatter->format(Object(craft\web\Response))
#14 vendor/craftcms/cms/src/web/Response.php(275): yii\web\Response->prepare()
#15 vendor/yiisoft/yii2/web/Response.php(339): craft\web\Response->prepare()
#16 vendor/yiisoft/yii2/base/Application.php(390): yii\web\Response->send()
#17 web/index.php(22): yii\base\Application->run()
#18 {main}
@davidwebca davidwebca added the bug label May 9, 2022
khalwat added a commit that referenced this issue May 9, 2022
Mark $imageId as mixed to prevent typing errors. Closes #57.
khalwat pushed a commit that referenced this issue May 9, 2022
…ray` when they should have been typed as `?int`, causing a type error to be thrown ((#57)[#57])
@khalwat
Copy link
Contributor

khalwat commented May 9, 2022

Fixed in 4.0.0 -> https://github.com/nystudio107/craft-recipe/releases/tag/4.0.0

@khalwat khalwat closed this as completed May 9, 2022
khalwat pushed a commit that referenced this issue May 9, 2022
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