craftcms / cms

Build bespoke content experiences with Craft.
https://craftcms.com
Other
3.22k stars 626 forks source link

[5.x]: Unsupported operand types: array + string #15656

Closed williamhibberd closed 2 weeks ago

williamhibberd commented 2 weeks ago

What happened?

Description

When adjusting a lightswitch field setting, on entry save I get the following error:

TypeError: Unsupported operand types: array + string in /var/www/html/vendor/craftcms/cms/src/services/Elements.php:3761
Stack trace:
#0 /var/www/html/vendor/craftcms/cms/src/services/Elements.php(1220): craft\services\Elements->craft\services\{closure}()
#1 /var/www/html/vendor/craftcms/cms/src/services/Elements.php(3594): craft\services\Elements->ensureBulkOp()
#2 /var/www/html/vendor/craftcms/cms/src/services/Elements.php(1306): craft\services\Elements->_saveElementInternal()
#3 /var/www/html/vendor/craftcms/cms/src/controllers/ElementsController.php(1233): craft\services\Elements->saveElement()
#4 [internal function]: craft\controllers\ElementsController->actionSave()
#5 /var/www/html/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array()
#6 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams()
#7 /var/www/html/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction()
#8 /var/www/html/vendor/craftcms/cms/src/web/Application.php(350): yii\base\Module->runAction()
#9 /var/www/html/vendor/craftcms/cms/src/web/Application.php(649): craft\web\Application->runAction()
#10 /var/www/html/vendor/craftcms/cms/src/web/Application.php(312): craft\web\Application->_processActionRequest()
#11 /var/www/html/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest()
#12 /var/www/html/web/index.php(12): yii\base\Application->run()
#13 {main}

Craft CMS version

5.4.0.1

PHP version

8.3

Operating system and version

No response

Database type and version

mariadb 10.3

Image driver and version

No response

Installed plugins and versions

"craftcms/ckeditor": "^4.0.3", "craftcms/cms": "^5.0.0", "craftcms/contact-form": "^3.1.0", "craftcms/contact-form-honeypot": "^2.1.0", "craftcms/google-cloud": "^2.2.0", "craftcms/mailgun": "^3.1.0", "craftpulse/craft-colour-swatches": "^5.0.2", "hybridinteractive/craft-contact-form-extensions": "^5.0.0", "mmikkel/cp-field-inspect": "^2.0.1", "nystudio107/craft-retour": "^5.0.3", "nystudio107/craft-seomatic": "^5.1.1", "nystudio107/craft-vite": "^5.0.0-beta.3", "putyourlightson/craft-elements-panel": "^3.0.0-beta.1", "putyourlightson/craft-sherlock": "^5.0.0-beta.3", "putyourlightson/craft-sprig": "^3.0.0", "spacecatninja/imager-x": "^5.0.0-beta.2", "spacecatninja/imager-x-imageboss-transformer": "^3.0.0", "verbb/expanded-singles": "^3.0.0-beta.2", "verbb/hyper": "2.0.4", "verbb/image-resizer": "^4.0.0-beta.1", "vlucas/phpdotenv": "^5.4.0"

i-just commented 2 weeks ago

Hi, thanks for getting in touch! It looks like you’re on a version of MariaDB that is below the minimum required version. Please upgrade to at least 10.4.6 and try again - it should then work as expected.

williamhibberd commented 2 weeks ago

Thanks for your time @i-just. I have just upgraded to mariadb 10.4 and am still having the issue. The issue is also happening on staging which is using MySQL 8.0.39.

i-just commented 2 weeks ago

I could only replicate this on MariaDB 10.3, not 10.4 or MySQL 8.0. That being said, it looks like someone has written to support regarding this issue, so we’re looking into it from there.

brandonkelly commented 2 weeks ago

I believe I Just fixed this for the next release.

@williamhibberd If you want to test, change your craftcms/cms requirement to 5.x-dev as 5.4.0.1 in composer.json, and run composer update.

williamhibberd commented 2 weeks ago

Thank you @brandonkelly, that works for me.

brandonkelly commented 2 weeks ago

Thanks for testing! Just released 5.4.1 with that fix.