craftcms / craftcms/cms

Adding an emoji to a field layout Tip element causes broken JSON in the craft_fieldlayouttabs table

Open
#7,677 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PHP
Stars
3.6k
Forks
705
Avg merge
1d 5h
Merged PRs (30d)
134

Description

Description

Adding an emoji to a field layout Tip element and saving the field layout causes broken JSON in the elements column in the relevant craft_fieldlayouttabs table. Specifically, it appears that the JSON string is simply cut off, from the position where the emoji would be. See example broken JSON here.

Since the JSON is now invalid, attempting to render the relevant edit page for the field layout triggers an InvalidArgumentException (example stack trace for that error is here).

Steps to reproduce
  1. Add a Tip element to a field layout, and add an emoji like 😉 to it
  2. Save the field layout. It should save without any errors or exceptions
  3. Navigate to the edit page using that layout. Get an InvalidArgumentException
  4. Confirm that the JSON in the craft_fieldlayouttabs table is now truncated and invalid
Additional info

Only tested locally on macOS 10.14.6 using Valet.

  • Craft version: 3.6.10
  • PHP version: 7.4.13
  • Database driver & version: MySQL 5.7.32
  • Plugins & versions:
  • Child Me! 1.2.0
  • CP Clear Cache 1.1.0
  • CP Field Inspect 1.2.4
  • Image Resizer 2.1.0
  • Imager X v3.3.0
  • Redactor 2.8.5
  • SEOMate 1.1.9

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the save and edit-page failure with an emoji in a Tip element, then inspect the truncated JSON in the elements column of the relevant craft_fieldlayouttabs row. Trace the field-layout save and render paths to identify where the JSON becomes invalid; done means the emoji remains intact, the stored JSON is valid, and the layout edit page renders successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql, php
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.