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
[Warning] foreach() argument must be of type array|object, null given
GET /admin/archive/DNADesign-Elemental-Models-BaseElement
Line 3922 in /var/www/html/vendor/silverstripe/framework/src/ORM/DataObject.php
Somehow I have BaseElement.summary_fields set to null, which is weird given there's a private static $summary_fields value set on that class that isn't null. While I am unsure what causes it, it may be related to an obsolete ClassName that remains in the database. Via debugging, I found one solution is to adjust the DataObject::summaryFields() method to force an array:
I reached out to @GuySartorelli on Slack and he said this is unlikely to be accepted without an identifiable cause, so I'm going to post the issue here in case anyone else comes across it.
The text was updated successfully, but these errors were encountered:
In case anyone else finds this issue, I fixed it in project code by setting this in YML. These are the original values defined on BaseElement, being reset to an array with values in case it is null. If the code is not null, this array_merge is effectively a no-op:
elliot-sawyer
changed the title
Warning on /admin/archive/DNADesign-Elemental-Models-BaseElement
Warning on /admin/archive/DNADesign-Elemental-Models-BaseElement (Blocks tab)
Oct 25, 2023
Latest CMS Recipe 4.13.0:
Somehow I have BaseElement.summary_fields set to null, which is weird given there's a
private static $summary_fields
value set on that class that isn't null. While I am unsure what causes it, it may be related to an obsolete ClassName that remains in the database. Via debugging, I found one solution is to adjust the DataObject::summaryFields() method to force an array:Changing
$rawFields = $this->config()->get('summary_fields');
to this:
$rawFields = $this->config()->get('summary_fields') ?? [];
Another option, if PHP support is a concern, is to check if the array is falsey:
I reached out to @GuySartorelli on Slack and he said this is unlikely to be accepted without an identifiable cause, so I'm going to post the issue here in case anyone else comes across it.
The text was updated successfully, but these errors were encountered: