Syntax error in edin 1.2.9
-
I upgraded Edin theme today to 1.2.9 and got a white screen error. My logs show the error:
PHP Parse error: syntax error, unexpected '[' in /wp-content/themes/edin/inc/jetpack.php on line 116On the line specified the code is:
return wp_get_attachment_image_src( $post_thumbnail_id, $size )[0];I deleted the
[0]and everything now seems to be OK.
-
Hi @authentictech – I haven’t yet been able to replicate this error on my end, with or without Jetpack active.
Could you please let me know what PHP version your hosting account is running so I can look into this further? Thanks!
It’s running PHP 5.6. Thanks.
I still haven’t been able to replicate this on a test site running PHP 5.6.31. Are there any specific actions you took before getting the white screen or was it immediately after activation? Thanks!
I’ve been using the Edin theme for several months on PHP 5.6 without any problems.
Just prior to upgrading Edin, I upgraded to WordPress to 4.8.1 and the update process timed out while incomplete so I had to upload a fresh WordPress.
I had also prior updated a few other plugins but no problems after doing that. I didn’t add any new plugins or activate/deactivate any prior to experiencing this problem.
Jetpack was installed and active but I haven’t configured or used it. I’ve now deleted it.
I’m confused. As a syntax error would mean a problem with the code itself, not a runtime error caused by other code, I don’t know what else to do and I’ve no idea why it is calling out this line of code as a syntax error.
The full, original function as taken from the code on my site is:
function edin_get_attachment_image_src( $post_id, $post_thumbnail_id, $size ) { if ( function_exists( 'jetpack_featured_images_fallback_get_image_src' ) ) { return jetpack_featured_images_fallback_get_image_src( $post_id, $post_thumbnail_id, $size ); } else { return wp_get_attachment_image_src( $post_thumbnail_id, $size )[0]; } }When I remove the [0] it works and when I re-add it, I get the syntax error.
I’m now using PHP 7.
As long as I leave the [0] out it works, but I’d prefer to find out what the problem is.
Any idea where I should go next?
Thanks.
I am finding a similar problem. I could not access my Goran site at all and my host had to reset it to Twentyseven to give me my website back. When I try to get Live Preview of either Goran or Edin, I receive a white screen with message :
Parse error: syntax error, unexpected ‘[‘ in /hermes/bosnaweb27a/b1261/ipg.alanmansfield52/villa/wp-content/themes/edin/inc/jetpack.php on line 116Other themes seem to be fine. I would like to go back to one of these themes but if risky I will have to look at others.
I am also having this problem. I installed Goran theme which auto installed Edin and locked me out of a new WP installation on my site. I am now on hold to my host to try to resolve this as I am no coder…
@alanmansfield52 & @wefodanielle – please let me know what version of PHP you’re using. If you’re not sure, please look in your web hosting control panel or ask your host.
@authentictech – to clarify, are you still getting the error running PHP 7?
I will ask our developers to look into this.
If anyone would like to revert back to Edin 1.2.6, you can download it here: https://zooninidev.com/wp-content/uploads/2017/08/edin-1.2.6.zip
If you can’t access your dashboard, you should be able to remove the old Edin folder via FTP.
I’m still getting the error running PHP 7
I have just loaded PHP version 7.1 and both Goran and Edin have been accepted. I still have some editing to get the site as it was but signs are promising. I’m concerned though that as far as I know there was no flag to tell me to upgrade PHP and the site simply crashed.
By the way, I was on 5.3.
@authentictech – could you tell me the full PHP version?
PHP Version 7.0.21
Thanks, all. If you’re comfortable doing so, you could try changing the code on line 116 from this:
return wp_get_attachment_image_src( $post_thumbnail_id, $size )[0];to this:
$attachment = wp_get_attachment_image_src( $post_thumbnail_id, $size ); // Attachment array $url = $attachment[0]; // Attachment URL return $url;That should be compatible even with PHP 5.3.
Thanks Kathryn.
Is that the same for both Goran and Edin ? Is it still necessary for version 7.1 ?
Unfortunately when the problem occured I couldnt access any part of the site in order to make such a change, I just got the error message on white screen.
Does a flag appear on the dashboard when an update should be loaded ?
Thanks for your help.@alanmansfield52 – it’s just Edin; Goran hasn’t changed in over a year.
Unfortunately when the problem occured I couldnt access any part of the site in order to make such a change, I just got the error message on white screen.
I would strong suggest learning how to access your site via FTP.
Does a flag appear on the dashboard when an update should be loaded ?
Yes, an update notification appears in the dashboard when a new version of your theme is available.
The topic ‘Syntax error in edin 1.2.9’ is closed to new replies.
