craftcms / cms

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

[5.x]: createElement returns 'content' as 'Array' instead of JSON #15616

Closed ferventdigital closed 1 month ago

ferventdigital commented 2 months ago

What happened?

Description

After following all the steps given in: https://craftcms.com/docs/5.x/upgrade.html The CMS returns a Syntax error regarding JSON. I did some small debugging and found that all element content gets returned as the string 'Array' instead of a JSON structure when it tries to create elements in the createElement function (vendor/craftcms/cms/src/elements/db/ElementQuery.php)

What could cause this? And is this something from our side or is it a bug inside Craft?

We dont have any modules or other custom code that interacts with Craft fields and/or content

Steps to reproduce

Not completely sure this can be reproduced

  1. Install a Craft CMS 4 installation with the latest versions and Redactor
  2. Create different type of fields such as Matrix, Super Table, Redactor etc.
  3. Migrate redactor to CKEditor
  4. Perform Craft update as shown on the upgrade page in the docs

Expected behavior

Elements that return JSON in 'content' inside the createElement function

Actual behavior

Elements return the string 'Array' in 'content' inside the createElement function

Craft CMS version

5.3.6

PHP version

8.3.8

Operating system and version

macOS Sonoma 14.6.1 (Craft is hosted using MAMP)

Database type and version

MariaDB 10.3.32 (We are aware it is below the "required" version, however we have clean Craft CMS 5 installs running on this version without problems)

Image driver and version

-

Installed plugins and versions

- "cooltronicpl/varnishcache": "^2.7.2", "craftcms/ckeditor": "4.2.0", "craftcms/cms": "^5.0.0", "craftcms/redactor": "^4.1.0", "elleracompany/craft-cookie-consent": "^5.0.1", "ether/seo": "5.0.0-rc5", "ether/simplemap": "^5.0.1", "ostark/craft-async-queue": "^4.0.0", "ostark/craft-relax": "^2.1.0", "putyourlightson/craft-sprig": "3.4.0", "verbb/field-manager": "4.0.2", "verbb/formie": "3.0.3", "verbb/navigation": "3.0.3", "verbb/super-table": "^4.0.2", "vlucas/phpdotenv": "^3.4.0" "craftcms/generator": "^2.1.0", "yiisoft/yii2-shell": "^2.0.51"

    Custom plugins had been installed but disabled for the upgrade, none of these plugins does anything with Craft fields and or content. Unless a plugin for custom Formie fields is seen as such. 
brandonkelly commented 2 months ago

Not really sure what to make of this. Any chance you can send your Composer files and a Craft 4 database backup into support@craftcms.com so we can try to reproduce on our end?

ferventdigital commented 2 months ago

We have send an email with the files

brandonkelly commented 1 month ago

MariaDB 10.3.32 (We are aware it is below the "required" version, however we have clean Craft CMS 5 installs running on this version without problems)

@ferventdigital I missed this. Please upgrade Maria to at least 10.4.6 and try again. The requirements are set for a reason, and Maria’s JSON support has gotten better in recent versions so it would make sense that you are getting weird behavior on older versions.