You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With Craft 5 we now have the possibility to change the handle of a field, which means that the handle of a Matrix field might be the same as one of the fields of the entries it contains. When doing so with an Entries field within a Matrix, the Matrix always returns an empty array.
Note that there are also issues when the field inside the Matrix is not an Entries type. If I try with a Plain Text field for instance, Craft will return an internal error. However, Entries seems like the weirdest case, since I'm getting no errors, only an empty array.
Steps to reproduce
I'll focus on the case with the Entries type.
Create a "sectionEntries" field with type set to "Entries".
Create a "section" entry type which contains the "sectionEntries" field.
Create a "section" Matrix field which maps to the "section" entry type.
Add the field to a page/entry, and rename the handle to "sectionEntries".
The top-level "sectionEntries" Matrix field always returns an empty array.
Expected behavior
I would expect either to have an error indicating that we shouldn't nest fields with the same handles, or for nested handles to be supported.
In the case of a Plain Text field (instead of an Entries field): Craft does return an error, but I believe the message could be clearer. Here's what Craft returns:
"debugMessage": "craft\\helpers\\StringHelper::shortcodesToEmoji(): Argument #1 ($str) must be of type string, array given, called in *** on line 168",
"message": "Internal server error",
"extensions": {
"category": "internal"
},
Actual behavior
In the case of an Entries field within a Matrix field, the Matrix field always returns an empty array.
In the case of a Plain Text field within a Matrix field, Craft returns a bit of a cryptic error.
Thank you!
Craft CMS version
5.5.2
PHP version
8.3.13
Operating system and version
Linux 4.18.0-553.16.1.el8_10.x86_64
Database type and version
MySQL 8.0.40
Image driver and version
GD 8.3.13
Installed plugins and versions
The text was updated successfully, but these errors were encountered:
Hi, thanks for getting in touch! I’m not able to replicate this. Can you share your code that results in an empty array being returned for the sectionEntries Matrix field?
What happened?
Description
With Craft 5 we now have the possibility to change the handle of a field, which means that the handle of a Matrix field might be the same as one of the fields of the entries it contains. When doing so with an Entries field within a Matrix, the Matrix always returns an empty array.
Note that there are also issues when the field inside the Matrix is not an Entries type. If I try with a Plain Text field for instance, Craft will return an internal error. However, Entries seems like the weirdest case, since I'm getting no errors, only an empty array.
Steps to reproduce
I'll focus on the case with the Entries type.
Expected behavior
I would expect either to have an error indicating that we shouldn't nest fields with the same handles, or for nested handles to be supported.
In the case of a Plain Text field (instead of an Entries field): Craft does return an error, but I believe the message could be clearer. Here's what Craft returns:
Actual behavior
In the case of an Entries field within a Matrix field, the Matrix field always returns an empty array.
In the case of a Plain Text field within a Matrix field, Craft returns a bit of a cryptic error.
Thank you!
Craft CMS version
5.5.2
PHP version
8.3.13
Operating system and version
Linux 4.18.0-553.16.1.el8_10.x86_64
Database type and version
MySQL 8.0.40
Image driver and version
GD 8.3.13
Installed plugins and versions
The text was updated successfully, but these errors were encountered: