Problem/Motivation

I have a date field that populates SCHEMA.ORG: ARTICLE dateModified via a token.

When the field is empty, I get this error because SchemaNameBase::output() returns an empty string instead of an empty array:

TypeError: Drupal\schema_metatag\Plugin\metatag\Tag\SchemaNameBase::output(): Return value must be of type array, string returned in Drupal\schema_metatag\Plugin\metatag\Tag\SchemaNameBase->output() (line 139 of modules/contrib/schema_metatag/src/Plugin/metatag/Tag/SchemaNameBase.php).

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

eeyorr created an issue. See original summary.

eeyorr’s picture

StatusFileSize
new454 bytes

Patch attached.

damienmckenna’s picture

Status: Active » Needs review

Thank you for reporting the bug and for adding the patch.

Let's see what the testbot says.

dchaffin’s picture

StatusFileSize
new447 bytes

I went to apply the patch from #2 and it looked as though the lines had shifted later in the file, so I created a new patch to test.

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

rajeshreeputra’s picture

Status: Needs review » Reviewed & tested by the community

Opened MR for ease of merge, accidently I have opened issue for same problem #3367170: output method return should be array linking here, once this get merged will close it.

Changes looks good and works as expected.

@DamienMcKenna this is causing issue with PHP 8.2, so will be good if it get fixes sooner.

Thank you!!!

trickfun’s picture

Works as expected.
Thank you

damienmckenna’s picture

Status: Reviewed & tested by the community » Fixed
Parent issue: » #3367955: Plan for Schema Metatag 3.0.1

Committed. Thank you.

rajeshreeputra’s picture

@DamienMcKenna When can we expect this to be fixed in 2.x

damienmckenna’s picture

I didn't think of backporting it to 8.x-2.x, so it isn't in the new 8.x-2.5. I did just commit it to 8.x-2.x so if you download the latest 8.x-2.x-dev you'll have it.

Status: Fixed » Closed (fixed)

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

damienmckenna’s picture