This is the error I was getting on node saves.

Notice: Undefined offset: 0 in Drupal\permissions_by_term\Controller\NodeEntityBundleController->getContentType() (line 94 of modules/contrib/permissions_by_term/src/Controller/NodeEntityBundleController.php).
Warning: assert(): Cannot load the "node" entity with NULL ID. failed in Drupal\Core\Entity\EntityStorageBase->load() (line 249 of core/lib/Drupal/Core/Entity/EntityStorageBase.php).
Warning: array_flip(): Can only flip STRING and INTEGER values! in Drupal\Core\Entity\EntityStorageBase->loadMultiple() (line 266 of core/lib/Drupal/Core/Entity/EntityStorageBase.php).

I have path aliases setup to that instead of /node/ it shows as // (/someContentType/someTitle). And the edit turned out to be /someContentType/someTitle/edit. So when the code in NodeEntityBundleController was looking for a numeric value in the URL (ie /node//edit), it wasn't finding it and causing an error.

I'll post my patch shortly.

CommentFileSizeAuthor
#2 3189443-fix-getContentType-2.patch1.02 KBeahonet

Comments

eahonet created an issue. See original summary.

eahonet’s picture

Issue summary: View changes
StatusFileSize
new1.02 KB

this patch is what I did to address the error.

Before this, I could reproduce by just saving a node that had a path like /urlAlias/path/edit and wasn't using /node/45/edit. No errors now.

jepster_’s picture

Status: Active » Fixed

@eahonet: Thanks for testing and sharing your patches! I have reviewed your patches and added them to the latest releases:

Drupal 9 version (3.1.5): https://www.drupal.org/project/permissions_by_term/releases/3.1.5
Drupal 8 version (8.x-2.28): https://www.drupal.org/project/permissions_by_term/releases/8.x-2.28

jepster_’s picture

Status: Fixed » Closed (fixed)