Warning: A non-numeric value encountered in theme functions.php

by PratapAmitSingh   Last Updated September 12, 2019 05:08 AM

Warning: A non-numeric value encountered in functions.php

I am using php 7.1.31. I am using Linux Centos Server. I have also tried to type casting. but not worked. When I have changed php version to 5.6. Same code was working.

foreach ( $product_size as $k => $w ) {
                $w = intval( $w );
                if ( isset( $width ) && $width > 0 ) {
                    $h = round( $height * $w / $width );
                } else {
                    $h = $w;
                }
                add_image_size( $k, $w, $h, $crop );
            }

Warning: A non-numeric value encountered in theme/functions.php on line 165. I am getting issue in

$h = round( $height * $w / $width );

I tried to change it to

$h = (int)( $height * $w / $width );

but still same warning is coming.



Related Questions


Wordpress Theme Development

Updated September 27, 2017 07:08 AM


Alignment Problem

Updated February 20, 2018 23:08 PM