Problem/Motivation

preg_match_all in \Drupal\Core\Utility\Token::scan() now requires that the text to scan is not NULL. Sometimes token_default_tokens_alter() passes a NULL value.

Steps to reproduce

1. content type A has entity reference field to content type B
2. use token in metatag module to output [field_reference_example:entity:url] from content type A
3. open example of content type A where reference field is empty
4. error shown

Proposed resolution

Don't pass NULL values.

Remaining tasks

Patching coming shortly

User interface changes

None

API changes

None

Data model changes

None

Issue fork token-3320681

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:

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:

  • 8.x-1.x Comparecompare
  • 3320681-sometimes-null-values Comparecompare

Comments

scott_euser created an issue. See original summary.

scott_euser’s picture

Project: Token » Token Default
scott_euser’s picture

Assigned: scott_euser » Unassigned
Status: Active » Needs review
StatusFileSize
new701 bytes

Okay I've had to give up on the merge request route; having created the MR originally against the Token module, opening a new fork seems to open it against Token still not Token Default. Patch attached instead.

  • andy_w committed fd974be0 on 2.x
    Issue #3320681 by scott_euser: Sometimes NULL values are sent to Core's...
andy_w’s picture

Status: Needs review » Fixed
andy_w’s picture

Status: Fixed » Closed (fixed)
scott_euser’s picture

Thanks! Would you mind dealing with crediting as well pls

andy_w’s picture