• I just updated PHP to 7.3.19 and when accessing ?update_feedwordpress=1 I get the following in my log file:

    2020/10/16 16:45:23 [error] 864#864: *21616 FastCGI sent in stderr:
    "tring, array given in /www/site/public_html/wp-includes/class-simplepie.php on line 2620
    PHP message: PHP Warning:  preg_match() expects parameter 2 to be string, array given in /www/site/public_html/wp-includes/class-simplepie.php on line 2620
    PHP message: PHP Warning:  preg_match() expects parameter 2 to be string, array given in /www/site/public_html/wp-includes/class-simplepie.php on line 2620
    PHP message: PHP Warning:  preg_match() expects parameter 2 to be string, array given in /www/site/public_html/wp-includes/class-simplepie.php on line 2620
    PHP message: PHP Warning:  count(): Parameter must be an array or an object that implements Countable in /www/site/public_html/wp-content/plugins/feedwordpress/syndicatedpost.class.php on line 1335
    PHP message: PHP Warning:  preg_match() expects parameter 2 to be string, array given in /www/site/public_html/wp-includes/class-simplepie.php on line 2620
    PHP message: PHP Warning:  preg_match() expects parameter 2 to be string, array given in

    I’m running WordPress 5.5.1, PHP 7.3.19-1~deb10u1, nginx/1.14.2, FWP 2020.0818.

    What could be wrong?

    • This topic was modified 4 years, 5 months ago by niska.
    • This topic was modified 4 years, 5 months ago by niska.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter niska

    (@niska)

    I solved the count() problem myself by adding the following line in syndicatedpost.class.php line 1334

                $frozen_values = get_post_custom_values('_syndication_freeze_updates', $old_post->ID);
                if (is_array($frozen_values)) {
                  $frozen = (count($frozen_values) > 0 and 'yes' == $frozen_values[0]);
               }

    I still haven’t found a solution for:

    PHP message: PHP Warning: preg_match() expects parameter 2 to be string, array given in /www/site/public_html/wp-includes/class-simplepie.php on line 2620

    • This reply was modified 4 years, 5 months ago by niska.
    • This reply was modified 4 years, 5 months ago by niska.
    Thread Starter niska

    (@niska)

    Heh. This is something that happens a lot; FeedWordPress has a relatively slow release cycle, so catching up with the latest and greatest PHP version is sometimes tough. With PHP 8.0 now released, I guess that the authors really need to take these ‘warnings’ seriously, because they’re very likely going to become ‘errors’ under PHP 8.0 (no more sloppy programming! ?? ).

    Anyway, I was searching through the forums to see if someone had a more elegant solution than mine, which was changing line 1335 to

    $frozen = (is_countable($frozen_values) && (count($frozen_values) > 0) and 'yes' == $frozen_values[0]);

    But I much rather prefer your solution!

    As for the bug you mention on WP’s Trac, well, I guess there is no other way but to wait for the WP Core Developer team to fix it. I think one might overload the WP_Simple_Pie class in functions.php and fix the issue with preg_match as a ‘temporary’ workaround, but I guess it’s too much trouble. Again, because the WP Core team is making sure that WP is fully PHP 8.0 compliant, my guess is that they will fix everything that throws a warning in PHP 7.X, lest it crashes with an error under 8.0…

    • This reply was modified 4 years, 3 months ago by Gwyneth Llewelyn. Reason: Typo on the plugin name fixed!
    • This reply was modified 4 years, 3 months ago by Gwyneth Llewelyn. Reason: Copy & paste of the full line 1335 had failed
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘count(): Parameter must be an array or an object that implements Countable’ is closed to new replies.