When a site is loaded with a database snapshot that contains bad records, such as when a record has a ParentID or ParentClass record of null then the CMS throws an "internal server error" when any page is visited within the CMS.
In my particular case this was breaking when Silverstripe's SiteTreeLink had records where both the ParentID and ParentClass were null, throwing the following error:
error-log.WARNING: E_DEPRECATED: strtolower(): Passing null to parameter #1 ($string) of type string is deprecated {"code":8192,"message":"strtolower(): Passing null to parameter #1 ($string) of type string is deprecated","file":"/Users/user/Sites/mysite/vendor/silverstripe/config/src/Collections/MemoryConfigCollection.php","line":118} []
To resolve this issue, I removed these stale records from the database then the CMS started behaving as expected.
One suggestion from a module level would be to add a defensive check on this specific line of code where the $relationClassName must first be checked before referencing it in the Config call, perhaps something like:
$excludeClass = null;
if ($relationClassName) {
$excludeClass = Config::inst()->get($relationClassName, 'exclude_from_fixture_relationships');
}
When a site is loaded with a database snapshot that contains bad records, such as when a record has a
ParentIDorParentClassrecord ofnullthen the CMS throws an "internal server error" when any page is visited within the CMS.In my particular case this was breaking when Silverstripe's
SiteTreeLinkhad records where both theParentIDandParentClasswerenull, throwing the following error:To resolve this issue, I removed these stale records from the database then the CMS started behaving as expected.
One suggestion from a module level would be to add a defensive check on this specific line of code where the
$relationClassNamemust first be checked before referencing it in theConfigcall, perhaps something like: