Problem/Motivation
Visiting /admin/structure/display-modes/view there are a number of depreciation messages:
Deprecated function: strnatcasecmp(): Passing null to parameter #2 ($string2) of type string is deprecated in Drupal\Core\Entity\EntityDisplayModeBase::sort() (line 72 of core/lib/Drupal/Core/Entity/EntityDisplayModeBase.php).
Steps to reproduce
as above.
Proposed resolution
Could be a data issue - ie why are null entries being passed in?
See https://www.drupal.org/project/drupal/issues/3605760 for related issue
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | issue_3605761.patch | 483 bytes | jons |
Comments
Comment #2
jons commentedThe data issue can most-likely be resolved by clearing the cache tables eg cache_entity;
The code (
core/lib/Drupal/Core/Entity/EntityDisplayModeBase.php) can be fixed with changing$type_order = strnatcasecmp($a_type, $b_type);to
$type_order = strnatcmp(mb_strtolower($a_type), mb_strtolower($b_type));Comment #3
dcam commentedThis was an issue resulting from badly corrupted configuration, one that was potentially caused by human tampering as I explained in #3605760: On cache-clear: [warning] Undefined array key 1 EntityDisplayRepository.php:115. The source of this issue is the
targetEntityTypekey of the configuration was NULL. That's something that shouldn't happen in the first place because that key is not nullable per its schema.Deleting the offending configuration is the correct course of action.
Comment #5
jons commentedpatch for existing core code issue attached
Comment #6
smustgrave commentedAs mentioned in #3 this appears to be user error so not sure there’s anything to actually fix here.
Comment #7
jons commentedHi @smustgrave - its because, irrespective of the way it manifested itself, there is deprecated code here which is fixed in patch