Error when getting messages types in class-webdados-fb-open-graph-admin.php
-
I am encountering this error when loading some post edit pages: (/wp-admin/post.php?post=1234&action=edit):
PHP Fatal error: Uncaught Error: Cannot use assign-op operators with string offsets in /wp-content/plugins/wonderm00ns-simple-facebook-open-graph-tags/admin/class-webdados-fb-open-graph-admin.php:404 Stack trace: #0 /wp-includes/class-wp-hook.php(324): Webdados_FB_Admin->post_updated_messages() #1 /wp-includes/plugin.php(205): WP_Hook->apply_filters() #2 /wp-admin/edit-form-advanced.php(219): apply_filters() #3 /wp-admin/post.php(206): require('...') #4 {main} thrown in /wp-content/plugins/wonderm00ns-simple-facebook-open-graph-tags/admin/class-webdados-fb-open-graph-admin.php on line 404
In my setup, this only seems to occur when trying to edit post types created by the mailster plugin, but the error could occur from other post types depending on the message types being returned for the post. It seems to be driven when the function
post_updated_messages
encounters unexpected message type data ( in this case set by mailster using$messages[] = 'message';
for use within post types created in that plugin); which does not have the expected array structure, causing a fatal error when trying to use.=
in this pluginAdding a check at line 401 to bypass any non-array values fixes the issue:
foreach ($messages as $type => $messages1) { if (!is_array($messages1)) { continue; }
I’m not sure if this would be the best fix? – possibly limiting to specific post types, or enabling certain post types to be excluded from this plugin more broadly would also solve the issue
- The topic ‘Error when getting messages types in class-webdados-fb-open-graph-admin.php’ is closed to new replies.