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.
Did a forced cache clear and I get this
Recoverable fatal error: Argument 3 passed to metatag_metatags_form() must be of the type array, null given, called in metatag/metatag.admin.inc on line 309 and defined in metatag_metatags_form() (line 952 of metatag/metatag.module).
Comments
Comment #1
mikeytown2 CreditAttribution: mikeytown2 commentedConfig object looks like
Comment #2
mikeytown2 CreditAttribution: mikeytown2 commentedLooking at the metatag_config table and a serialized null was in the config column.
Comment #3
Anonymous (not verified) CreditAttribution: Anonymous commentedrunning into this problem today while trying to config meta tags on a panels page.
Comment #4
DamienMcKennaPlease let me know if you're still getting the problem with the latest release.
Comment #5
Anonymous (not verified) CreditAttribution: Anonymous commentedSeems okay now. I am able to add Metatags to panels pages and nodes, views, etc.
Comment #6
DamienMcKenna@trainingcity: Thanks for letting me know!
@mikeytown2: Any update? I'm marking this as fixed as I believe the problem was resolved in a recent release, please reopen it if the problem still persists for you.
Comment #7
mikeytown2 CreditAttribution: mikeytown2 commentedWe're no longer using this module so I can't offer anything at this point.
Comment #8
DamienMcKenna@mikeytown2: Out of interest what are you doing instead?
Comment #9
mikeytown2 CreditAttribution: mikeytown2 commentedThe website that was using metatag has slowly turned into a logged in only site; we've since moved our public facing part to a different domain that is rendered with .net.
Comment #10
DamienMcKennaCool, thanks for the update.
Comment #12
Vaene CreditAttribution: Vaene as a volunteer commentedThis error is popping up for me when I try to edit the Global Metatag:
Recoverable fatal error: Argument 3 passed to metatag_metatags_form() must be of the type array, null given, called in /Users/.../site/sites/all/modules/metatag/metatag.admin.inc on line 292 and defined in metatag_metatags_form() (line 1322 of /Users/.../site/sites/all/modules/metatag/metatag.module).
cache_metatag has this serialization for ctools_export:metatag_config:global:
O:8:"stdClass":5:{s:8:"instance";s:6:"global";s:11:"api_version";i:1;s:8:"disabled";b:0;s:6:"config";a:4:{s:5:"title";a:1:{s:5:"value";s:54:"[current-page:title] | [current-page:pager][site:name]";}s:9:"generator";a:1:{s:5:"value";s:28:"Drupal 7 (http://drupal.org)";}s:9:"canonical";a:1:{s:5:"value";s:27:"[current-page:url:absolute]";}s:9:"shortlink";a:1:{s:5:"value";s:28:"[current-page:url:unaliased]";}}s:13:"export_module";s:7:"metatag";}
And metatag_config has one row:
cid instance config
1 global N;
We've been having problems with any settings showing up for metatags and with edit failing so I reinstalled metatag to the 7.x-1.17 version. Cleared Cache and manually truncated cache_metatag. In settings to keep things simple I only have metatags enabled for Node -> Basic Page, and in Advanced Settings I turned of load defaults and cache meta tags. Still, whenever I try to edit Global, the page fails with the above error in dblog.
dpm'd config and I see that config=>config is NULL
config =>
... (Object) stdClass
cid (String, 1 characters ) 1
instance (String, 6 characters ) global
config (NULL)
table (String, 14 characters ) metatag_config
type (String, 6 characters ) Normal
export_type (Integer) 1
Comment #13
Guito339 CreditAttribution: Guito339 as a volunteer commented@DamienMcKenna, @Vaene,
I'm running into this as well (v 7.x-1.17) There is likely something wrong with the data in the metatag_config table, but it's not clear what exactly is wrong and I can't just fix that table on one env and copy it to other envs.... so here is my diagnosis and solution.
Diagnosis
The function
function metatag_config_edit_form($form, &$form_state, $config)
requires a$config
that is passed to:metatag_metatags_form($form, $config->instance, $config->config, $options)
The function
function metatag_config_edit_form($form, &$form_state, $config)
should probably confirm that$config->$config
is set before passing it tometatag_metatags_form($form, $config->instance, $config->config, $options)
If it's not set, then perhaps some sort of helper message should be sent, or some sort of config default should be set.
The way the menu item works is to call metatag_config_load on the 5th argument to the page. so for
admin/config/search/metatags/config/node
the menu system would pass the result ofmetatag_config_load('node')
Solution (Not a good one, as it involves hacking a contrib module)
I've used the following code to get around the empty
$config
in metatag.admin.inc.Right before the call to
metatag_metatags_form($form, $config->instance, $config->config, $options);
addThis will set the config the same way as the menu system would and only changes
$config
when its empty.Comment #14
kyuubi CreditAttribution: kyuubi as a volunteer commentedHi,
This issue is still occurring for me when using metatag by path.
I just updated to the latest release but it still happens.
Is there any workaround?
Cheers,
Comment #15
DamienMcKenna@kyuubi: Please open a new issue and I can help you debug the problem.
Comment #16
kyuubi CreditAttribution: kyuubi as a volunteer commentedHi @damienmckenna,
Thanks for the quick reply.
Opened a separate issue here:
https://www.drupal.org/project/metatag/issues/2926375
Thanks so much,
Duarte