• After I upgraded WordPress to the latest version 5.4.1 and PHP 7.4 I am having this error in error_log file

    PHP Warning:  A non-numeric value encountered in /home/public_html/abcdefg/wp-includes/media.php on line 458
    PHP Warning:  A non-numeric value encountered in /home/public_html/abcdefg/wp-includes/media.php on line 468

    I find the following lines
    On line 458
    if ( (int) round( $current_width * $larger_ratio ) > $max_width || (int) round( $current_height * $larger_ratio ) > $max_height ) {

    and On line 468
    $h = max( 1, (int) round( $current_height * $ratio ) );

    The error was not recorded earlier (even with 7.4 PHP) and seems to be from the date I updated wordpress to 5.4.1

Viewing 7 replies - 1 through 7 (of 7 total)
  • @cmsnext

    This is not an error, it’s a warning. You can suppress warnings coming from php if you choose. It’s not compatible with your php version, so downgrading would fix it, but not recommended.
    https://aristath.github.io/blog/wp-hide-php-errors

    It’s likely a plugin or your theme accessing this method.

    There have been patches released for this issue :
    https://gist.github.com/BrianHenryIE/754f75c1f79d721a0f2721c9f20a7779

    Thread Starter cmsnext

    (@cmsnext)

    @corrinarusso Thanks for the response. Ya I want to know why this warning is coming up. Hence wish to know which plugin/code is responsible. Any idea how to find what is causing this warning? This issue was not present earlier. Seems to have started after I updated to WP 5.4.1 before this the error was not present. So may be either that or some plugin incompatibility. But its a live site and cant keep site down to test by disabling each plugin as the warning is being added to error log every 10-15 minutes

    @cmsnext

    If you don’t have a sandbox for a website, then this is a good opportunity to do so!
    Especially if the site is that critical.
    Does your host providing a staging setup up process ? For example, Siteground provides staging sites for all live sites “with just one click”.
    Otherwise, create a sub-domain at your host, and migrate the live site over to the staging site. The password protect your staging site and then you can do all your testing etc. Depending on how many plugins you have installed, and your server set up, and your WP core, etc, etc there can be many variables that could create this warning.

    I don’t see you being able to isolate this properly without resetting your theme and plugins, etc and adding functionality back in one by one.

    If you have COVID time to do this, and it interests you, then go for it. Otherwise, I would ignore it.

    Thread Starter cmsnext

    (@cmsnext)

    Thanks @corrinarusso. Ya I think will create a staging site and test one plugin after another. Will get back if I find what is causing this. Thanks for the help

    • This reply was modified 4 years, 6 months ago by cmsnext.

    Hello. I have the same error message and, in my case, the message dissapear when I deactive WPML Media Translation, but I need to use it. I don’t know how deactivate the message. Could you tell me, please?. Thanks

    @pirivera

    Again, there is low likelyhood that this PHP Warning will prevent the plugin or your site from functioning properly. So you should be able to still use it.
    However, to dig deeper into the issue, you could let them know over at WPML :
    https://wpml.org/documentation/getting-started-guide/media-translation/
    https://wpml.org/forums/forum/english-support/

    Yes, the site function well, the message appear only in the WordPress dashboard. Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘PHP 7.4 – WordPress 5.4.1 – media.php error’ is closed to new replies.