Problem/Motivation

I see the JS error when the Mask icon and Mask icon color metatag are set.

TypeError: preg_match(): Argument #2 ($subject) must be of type string, array given in preg_match() (line 223 of /app/docroot/modules/contrib/yoast_seo/src/EntityAnalyser.php)
#0 /app/docroot/modules/contrib/yoast_seo/src/EntityAnalyser.php(223): preg_match()
#1 /app/docroot/modules/contrib/yoast_seo/src/EntityAnalyser.php(141): Drupal\yoast_seo\EntityAnalyser->replaceContextAwareTokens()
#2 /app/docroot/modules/contrib/yoast_seo/src/Form/AnalysisFormHandler.php(97): Drupal\yoast_seo\EntityAnalyser->createEntityPreview()

Steps to reproduce

  • Create default metatag for your node type and set Mask Icon and Color default value for Favicons & Touch Icons
  • Go to the node creation form
  • You can see js error in console and error message in Drupal log

Proposed resolution

Check that the value is string, otherwise call function recursively because Mask Icon value by default is array and contains this two parameters.

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork yoast_seo-3580844

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

lamp5 created an issue. See original summary.

lamp5’s picture

Status: Active » Needs review
alexiane dapsens’s picture

The patch works for me. Thank you!