• Resolved Abhishek

    (@abhishe11sharma)


    Hi WordPress Experts

    When I enable PHP 7.2 on my VPS, then I get Warning: count(): Parameter must be an array or an object that implements Countable in /home/*******/*****.com/wp-includes/media.php on line 1206

    Please tell me what should I do?

    Thanks

    • This topic was modified 7 years, 1 month ago by Abhishek.
Viewing 2 replies - 1 through 2 (of 2 total)
  • This issue was brought up in Trac Issue 43201 and has been fixed as it seems, but it will be implemented on the next update.

    Now to fix it you’ll either have to:

    1] Fall back into a previous PHP version to see if it is ok until the update arrives if possible.

    2] (This is not usually the way to do things or propose, as tampering with core files can easily break things bu in your case I don’t see another option) Edit the media.php file on line 1206 and change:

    from:

    if ( ! $src_matched || count( $sources ) < 2 ) {

    to:

    if ( ! $src_matched || ! is_array( $sources ) || count( $sources ) < 2 ) {

    Make sure to keep a backup of your media.php in either way to be safe.

    Thread Starter Abhishek

    (@abhishe11sharma)

    Hi Mr. Xenos (xkon) Konstantinos

    Thanks it’s work for me.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Error when I am using PHP 7.2’ is closed to new replies.