Parse error: syntax error, unexpected ‘[‘
-
When trying to activate the plugin “WP Product Feed Manager” i’m receiving following error message:
Parse error: syntax error, unexpected ‘[‘ in /wp-content/plugins/wp-product-feed-manager/includes/data/class-queries.php on line 493
Can someone assist? I’m using PHP version 5.3.3
Thanks in advance!
-
This topic was modified 9 years, 4 months ago by
thbaumi.
-
This topic was modified 9 years, 4 months ago by
-
Hello thbaumi,
Do you use the free version of WP Product Feed Manager?
Hi Michel,
currently, yes. Wanted to try first before buying Premium version.
Regards
Ok, I also assume you’re using the latest version (1.4.3). If that’s the case, please download the following file:
https://dl.dropboxusercontent.com/u/3129817/class-queries-thb.zip
Copy the php file in the zip file to the wp-content/plugins/wp-product-feed-manager/includes/data folder (overwrite the old file) and test it again.
Let me know if it solved the issue.
Best regards,
MichelThanks for your help, Michel. But now i’m getting:
Parse error: syntax error, unexpected ‘[‘ in /wp-content/plugins/wp-product-feed-manager/includes/data/class-data.php on line 86
Best regards,
ThomasOk Thomas,
I know what’s causing the errors, but the lines of code that cause the errors are usually acceptable coding practice. So either a setting on your server is different that we’ve encountered on other clients servers so far or you’re maybe using an older PHP version.
But anyways, I do want to make sure our code also works on servers with your setting and PHP version, so I will keep solving them. My only concern is that it’s almost impossible for me to look through all the code and to find the same use of these lines. If you don’t mind I will just use you as a trail and error way to solve the issues.
I do not think there will be a lot of these errors, maybe this is even the final error, but please bear with me :-).
Please copy the content of the following file to your “wp-content/plugins/wp-product-feed-manager/includes/data folder”:
https://dl.dropboxusercontent.com/u/3129817/class-data-thb.zip
Sorry for the inconvenience, I hope this is the last one,
Michel-
This reply was modified 9 years, 4 months ago by
Michel Jongbloed.
Hey Michel,
thanks for putting your efforts into this. I’ll be happy to play trial and error with you! 🙂 It seems it goes on…
Parse error: syntax error, unexpected ‘[‘ in /wp-content/plugins/wp-product-feed-manager/includes/application/class-feed-support.php on line 201
Best regards,
ThomasI think I found a way to identify all rows that could potentially cause the error. So here are three files I want you to update:
In the wp-content/plugins/wp-product-feed-manager/includes/data folder:
https://dl.dropboxusercontent.com/u/3129817/class-ajax-data-thb.zipAnd in the wp-content/plugins/wp-product-feed-manager/includes/application folder:
https://dl.dropboxusercontent.com/u/3129817/class-feed-support-thb.zip
and
https://dl.dropboxusercontent.com/u/3129817/class-feed-processor-thb.zipThat might be it (i hope).
I do have to end my support for today, but I will be back tomorrow to continue supporting you if required.
Best regards,
MichelNo problem, Michel. Yesterday I fell asleep, too… I already tried this morning but it keeps going:
Parse error: syntax error, unexpected ‘[‘ in /wp-content/plugins/wp-product-feed-manager/includes/application/class-feed-processor.php on line 477
Have a good day,
ThomasLet’s see if this is the last one.
This one belongs in the wp-content/plugins/wp-product-feed-manager/includes/application folder:
https://dl.dropboxusercontent.com/u/3129817/class-feed-processor-thb-2.zip
By the way, the next update will off course include all of these changes, so a next update should be ok for you.
Michel
Good to know, thanks! 🙂
But it was not yet the last one:
Parse error: syntax error, unexpected ‘[‘ in /wp-content/plugins/wp-product-feed-manager/includes/application/class-feed-processor.php on line 466
Regards,
ThomasThomas, Could you please look at the WooCommerce – System Status page what PHP version you’re using?
Do you have any programming knowledge? (if that’s the case I might be able to explain what seems to happen)
Hi Michel,
sorry, last weekend kept me busy! 🙂 Yes, i do have programming knowledge. Is it something you will change and include in upcoming releases?
Regards,
ThomasHi Thomas,
I’m pretty sure you’re using an older PHP version than 5.4 on your server.
Just to let you know what were facing here, as of version 5.4 it is allowed to write something like
$var = my_function()[0];where the ‘my_function’ function would return an array and the result would be the first item in the my_function array. This has become a common practice for some time now, so I used it on a few instances in the plugin code.
In order to prevent the syntax error I have to change these line into something like:
$temp = my_function(); $var = $temp[0];No problem by itself and I thought I would be able to find all instances of this by searching the code for ‘)[‘. But although I did find a few instances it now shows that unfortunately not all instances are found with this search. Like the latest error you reported, it did not show up in the search.
So I’m absolutely not sure how often I used it in the code. Searching manually through the code is an impossible task and I would probably overlook an instance anyway.
So getting it solved is only possible with the help of someone with an older PHP version like you (I suspect).
So here is another update I would like to ask you to test out:
https://dl.dropboxusercontent.com/u/3129817/class-feed-processor-thb-3.zip
It belongs again in the wp-content/plugins/wp-product-feed-manager/includes/application folder.
Thanks for trying out!
Michel
Hi Guys,
I have the same issue. I’m trying to activate the free version and I get
wp-content/plugins/wp-product-feed-manager/includes/application/class-feed-processor.php on line 466.
I have tried to replace the files as suggested above but still the same.
PHP Version 5.6.25
Any ideas?
Thanks
DannyThat’s strange Danny,
Could you also try to download the https://dl.dropboxusercontent.com/u/3129817/class-feed-processor-thb-3.zip file and place the php file inside it in your wp-content/plugins/wp-product-feed-manager/includes/application/ folder?
Then check if the error has gone?
Michel
-
This reply was modified 9 years, 4 months ago by
The topic ‘Parse error: syntax error, unexpected ‘[‘’ is closed to new replies.