I ran into this in the release version, but found that it persists in the current branch as well. We're using Quick Tabs, and when editing a tabset, it tries to pull a complete list of the available blocks that might be used in a tab. Recently (sometime in the past three weeks), it started throwing the following error:

TypeError: strnatcasecmp(): Argument #1 ($string1) must be of type string, Drupal\system\Entity\Menu given in strnatcasecmp() (line 104 of core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php).

I added a few variable dumps into CategorizingPluginManagerTrait.php to try to figure out what was going on, and found that it was breaking here:

    uasort($definitions, function ($a, $b) use ($label_key) {
      if ((string) $a['category'] != (string) $b['category']) {
        return strnatcasecmp($a['category'], $b['category']);
      }
      return strnatcasecmp($a[$label_key], $b[$label_key]);
    });

When a we_megamenu block hits that second return statement, the value of $label_key is "admin_label" and the contents of $a['admin_label'] is a Drupal\system\Entity\Menu object. Since strnatcasecmp wants strings, it's unhappy.

Now we're still using 8.x-1.13, so I know this isn't the result of some recent change in we_megamenu. I'm thinking perhaps there was a core change recently that triggered this problem? I'm not sure...and maybe this isn't where the problem needs to be fixed. But it seemed like the place to start.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

wrd-oaitsd created an issue. See original summary.

konstantin che’s picture

Hello! I saw the same problem. And found a solution. I am attaching the patch.

wrd-oaitsd’s picture

#2 solved the problem for me. Thanks!

g089h515r806’s picture

Status: Active » Reviewed & tested by the community

#2 patch fix the issue.

oleh.tarasiuk made their first commit to this issue’s fork.

rjjakes’s picture

Status: Reviewed & tested by the community » Fixed

Merged to dev.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

Lingamurthy’s picture

Simplified one