Received the following errors when previewing a new node:

  • Warning: preg_match_all() expects parameter 2 to be string, array given in token_scan() (line 119 of /var/www/XPortal/includes/token.inc).
  • Warning: strip_tags() expects parameter 1 to be string, array given in _metatags_quick_add_head() (line 389 of /var/www/XPortal/sites/all/modules/contrib/metatags_quick/metatags_quick.module).
  • Warning: Parameter 1 to icl_content_node_view() expected to be a reference, value given in module_invoke_all() (line 819 of /var/www/XPortal/includes/module.inc).
  • Warning: explode() expects parameter 2 to be string, array given in metatags_quick_field_widget_form() (line 353 of /var/www/XPortal/sites/all/modules/contrib/metatags_quick/metatags_quick.module).

I've tracked it down to $item['content'] in _metatags_quick_add_head() being an array, not a string. I'm not sure why it's an array instead of a string, or even if it's supposed to be an array already as I didn't go too far down that rabbit hole.

I've corrected the errors with a quick fix by placing an if(!is_array($item['content'])) around the portion that deals with $item['content'].

As for the errors on line 353, $items[$delta]['metatags_quick'] is already an array, so I've removed the explode().

I'll post my patch file, but it's not a great fix since I didn't track down the actual issue.

Comments

mas5d2’s picture

Here's my quick fix patch.

colinstables’s picture

Assigned: Unassigned » colinstables
Category: bug » support

Hi i get the similar error message:

Warning: preg_match_all() expects parameter 2 to be string, array given in token_scan() (line 119 of C:\wamp\www\wds\includes\token.inc).
Warning: strip_tags() expects parameter 1 to be string, array given in _metatags_quick_add_head() (line 389 of C:\wamp\www\wds\sites\all\modules\metatags_quick\metatags_quick.module).
Warning: explode() expects parameter 2 to be string, array given in metatags_quick_field_widget_form() (line 353 of C:\wamp\www\wds\sites\all\modules\metatags_quick\metatags_quick.module).

However i don't know how to apply patch and by reading the guide i think i'll wait untill an update is made.

Can you tell me when this is likely to happen?

Thanks

Colin

valthebald’s picture

Status: Active » Needs work

I would like to investigate the problem root before patching. Issue seems not critical, so there's only little chance I will get there soon. If anyone is interested - patches are welcome.

Anonymous’s picture

I've had some of these errors as well but only when I opened the screen to create a new node from a certain content type that had some meta fields on it.

The problem was that I created the fields using the Drupal 7 custom field creator and used 'Add existing field' to copy a meta field from another content type. This isn't the way you should add meta fields. If you want to add meta fields, go to admin/config/search/metatags_quick and choose to wich content types you want to add some of the default fields. This solved the problem for me.

If you still want to add custom meta fields just add them using the Drupal 7 custom field creator but default meta fields should always be added through the metatags admin panel.

valthebald’s picture

Status: Needs work » Closed (works as designed)
bdimaggio’s picture

Status: Closed (works as designed) » Active
StatusFileSize
new1.15 KB

I'm seeing this problem too, and I definitely have not added the meta fields via the custom field GUI. I turned the module on, added only the "robots" field for nodes at /admin/config/search/metatags_quick, and immediately went to preview a page. I got

Warning: preg_match_all() expects parameter 2 to be string, array given in token_scan() (line 127 of [my site]/includes/token.inc).
Warning: strip_tags() expects parameter 1 to be string, array given in _metatags_quick_add_head() (line 501 of [my site]/sites/all/modules/contrib/metatags_quick/metatags_quick.module).

Looks like the Robots field sends its data to_metatags_quick_add_head() as an array rather than a string., and a couple of functions in there complain. I've just worked around those functions to produce this patch (against the current dev). Hope it helps!

bdimaggio’s picture

Assigned: colinstables » Unassigned

HI there--I ended up back at this issue again with a need for... my very own patch! Any possibility of getting it committed?

valthebald’s picture

Hi there!
I have a question - there is a check for is_array($content).
What should happen in else clause?

colinstables’s picture

Status: Active » Closed (fixed)