Call to a member function getPath() on null in drupal8/core/modules/config_translation/src/ConfigNamesMapper.php on line 237
Error: Call to a member function getPath() on null in drupal8/core/modules/config_translation/src/ConfigNamesMapper.php, line 237

On enabling module password policy with php version 7 I am getting above error.

Comments

pradeep22saini created an issue. See original summary.

pradeep22saini’s picture

Status: Active » Closed (duplicate)

this issue is related to core

bobooon’s picture

Priority: Normal » Major
Status: Closed (duplicate) » Active

This is not a core issue. I am also having the exact error occur after enabling Password Policy (with translations enabled). It completely breaks the ability to clear site caches and the Password Policy administration pages are not available. After uninstalling Password Policy the error goes away and site caches can be cleared again. Re-enabling Password Policy causes the same problem. I've tested on the latest Drupal 8.x release. I have even tested using a fresh minimal install of Drupal 8.x with the same results. I'm escalating to major since Password Policy breaks Drupal 8 sites using translations. I am actively debugging and will post a patch if I am able to resolve.

coconnor’s picture

It looks like Drupal's core config_translation module is seeking a route for entity.password_policy.edit_form. When it doesn't find that route, I see the reported error.

If I enter a dummy route to password_policy.routing.yml, like the one below, I'm able to work as normal.

entity.password_policy.edit_form:
  path: '/admin/config/security/password-policy'
  defaults:
    _entity_list: 'password_policy'
    _title: 'Password Policies'
  requirements:
    _permission: 'administer site configuration'

Not suggesting as a patch, b/c I'm unsure if this is something that should be fixed on password_policy or something that should be addressed on config_translation.

vurt’s picture

I can confirm the problem with Drupal 8.1. I am shure that I was able to install the module without this problem in the past (Drupal 8.0). The proposed solution from coconnor (#4) worked for me, thanks.

dabito’s picture

Status: Active » Needs review
StatusFileSize
new688 bytes

After a quick review of the code, I noticed that the edit_form is indeed generated by the Entity. Therefore, I believe this is a password_policy issue and created a patch with @coconnor 's code.

dabito’s picture

StatusFileSize
new688 bytes

First patch had the wrong URL for the route record.

Use this updated version.

dabito’s picture

dabito’s picture

StatusFileSize
new696 bytes

Totally messed up previous patches. Sorry for the mess.

sch4lly’s picture

Patch works great, thanks!

sch4lly’s picture

Status: Needs review » Reviewed & tested by the community
nerdstein’s picture

Status: Reviewed & tested by the community » Fixed

That patch did not apply cleanly for me but I was able to grab the code.

As such, I've tested, it worked, and I rolled it in.

  • nerdstein committed afc0a08 on 8.x-3.x authored by dabito
    Issue #2703717 by dabito: Call to a member function getPath()
    
dabito’s picture

Thanks for the extra work, @nerdstein!

Status: Fixed » Closed (fixed)

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

john.nie’s picture