• Resolved t0t0r0555

    (@t0t0r0555)


    I received this error on pages with certain images:
    PHP Warning: A non-numeric value encountered in /wp-includes/media.php on line 467

    I have done some troubleshooting by disabling all the plugins, reverting to default theme, check the image file name, check the media.php file, and conclude that the issue is caused by Elementor plugin (because only when Elementor is active this issue happens). Please note that I don’t change anything to WP core files.

    View post on imgur.com

    View post on imgur.com

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi,

    To rule out the possibility of a plugin or theme conflict, please deactivate all your plugins (besides Elementor) and see if it helps. If it solves the issue, reactivate them one by one to find the culprit. If it didn’t help, switch your theme (temporarily) to a default WordPress theme such as Twenty Sixteen and see if it makes any difference.

    Thread Starter t0t0r0555

    (@t0t0r0555)

    @lianakap Didn’t I just said above that I have done all those….

    Hi,

    Did you try all steps?
    if you did, please send me your system info.

    Hi,

    I have the same problem since 2 weeks ago.

    I edit to know which value has $h,

    print('current height: '.$current_height);
    print('ratio: '.$ratio);
    $h = max( 1, (int) round( $current_height * $ratio ) );

    and the print was this: current height: 105 ratio: 1 current height: 105 ratio: 0.77319587628866 current height: ratio: 0.97

    So the last print current height is nothing, that’s why replay that there is no value encountered. I decide to make this solution:

    // Very small dimensions may result in 0, 1 should be the minimum.
    if($current_height === ''){ $current_height = 1;}
    $w = max( 1, (int) round( $current_width * $ratio ) );
    $h = max( 1, (int) round( $current_height * $ratio ) );

    And works!

    • This reply was modified 3 years, 8 months ago by roddom67.
    • This reply was modified 3 years, 8 months ago by roddom67.
    Thread Starter t0t0r0555

    (@t0t0r0555)

    @lianakap The issue is solved but please investigate more on this as more and more people have told they have been experiencing the same thing.

    I’m experiencing this issue with Elementor too. I am a PHP programmer, but would prefer not to tamper with the default WordPress codebase.

    @t0t0r0555 How did you resolve this problem?

    Thread Starter t0t0r0555

    (@t0t0r0555)

    @saltysaurus I have written it here but somehow it disappeared. Probably some moderator deleted it? Idk 😅 hope this one doesn’t get deleted too…
    So I solve it by re-uploading the affected images with Enable Media Replace plugin in order not to mess up the upload date. Make sure the image is the same, the filename is the same, and the date is the same.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘PHP Warning: A non-numeric value encountered in /wp-includes/media.php’ is closed to new replies.