Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
After installing the select_or_other module and changing the Google+ Page Type to Other, this errors comes up on the edit node page
Notice: Undefined index: #other_delimiter in select_or_other_element_process
Notice: Undefined index: #other_delimiter in select_or_other_element_process
Then when viewing the node this message comes up:
Warning: preg_match_all() expects parameter 2 to be string, array given in preg_match_all()
Warning: html_entity_decode() expects parameter 1 to be string, array given in html_entity_decode()
Only way to get rid of the error is to disable MetaTag Google+
Comment | File | Size | Author |
---|---|---|---|
#16 | metatag-n2449425-16.patch | 588 bytes | DamienMcKenna |
#15 | 2449425.png | 76.67 KB | roberttstephens |
#4 | metatag-n2449425-4.patch | 4.95 KB | DamienMcKenna |
Comments
Comment #1
demandajmenso CreditAttribution: demandajmenso commentedSame here.
If you replace the token ( [node:summary] ) for google plus description with a random text (or a token that returns a value) both errors go away. It seems that this token doesn't work at all. The same for [term:name] on taxonomy pages.
It's true that google plus metatag submodule has code for select_or_other intergration. Disabling either of them fixes (or hides?) all errors.
From my experience so far if your tokens return a string value there is no error what so ever.
Comment #2
s427 CreditAttribution: s427 commentedSame here. Moreover, it seems that the value entered in the "other" field (in my case it was "ImageGallery") is disregarded. On the summary page, it only says "Page type: " (empty string). (On the edit page, the field shows the correct value, though...)
I tried reverting the change by setting back the Google+ Page Type to one of the default values (e.g. "Article"), but the error messages still showed up, and the summary page still displayed an empty value for "page type".
I had to disable the select_or_other module for things to get back to normal.
Comment #3
DamienMcKennaWhat version of select_or_other are you using?
Comment #4
DamienMcKennaSeeing as there are two different tags that use the module, I figured it might be worthwhile extending the API to allow addition all tags to add select_or_other support for all select tags.
Comment #5
DamienMcKennaFYI I'm not expecting that the patch will specifically fix this issue, but if we centralize the code it'll make it easier to fix for all cases.
Comment #6
DamienMcKennaComment #7
SeeWatson CreditAttribution: SeeWatson commentedI'm getting a similar error and figured I'd document it here.
I enabled Metatag 7.x-1.4 and various submodules of it(metatag, metatag_google_plus, metatag_opengraph, metatag_twitter_cards, metatag_panels) on my site , and I'm getting the following errors on every page:
They only appear the first time I load a page, and disappear on subsequent loads. If I clear the Drupal cache, they reappear for the first page load and then disappear.
I'm using the included defaults, don't have select_or_other installed, and haven't actually set any metatag values on any pages/nodes on the site.
The issue disappears if I disable metatag_google_plus.
Comment #8
noovocreative CreditAttribution: noovocreative commentedI am getting the same error with only the metatag module enabled... never had google+ enabled.
Any ideas how to solve this?
Comment #9
roberttstephens CreditAttribution: roberttstephens commentedI get the preg_match_all() warning as well. Steps to reproduce.
- Go to admin/config/search/metatags
- Click Override next to global
- Don't change anything, just save it.
- Edit a node
- Put the following into the metatag page title field: [node:metatag:keywords]
- Save the node
- Flush all caches
The following shows
Comment #10
DamienMcKennaFYI while testing this out I ran into another bug: #2490846: Notice: Undefined index: [metatag] in _metatag_token_process_metatag() (line 148 of metatag.tokens.inc).
Comment #11
DamienMcKennaI've committed the patch above because it's a good improvement to the API. I also tested out the latest select_or_other v3 codebase and it worked fine, so I suggest starting there.
Comment #15
roberttstephens CreditAttribution: roberttstephens commentedDamienMcKenna, I am reopening this issue as it does not appear to be fixed. I can reproduce this issue using a clean installation with the following
- Drupal 7.38
- Metatag 7.x-1.x as of 2015-06-17 (commit 5e95cb624d4a17670d9cc84c2cbc3e22cf593a38)
- Token 7.x-1.6
- Ctools 7.x-1.7
- php 5.3.10
Steps to reproduce
At this point, each time you flush cache and view the node you will see the following.
Warning: preg_match_all() expects parameter 2 to be string, array given in token_scan() (line 124 of /var/www/vm-www.example.com/includes/token.inc).
A screenshot is attached.
It has to do with the robots metatag value being an array, when loading metatags in the following manner.
Around line 137 of metatag.tokens.inc, token_scan is called for each metatag value (title, description, etc). The function token_scan expects a string instead of an array.
If you would like me to open a new ticket instead of reopening this one, please let me know!
Comment #16
DamienMcKennaThis patch will skip any values that are arrays.
Comment #17
DamienMcKennaComment #18
DamienMcKennaCommitted.
Comment #21
jstollerSorry to say, but I'm still seeing these PHP warnings in watchdog:
Warning: html_entity_decode() expects parameter 1 to be string, array given in decode_entities() (line 463 of /path/to/www/includes/unicode.inc).
Warning: preg_match_all() expects parameter 2 to be string, array given in token_scan() (line 124 of /path/to/www/includes/token.inc).
I'm running:
Comment #22
DamienMcKenna@jstoller: I've tested this with select_or_other v2.22 and am unable to reproduce the problem? Where are you using select_or_other - as part of a configuration set or in an entity's values?
Comment #23
DamienMcKennaComment #24
DamienMcKennaPlease open a new issue if the problem persists.