I ran into a weird issue, and I don't know exactly why its happening, but in debugging, I could see at types, $type was equal to the 0 integer.
You can see that example in the attached screenshot.

This was causing me issues during Search API indexing, as apparently it does some token stuff during that process. Anyways, the fix in my case was to change the comparison operator from != to !== in

if ($type != 'config_page') {
    return $replacements;
  }

to

if ($type !== 'config_page') {
    return $replacements;
  }

I'm thinking there is some comparison issue with the $type being 0, which also means FALSE. Not really sure, but this simple change allowed the indexing to complete successfully, and I also see the Config Page tokens are still generated.

It seems like from debugging, that when the token generation stuff is run, it calls to ConfigPages::config(), passing in the $type.
With the $type of 0 (zero), I believe the logic is confused too and fails on line 196:

$conditions['context'] = $type->getContextData(TRUE);

Because $type is a string, not an object. So, there may be more work needed or a better way of handling this overall, but the simple operator fix lets is pass in my case.

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

joshua.boltz created an issue. See original summary.

joshua.boltz’s picture

joshua.boltz’s picture

Issue summary: View changes

shumer made their first commit to this issue’s fork.

  • shumer committed 4e3d237c on 8.x-2.x
    Resolve #3302102 "Weird issue with"
    
shumer’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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