dcramer / wp-lifestream

Lifestreaming plugin for Wordpress
http://forums.lifestrm.com/index.php
122 stars 31 forks source link

Parse error with "yield" above PHP 5.5 #110

Open coevolving opened 7 years ago

coevolving commented 7 years ago

This problem would seem to be relevant to the code version 1.0 dated 27 Jul 2011, for a problem I've fixed on Version 0.99.9.6 . I reported this at https://wordpress.org/support/topic/parse-error-with-yield-above-php-5-5/ , and reproduce it here for anyone who wants to do the update.

I recently migrated my blog from a host where PHP 5.5 was used, to a new host where PHP 5.6 is the default. I've stayed on Version 0.99.9.6 due to formatting changes that happened, subsequently.

On attempting to activate Version 0.99.9.6, I got an error:

Parse error: syntax error, unexpected 'yield' (T_YIELD), expecting identifier (T_STRING) in /home/PRIMARYDOMAIN/ADDONDOMAIN/blog/wp-content/plugins/lifestream/inc/core.php on line 2579

Searching on this error discovered two similar problems:

yield() method conflicts with PHP 5.5+ "yield" keyword at [(https://github.com/lonnieezell/Ocular-Template-Library/issues/23)] ; and

the used yield is a resereved keyword in PHP 5.5 at [(https://github.com/tractorcow/silverstripe-dynamiccache/issues/19)] .

Following through on the fix (on silverstrip-dynamiccache), the function yield was renamed to yieldControl.

In Lifestream inc/core/php, there are four instances of the function "yield", that I replaced with yieldControl. (There are also two instances of yield_many, which I've left alone).

Uploading and reactivating, I got and error message:

Parse error: syntax error, unexpected 'yield' (T_YIELD), expecting identifier (T_STRING) in /home/PRIMARYDOMAIN/ADDONDOMAIN/blog/wp-content/plugins/lifestream/extensions/amazon/extension.inc.php on line 11

So, it seems as though this error occurs in many of the the extension.inc.php files within the extensions directory. Making the change (including in many extensions for dead web sites) revived the plugin.