Problem/Motivation

While database update from 8.x-1.22 to 1.24 the updates aborts with error:

> TypeError: explode(): Argument #2 ($string) must be of type string, array given in /XXX/modules/contrib/metatag/metatag.post_update.php on line 304 #0 /XXX/modules/contrib/metatag/metatag.post_update.php(304): explode()

Adding some debug-output show, that `$tags['robots']` is already an array:

 Array
  (
      [index] => 0
      [noindex] => 0
      [follow] => 0
      [nofollow] => 0
      [noarchive] => 0
      [noodp] => 0
      [nosnippet] => 0
      [noydir] => 0
  )

Output of field-value in $record:

      [field_event_meta_value] => a:1:{s:6:"robots";a:8:{s:5:"index";i:0;s:7:"noindex";i:0;s:6:"follow";i:0;s:8:"nofollow";i:0;s:9:"noarchive";i:0;s:5:"noodp";i:0;s:9:"nosnippet";i:0;s:6:"noydir";i:0;}}

Steps to reproduce

Doing database update.

Proposed resolution

Using patch for testing if it is already an array.

Remaining tasks

User interface changes

API changes

Data model changes

Comments

jan kellermann created an issue. See original summary.

jan kellermann’s picture

StatusFileSize
new929 bytes
damienmckenna’s picture

Thank you for reporting the bug and providing a patch. I'll review it in the next few days.

damienmckenna’s picture

Issue tags: +Needs tests

Will need to expand the test coverage to make sure the data is correct.

damienmckenna’s picture

Status: Active » Needs review
StatusFileSize
new833 bytes

Improved basic patch.

damienmckenna’s picture

Priority: Normal » Major

damienmckenna’s picture

Status: Needs review » Fixed
Issue tags: -Needs tests

Committed, and I added some example robots values to the v1 fixture, which we can turn into test coverage later. Thank you.

Status: Fixed » Closed (fixed)

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