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

[4.7.2]: Exception 'TypeError' with message 'strtolower(): Argument #1 ($string) must be of type string, array given' #14326

Closed
boboldehampsink opened this issue Feb 8, 2024 · 2 comments

Comments

@boboldehampsink
Copy link
Contributor

What happened?

Description

When updating from Craft 4.7.1 to 4.7.2 the following error is showing up:


2024-02-08 02:16:34 CEST | Exception 'TypeError' with message 'strtolower(): Argument #1 ($string) must be of type string, array given'
-- | --
  | 2024-02-08 02:16:34 CEST |  
  | 2024-02-08 02:16:34 CEST | in /app/user/vendor/craftcms/cms/src/fields/BaseOptionsField.php:326
  | 2024-02-08 02:16:34 CEST |  
  | 2024-02-08 02:16:34 CEST | Stack trace:
  | 2024-02-08 02:16:34 CEST | #0 /app/user/vendor/craftcms/cms/src/fields/BaseOptionsField.php(326): strtolower(Array)
  | 2024-02-08 02:16:34 CEST | #1 /app/user/vendor/craftcms/cms/src/base/Element.php(5339): craft\fields\BaseOptionsField->normalizeValue(Array, Object(craft\elements\Entry))
  | 2024-02-08 02:16:34 CEST | #2 /app/user/vendor/craftcms/cms/src/base/Element.php(4173): craft\base\Element->normalizeFieldValue('regionsNl')
  | 2024-02-08 02:16:34 CEST | #3 /app/user/vendor/craftcms/cms/src/base/Element.php(2180): craft\base\Element->getFieldValue('regionsNl')
  | 2024-02-08 02:16:34 CEST | #4 /app/user/vendor/yiisoft/yii2/validators/Validator.php(306): craft\base\Element->__get('field:regionsNl')
  | 2024-02-08 02:16:34 CEST | #5 /app/user/vendor/craftcms/cms/src/base/Element.php(2488): yii\validators\Validator->validateAttribute(Object(craft\elements\Entry), 'field:regionsNl')
  | 2024-02-08 02:16:34 CEST | #6 /app/user/vendor/yiisoft/yii2/base/Model.php(370): craft\base\Element->afterValidate()
  | 2024-02-08 02:16:34 CEST | #7 /app/user/vendor/craftcms/cms/src/base/Element.php(2458): yii\base\Model->validate(Array, true)
  | 2024-02-08 02:16:34 CEST | #8 /app/user/vendor/craftcms/cms/src/services/Elements.php(3268): craft\base\Element->validate(NULL)
  | 2024-02-08 02:16:34 CEST | #9 /app/user/vendor/craftcms/cms/src/services/Elements.php(1106): craft\services\Elements->_saveElementInternal(Object(craft\elements\Entry), true, true, false, Array, false, false)
  | 2024-02-08 02:16:34 CEST | #10 /app/user/vendor/craftcms/cms/src/test/fixtures/elements/BaseElementFixture.php(154): craft\services\Elements->saveElement(Object(craft\elements\Entry), true, true, false)
  | 2024-02-08 02:16:34 CEST | #11 /app/user/vendor/craftcms/cms/src/test/fixtures/elements/BaseElementFixture.php(84): craft\test\fixtures\elements\BaseElementFixture->saveElement(Object(craft\elements\Entry))
  | 2024-02-08 02:16:34 CEST | #12 /app/user/vendor/yiisoft/yii2/test/FixtureTrait.php(96): craft\test\fixtures\elements\BaseElementFixture->load()
  | 2024-02-08 02:16:34 CEST | #13 /app/user/vendor/yiisoft/yii2/console/controllers/FixtureController.php(160): yii\console\controllers\FixtureController->loadFixtures(Array)


Steps to reproduce

  1. This happens when loading a checkboxes field via fixtures. The fixture looks like this:

'regionsNl' => ['overijssel', 'duitsland'],

Expected behavior

This used to work before 4.7.2

Actual behavior

Throws error on 4.7.2

Craft CMS version

4.7.2

PHP version

8.3.2

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

@boboldehampsink
Copy link
Contributor Author

Also just showing up when adding entries

image

@brandonkelly
Copy link
Member

Thanks for reporting that! We just tagged 4.7.2.1 with a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants