Hi Folks,

The token_replace function runs after json_encode which is handling the escaping, so any replaced tokens are not escaped leading to issues with validation.

The attached patch is what I added to hook_amp_metadata_alter to fix the issue.

Scott

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

scottfalkingham created an issue. See original summary.

RainbowArray’s picture

FileSize
1.11 KB
1.1 KB

Further improvements to this. strip_tags was running after the json encoding, which is also too late. So running that in array_walk_recursive as well as removing newline characters. All of these primarily affect the description.

  • mtift committed 2821cdb on 7.x-1.x authored by mdrummond
    Issue #2755257 by mdrummond, scottfalkingham: Metadata token_replace...
mtift’s picture

Status: Needs review » Fixed

Looks good! Thanks @scottfalkingham and @mdrummund! Committed to 7.x-1.x.

Status: Fixed » Closed (fixed)

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