Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new PHP error #112

Closed
bigalownz opened this issue Jan 9, 2020 · 3 comments
Closed

new PHP error #112

bigalownz opened this issue Jan 9, 2020 · 3 comments

Comments

@bigalownz
Copy link

updated feedwordpress with the resent patch fix

all old errors are gone apart from 1 error

Got error 'PHP message: PHP Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/wp-content/plugins/feedwordpress/syndicatedpost.class.php on line 708\n

running :
wordpress 5.3.2
PHP 7.2.26
mysql 8.0.18
Apache 2.4.41

adlerweb added a commit to adlerweb/feedwordpress that referenced this issue Jan 19, 2020
@bigalownz
Copy link
Author

syndicatedpost.class.php fix ??

is_countable() has been introduced in PHP 7.3

line 708 can be change from

if (count($aa) > 0) :

change to

if (is_countable($aa) && count($aa) > 0) :

line 906

if (count($refs) > 0) :

change to

if (is_countable($refs) && count($refs) > 0) :

line 1304

if (count($seen) > 0) :

change to

if (is_countable($seen) && count($seen) > 0) :

@talgalili
Copy link
Contributor

talgalili commented Jan 21, 2020 via email

radgeek pushed a commit that referenced this issue Feb 2, 2020
…Press polyfill function to avert PHP warnings.
@radgeek
Copy link
Owner

radgeek commented Feb 2, 2020

@talgalili : Fortunately not. Only PHP 7.3+ provides is_countable() as a native function. But the WordPress core from WP 4.9.6 onward provides it by means of a polyfill function when running under earlier versions of PHP. (Check out wp-includes/compat.php.) I availed myself of the GPL and have also copied over the function from WordPress 4.9.6+ into FWP's compatability.php module, so that it will also be available on versions of WordPress < 4.9.6. So -- hopefully -- it should be possible to use it where convenient, without trashing backward compatibility. (Consequently, I have also adopted @bigalownz 's suggested changes in the commit above.)

@radgeek radgeek closed this as completed Feb 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants