admin管理员组文章数量:1392110
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.
Code is look like this
$width = 300;
$height = 300;
$crop = 1;
if ( function_exists( 'wc_get_image_size' ) ) {
$size = wc_get_image_size( 'shop_catalog' );
$width = isset( $size['width'] ) ? $size['width'] : $width;
$height = isset( $size['height'] ) ? $size['height'] : $height;
$crop = isset( $size['crop'] ) ? $size['crop'] : $crop;
}
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.
本文标签: Warning A nonnumeric value encountered in theme functionsphp
版权声明:本文标题:Warning: A non-numeric value encountered in theme functions.php 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744780474a2624679.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论