inpsyde / MultilingualPress-Yoast-SEO-Sync

This is a simple add-on for the MultilingualPress plugin to synchronize the post metadata of the Yoast SEO plugin between translated posts.
GNU General Public License v2.0
7 stars 3 forks source link

Saving a post leads to crash #13

Open ckanitz opened 4 years ago

ckanitz commented 4 years ago

Hi there,

with the SEO-Sync plugin activated saving a post sometimes leads to There has been a critical error on your website. Please check your site admin email inbox for instructions.

WP: 5.3 Editor: Classic Editor

WP_DEBUG_LOG:

[01-Apr-2020 08:40:29 UTC] PHP Fatal error:  Uncaught TypeError: Argument 1 passed to Inpsyde\MultilingualPress\YoastSeoSync\TranslationUi\Post\Field\Title::sanitize() must be of the type string, null given, called in /wordpress/wp-content/plugins/multilingualpress/src/multilingualpress/TranslationUi/Post/MetaboxField.php on line 99 and defined in /wordpress/wp-content/plugins/multilingualpress-yoast-seo-sync/src/TranslationUi/Post/Field/Title.php:53
Stack trace:
#0 /wordpress/wp-content/plugins/multilingualpress/src/multilingualpress/TranslationUi/Post/MetaboxField.php(99): Inpsyde\MultilingualPress\YoastSeoSync\TranslationUi\Post\Field\Title::sanitize(NULL)
#1 /wordpress/wp-content/plugins/multilingualpress-yoast-seo-sync/src/TranslationUi/Post/MetaboxAction.php(209): Inpsyde\MultilingualPress\TranslationUi\Post\MetaboxField->requestValue(Object(Inpsyde\MultilingualPress\Framework\Http\PhpServerRequest), Object(Inpsyde\MultilingualPress\TranslationUi\MetaboxFieldsHelpe in /wordpress/wp-content/plugins/multilingualpress-yoast-seo-sync/src/TranslationUi/Post/Field/Title.php on line 53
[01-Apr-2020 08:40:35 UTC] PHP Warning:  Illegal string offset 'plugin_name' in /wordpress/wp-admin/includes/class-wp-privacy-policy-content.php on line 96
[01-Apr-2020 08:40:35 UTC] PHP Warning:  Illegal string offset 'policy_text' in /wordpress/wp-admin/includes/class-wp-privacy-policy-content.php on line 97

Also there are some non-unique-id warnings on my console which can be tracked down to MLP metabox using the same IDs for the taxonomy inputs as the core-sidebar.

Let me know if you need any further information

Dinamiko commented 4 years ago

Hi @ckanitz,

that´s because Inpsyde\MultilingualPress\YoastSeoSync\TranslationUi\Post\Field\Title::sanitize is expecting a string but for some reason is receiving a null value.

as a quick fix you can try to remove the string type hint in method signature, so change this: public static function sanitize(string $value): string to this: public static function sanitize($value): string

In order to understand why is receiving a null value, I´ll need a way to reproduce the issue locally, will be great if you can provide the steps to reproduce the issue, thanks.