Posted by jeremyflint 3 years 3 weeks ago
Here is the error message:
Parse error: syntax error, unexpected '&', expecting T_VARIABLE or '$' in /home/.caradoc/jflint/barcampbirmingham.org/wp-content/plugins/wordpress_mobile_pack/plugins/wpmp_switcher/wpmp_switcher.php on line 300




Posted by James Pearce 3 years ago
Hi Jeremy
Can you just let me know what version of PHP you are running (if you know it) and on what platform?
The line is this:
foreach($domains as &$domain) { ...
Which is valid PHP (the & means the variable is a reference)... unless perhaps you have an older version.
As a quick solution for you, simply remove the & from that line. (Although there may be others elsewhere in the code).
We tested on PHP 5.x
James
Posted by James Pearce 3 years ago
Indeed, having consulted the PHP docs, I can confirm that that's almost certainly your issue.
Do you have an opportunity to upgrade the version of PHP you are running on?
In the meantime I will update the article to make it very clear that PHP5.x is a requirement.
If there is sufficient demand (e.g. on this forum) we can update the plugin to make it PHP4.x compliant.
Thanks for the feedback and apologies for such an early bath for you for now ;-)
Posted by jeremyflint 3 years ago
Yeah, it looks like that site is running on PHP 4.4.x. Thanks for the heads up.
Posted by Three Star Dave 3 years ago
Ugh. Just tried this plug-in, had this error, confirmed my host is running on 4.4.9. Oh, well, back to the drawing board.
Posted by neogarfield 3 years ago
Hey,
I'm getting the same error. I guess I'm running on PHP4.x.x something too... Could we have a version of this awesome plugin for PHP4 please? It would be really great if you could do that!
Or detailed instructions on how to alter the plugin so that it works for PHP4...
Cheers,
Mohan
Posted by atrasatti 2 years ago
Mobile Genius
Hi Mohan,
I looked into the code over the weekend and the problem is not limited to the foreach loops, we also use functions such as stripos that were introduced in PHP 5.
I don't think it will be a 2-3 lines change that will fix the problem.
Speaking with other users, I was pointed to this article that explains how to move to PHP 5 if you are using 1and1 hosting, it's quite easy and it was confirmed it works fine: How To: Run PHP5 at 1and1.com
Posted by Jairus 2 years ago
Hey, I'm having this problem, but under PHP5. Any thoughts?
Posted by pieman3 2 years ago
I've had the same problem with PHP5 but no one has answered after over a week. Hopefully someone will take some time to help us out soon!!!
Posted by James Pearce 2 years ago
Hi guys,
I am really surprised if you are seeing this on PHP5 (and apologies for the delay in replying).
Is it the same error on the same line? Do you have multiple versions of PHP on the same machine? (I just want to make sure we know which version is being invoked by the web server).
What version of PHP is it exactly?
Thanks
James
Posted by James Pearce 2 years ago
Hi, was there any update on this? Were you able to accurately determine the version and sub-version of your PHP install?
We've logged the requirement to get PHP4-compatible here:
http://www.assembla.com/spaces/wordpress-mobile-pack/tickets/4
It's not currently scheduled, pending more feedback on how important this is for the general community.
Thanks
JP