craftcms / cms

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

[4.x]: Field type checkboxes throws error when saving #14340

Closed MatthiasBrodelet closed 7 months ago

MatthiasBrodelet commented 7 months ago

What happened?

Description

I have a Product Type in Craft Commerce that contains a field of type Checkboxes. This field contains 3 options of which 2 are by default selected. When I try to save the product I get the following error: strtolower(): Argument #1 ($string) must be of type string, array given.

I'm pretty sure the checkboxes are the reason for the problem because when I remove them from the product type entry I can save the product without issues. Also the base64 values in the error match the values of the checkboxes. More info can be found in the attached screenshots.

Steps to reproduce

  1. Create a checkbox field
  2. Add it to a product type entry
  3. Try to save the product

Expected behavior

The product should save without errors on the checkboxes.

Actual behavior

The product can't be saved.

Screenshot 2024-02-09 at 14 49 16

Screenshot 2024-02-09 at 14 52 37

Craft CMS version

4.7.2

PHP version

8.1.18

Operating system and version

Linux 6.3.13-linuxkit

Database type and version

MySQL 5.7.29

Image driver and version

Imagick 3.7.0 (ImageMagick 6.9.11-60)

Installed plugins and versions

i-just commented 7 months ago

Hi, thanks for reaching out! This was previously reported here: https://github.com/craftcms/cms/issues/14326 and fixed in 4.7.2.1. If you update to that version, it should start working as expected.