craftcms / craftcms/cms

[4.x]:

Open
#11,803 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

What happened?

We are building a new website with a clean database (not upgraded from craft 3)
So i want to add a field to a section. The field is a matrix with some building blocks.
However when i save the section i get the following error:

array_key_exists(): Argument #2 ($array) must be of type array, string given

After this i cannot remove the field anymore from the section after saving the field is still there withouth error its just back again after moving it.
If i open the edit page of this entry i get the following error:

TypeError: array_key_exists(): Argument #2 ($array) must be of type array, string given in /var/www/html/vendor/craftcms/cms/src/fields/Table.php:416
Steps to reproduce
  1. place a matrix in an entry (This did work before for us since we managed to do it at the start of the week we have updated in between) The only plugin we used in this matrix is linkfield which caused no problems in another project we are working on.
Expected behavior
Actual behavior
Craft CMS version

4.2.1.1

PHP version

8.1.8

Operating system and version

No response

Database type and version

MySQL 10.4.25

Image driver and version

No response

Installed plugins and versions
    "craftcms/cms": "4.2.1.1",
    "vlucas/phpdotenv": "^5.4.0",
    "craftcms/feed-me": "5.0.4",
    "craftcms/redactor": "^3.0",
    "doublesecretagency/craft-siteswitcher": "2.3.0",
    "mmikkel/child-me": "1.3.1",
    "mmikkel/cp-field-inspect": "1.4.4",
    "nystudio107/craft-retour": "4.0.2",
    "nystudio107/craft-seomatic": "4.0.7",
    "putyourlightson/craft-blitz": "4.2.1",
    "sebastianlenz/linkfield": "2.1.4",
    "solspace/craft-freeform": "4.0.0",
    "topshelfcraft/wordsmith": "4.0.1",
    "verbb/super-table": "3.0.0",
    "verbb/expanded-singles": "2.0.0",
    "verbb/field-manager": "3.0.2",
    "verbb/knock-knock": "2.0.0",
    "wrav/oembed": "2.2.1",
    "carlcs/craft-redactorcustomstyles": "^4.0"

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 Matrix field setup described in the issue on Craft CMS 4.2.1.1, then inspect vendor/craftcms/cms/src/fields/Table.php around line 416 and the entry edit/save flow. Done means the section can save and the entry can be opened without the array_key_exists() TypeError, while the Matrix field remains removable.

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
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.