Problem/Motivation

Hook webform_metatags_alter invokes when route is null.

preg_match(): Passing null to parameter#2 ($subject) of type string is deprecated in webform/webform.module

Issue fork webform-3386119

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

Krypton created an issue. See original summary.

krypton’s picture

krypton’s picture

Status: Needs work » Needs review

gilmord’s picture

I got this notice when running tests, merge request !358 fixed it for me.
+1 for this to be merged

jonathanshaw’s picture

Status: Needs review » Reviewed & tested by the community

LGTM

jrockowitz’s picture

Status: Reviewed & tested by the community » Needs work

We need to document how to replicate and fix the issue.

gilmord’s picture

@jrockowitz not sure what kind of document is required, please give more details on it

As about how to replicate and fix the issue:
- Replicate: metatag_tokens() triggers hook_metatags_alter(), hook_tokens can be invoked by Drush (f.e. update hook to resave entites), so there is no route in this case
- Fix: make sure $route_name is not NULL in webform_metatags_alter() before using it

jrockowitz’s picture

The MR is changing a massive amount of code.
https://git.drupalcode.org/project/webform/-/merge_requests/358.diff

The MR should only include the required changes.

gilmord’s picture

@jrockowitz looks like there are two MTs for some reason, this one looks fine:
https://git.drupalcode.org/project/webform/-/merge_requests/359/diffs

  • 187f351e committed on 6.2.x
    Issue #3386119 by Krypton: Added is null route check
    
jrockowitz’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

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