Shapely Companion error when activating:../widget-home-clients.php on line 84

I’m getting the error

Parse error: syntax error, unexpected ‘[’ in /var/sites/s/sxxxxxxxxxxe.co.uk/public_html/wp-content/plugins/shapely-companion/inc/widgets/widget-home-clients.php on line 84

when I activate the Shapely plugin. It causes wordpress to be inaccessable via the dashboard, and I’ve had to go to my hosting company file manager app and manually delete the plugin to get things back to normal.

I’ve tried deactivating all plugins etc, no joy.My wordpress version is 4.7.2 and the shapely companion is version 1.0.5 and the theme is the current version 1.1.2 deployed through the WP dashboard.

The only way so far I can get it activated is to comment out the function that corresponds to the error. e.g.

/*if ( ! isset( $logos['img'] ) ) {
		$logos['img'] = [ '' ];
	}
	if ( ! isset( $logos['link'] ) ) {
		$logos['link'] = [ '' ];
	}*/

But that’s not a solution if there are other knock on effects.

Any help would be greatly appreciated

Same sort of problem by me too… I recieve message:

Parse error: syntax error, unexpected ‘[’ in /home/vhosts/hoei-boei.nl/httpdocs/blog/wp-content/plugins/shapely-companion/inc/widgets/widget-home-clients.php on line 84

When I deactivate the shape companion plug in. my site looks normal. I think there is someting wromg with the plug in.

Recieved reactionon my thread from other user with the same problem…

Hi,

Which version of PHP you guys running? Make sure it is 5.4+

For now, change this line,


		if ( ! isset( $logos['img'] ) ) {
			$logos['img'] = [ '' ];
		}
		if ( ! isset( $logos['link'] ) ) {
			$logos['link'] = [ '' ];
		}

to

		if ( ! isset( $logos['img'] ) ) {
			$logos['img'] = array();
		}
		if ( ! isset( $logos['link'] ) ) {
			$logos['link'] = array();
		}

Let us know,

Thanks,
laranz.

Applied your suggested changes and after a false start from copying from the forum email (which had inserted some additional characters in the code) I copy exactly as above and it worked.

To your second point I checked through the hosting companies control panel for the PHP version and it was 5.3. I then ran a compatibilty check against the site for PHP 7.0. Got an OK and bumped it up to that. All still working.

Commented out new code and reinstated old. Site still working. Result!

Conclusion: Check through your hosting company control panel that you site is running the latest (or as near as) version of PHP.

Hi,

Yes, PHP version should be 5.4+. :slight_smile:

Let us know if you have any other questions.

Thanks,
laranz.