Fatal Error: `Parse error: syntax error, unexpected ‘)’` in multiple files
-
I have a site that updated to the latest version (4.10.0) and now has a site-wide fatal error. The exact error is:
Parse error: syntax error, unexpected ')' in /wp-content/plugins/zero-bs-crm/includes/class-learn-menu.php on line 89
It appears there’s a comma used in a set of function parameters where it’s included even after the last attribute which then causes a fatal error on some PHP versions (ex. PHP version 7.2.x & possibly others [with this plugin stating it currently supports PHP version 5.6.x and above.])
In effect, we need:
// render generic learn menu with content $this->render_generic_learn_menu( $learn_menu_settings['title'], $learn_menu_settings['add_new'], '', ( !isset( $learn_menu_settings['hide'] ) ? true : false ), $learn_menu_settings['title'], $learn_menu_settings['content'], $learn_menu_settings['url'], $this->get_image_url( $learn_menu_settings['img'] ), $learn_menu_settings['video'], '', '', ( !empty( $learn_menu_settings['video_title'] ) ? $learn_menu_settings['video_title'] : ''), );
to instead be:
// render generic learn menu with content $this->render_generic_learn_menu( $learn_menu_settings['title'], $learn_menu_settings['add_new'], '', ( !isset( $learn_menu_settings['hide'] ) ? true : false ), $learn_menu_settings['title'], $learn_menu_settings['content'], $learn_menu_settings['url'], $this->get_image_url( $learn_menu_settings['img'] ), $learn_menu_settings['video'], '', '', ( !empty( $learn_menu_settings['video_title'] ) ? $learn_menu_settings['video_title'] : '') );
*Notice the removal of the last comma in the function parameters which was already unnecessary & simply causes an avoidable fatal error given certain setups.
There’s also:
Parse error: syntax error, unexpected ')' in /wp-content/plugins/zero-bs-crm/includes/ZeroBSCRM.AJAX.php on line 1028
Where that similarly needs to go from:
// Only raw checked... but proceed. (ADD or Update?) (if $zbsNoteIDtoUpdate = -1 it'll add, else it'll overwrite) $res = zeroBS_addUpdateLog( $zbsNoteAgainstPostID, $zbsNoteIDtoUpdate, -1, array( // Anything here will get wrapped into an array and added as the meta vals 'type' => $zbsNoteType, 'shortdesc' => $zbsNoteShortDesc, 'longdesc' => $zbsNoteLongDesc, ), $zbsNoteObjType, );
to instead be:
// Only raw checked... but proceed. (ADD or Update?) (if $zbsNoteIDtoUpdate = -1 it'll add, else it'll overwrite) $res = zeroBS_addUpdateLog( $zbsNoteAgainstPostID, $zbsNoteIDtoUpdate, -1, array( // Anything here will get wrapped into an array and added as the meta vals 'type' => $zbsNoteType, 'shortdesc' => $zbsNoteShortDesc, 'longdesc' => $zbsNoteLongDesc, ), $zbsNoteObjType );
Again, it’s that last comma that’s unnecessary while causing a fatal PHP error for some PHP versions.
Additionally, there’s:
Parse error: syntax error, unexpected ')' in /wp-content/plugins/zero-bs-crm/includes/ZeroBSCRM.AJAX.php on line 1098
Which should go from:
// Only raw checked... but proceed. (Update?) (if $zbsNoteIDtoUpdate = -1 it'll add, else it'll overwrite) $newOrUpdatedLogID = zeroBS_addUpdateLog( $zbsNoteAgainstPostID, $zbsNoteID, -1, array( // Anything here will get wrapped into an array and added as the meta vals 'type' => $zbsNoteType, 'shortdesc' => $zbsNoteShortDesc, 'longdesc' => $zbsNoteLongDesc, ), $zbsNoteObjType, );
to instead be:
// Only raw checked... but proceed. (Update?) (if $zbsNoteIDtoUpdate = -1 it'll add, else it'll overwrite) $newOrUpdatedLogID = zeroBS_addUpdateLog( $zbsNoteAgainstPostID, $zbsNoteID, -1, array( // Anything here will get wrapped into an array and added as the meta vals 'type' => $zbsNoteType, 'shortdesc' => $zbsNoteShortDesc, 'longdesc' => $zbsNoteLongDesc, ), $zbsNoteObjType );
I think that’s all of the occurrences of this problem as I patched these and found it no longer having a site-wide server error.
- The topic ‘Fatal Error: `Parse error: syntax error, unexpected ‘)’` in multiple files’ is closed to new replies.