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

@bigalownz bigalownz commented Jan 9, 2020

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

This comment has been minimized.

Copy link
Author

@bigalownz bigalownz commented Jan 21, 2020

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

This comment has been minimized.

Copy link

@talgalili talgalili commented Jan 21, 2020

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

This comment has been minimized.

Copy link
Owner

@radgeek 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 Feb 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.