Proposed Fix: Additional comma in function call causing site-wide fatal error
-
This is likely unique to a particular PHP version(s), but it also has a quick & straightforward fix to avoid this issue for everyone.
Parse error: syntax error, unexpected ')' in /wp-content/plugins/block-options/includes/notices/class-editorskit-deprecated-typography-addon-notice.php on line 50
This seems to have been introduced in the latest plugin update.
It appears
block-options/includes/notices/class-editorskit-deprecated-typography-addon-notice.php
has:public function register() { register_setting( 'editorskit', static::$key, array( 'type' => 'string', 'description' => 'Editorskit notice status for deprecated typography addon.', 'sanitize_callback' => 'sanitize_text_field', 'show_in_rest' => true, 'default' => 'initial', // Can either be 'hidden', or 'initial'. ), ); }
which needs to be changed to:
public function register() { register_setting( 'editorskit', static::$key, array( 'type' => 'string', 'description' => 'Editorskit notice status for deprecated typography addon.', 'sanitize_callback' => 'sanitize_text_field', 'show_in_rest' => true, 'default' => 'initial', // Can either be 'hidden', or 'initial'. ) ); }
Notice how the
,
after the array in register_setting is removed.Certain PHP versions don’t like it when a comma is provided when calling a function when there isn’t another attribute/parameter to follow it. Meanwhile, it’s not actually serving a purpose.
Things look to be working properly after removing that unnecessary & potentially problematic comma in this one file.
I’d love to see this patched in a quick bugfix release as it’s bringing whole sites down for those running a PHP version sensitive to this where sites may have it set to auto-update (resolving the issue likely then needing to be done manually due to the site-wide fatal server error this is causing.)
- The topic ‘Proposed Fix: Additional comma in function call causing site-wide fatal error’ is closed to new replies.