craftcms / cms

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

[5.x]: 0 added to all empty fields #15231

Closed funkysoul closed 3 months ago

funkysoul commented 3 months ago

What happened?

Description

Since upgrading to 5.2.0 every empty field in the CMS itself receives a 0 resulting in saving the 0 in unwanted places I've noticed that while upgrading to 5.2.x the Yii Framework got updated too. (see attachment) – i assume it could have something with the "new" way they handle "select()"

Steps to reproduce

  1. Update to 5.2.0
  2. not much done else

Expected behavior

  1. well don't save empty fields as "0" ;-)

Actual behavior

Screenshot 2024-06-19 at 14 52 56

CraftCMS 5.1.10 5 1 10

CraftCMS 5.2.x 5 2 x

Craft CMS version

5.2.X

PHP version

8.3

Operating system and version

OSX 14.5 (Sonoma)

Database type and version

MySQL 8.x

Image driver and version

No response

Installed plugins and versions

Doesnt matter if there are plugins or not.. (i've removed all plugins to test)

brandonkelly commented 3 months ago

I’m not able to reproduce. Can you provide more details?

funkysoul commented 3 months ago
brandonkelly commented 3 months ago

We found a site where we can reproduce this. Looks like it started in 5.2.0-beta.1. Looking into it…

brandonkelly commented 3 months ago

Tracked this down to an unreleased Yii change (https://github.com/yiisoft/yii2/issues/20198). I’ve replied to the PR requesting them to revert since it’s a breaking change.

Since it’s unreleased, the only way you’d be affected by it is if yiisoft/yii2 is getting pulled in at dev-master rather than the latest stable 2.0.50.x release. That can happen if you have minimum-stability set to dev in composer.json, but not prefer-stable: true. To fix, add the following line to composer.json:

"prefer-stable": true,

Then run composer update.