Support » Plugin: LiteSpeed Cache » [BUG} non numeric in media.cls
[BUG} non numeric in media.cls
-
I am getting this error in my cpanel
[STDERR] PHP warning a non-numeric value was encountered in <path>litespeed-cache/src/media.cls.php on line 614The page I need help with: [log in to see the link]
-
please try add this before that line 614
error_log('---mark----', 3 , '/path/to/your/public_html/lscwp.log'); error_log( print_r($dimensions, TRUE), 3 , '/path/to/your/public_html/lscwp.log'); error_log('---mark----', 3 , '/path/to/your/public_html/lscwp.log');
and wait for it happens again , after it happens check , search in error log for
---mark---
and post the content of it.hi
add this to line 614 of what? I’m not THAT techie. just reporting an error i see in cpanelphp 8 or 8.1 are same
PHP warning a non-numeric value was encountered in <path>litespeed-cache/src/media.cls.php on line 614
this file , line 614, add it before that line
this is line 614 of media.cls.php
$ori_height = intval( $ori_height * $attrs[ ‘width’ ] / $ori_width );
and it seems to be in the middle of a line of code
ie all of this which starts at line 604
// Add missing dimensions if ( defined( 'LITESPEED_GUEST_OPTM' ) || $this->conf( Base::O_MEDIA_ADD_MISSING_SIZES ) ) { if ( empty( $attrs[ 'width' ] ) || $attrs[ 'width' ] == 'auto' || empty( $attrs[ 'height' ] ) || $attrs[ 'height' ] == 'auto' ) { Debug2::debug( '[Media] ⚠️ Missing sizes for image [src] ' . $attrs[ 'src' ] ); $dimensions = $this->_detect_dimensions( $attrs[ 'src' ] ); if ( $dimensions ) { $ori_width = $dimensions[ 0 ]; $ori_height = $dimensions[ 1 ]; // Calculate height based on width if ( ! empty( $attrs[ 'width' ] ) && $attrs[ 'width' ] != 'auto' ) { $ori_height = intval( $ori_height * $attrs[ 'width' ] / $ori_width ); } elseif ( ! empty( $attrs[ 'height' ] ) && $attrs[ 'height' ] != 'auto' ) { $ori_width = intval( $ori_width * $attrs[ 'height' ] / $ori_height ); } $attrs[ 'width' ] = $ori_width; $attrs[ 'height' ] = $ori_height; $new_html = preg_replace( '#(width|height)=(["\'])[^\2]*\2#', '', $match[ 0 ] ); $new_html = str_replace( '<img ', '<img width="' . $attrs[ 'width' ] . '" height="' . $attrs[ 'height' ] . '" ', $new_html ); Debug2::debug( '[Media] Add missing sizes ' . $attrs[ 'width' ] . 'x' . $attrs[ 'height' ] . ' to ' . $attrs[ 'src' ] ); $this->content = str_replace( $match[ 0 ], $new_html, $this->content ); $match[ 0 ] = $new_html; } } }
so do i add it as line 605?
if ( $dimensions ) { $ori_width = $dimensions[ 0 ];
between these 2 lines
like
if ( $dimensions ) { error_log('---mark----', 3 , '/path/to/your/public_html/lscwp.log'); error_log( print_r($dimensions, TRUE), 3 , '/path/to/your/public_html/lscwp.log'); error_log('---mark----', 3 , '/path/to/your/public_html/lscwp.log'); $ori_width = $dimensions[ 0 ];
how about this:
---mark----Array ( [0] => 320 [1] => 200 [2] => 18 [3] => width="320" height="200" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 511 [1] => 248 [2] => 18 [3] => width="511" height="248" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 320 [1] => 200 [2] => 18 [3] => width="320" height="200" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 511 [1] => 248 [2] => 18 [3] => width="511" height="248" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 320 [1] => 200 [2] => 18 [3] => width="320" height="200" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 511 [1] => 248 [2] => 18 [3] => width="511" height="248" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 320 [1] => 200 [2] => 18 [3] => width="320" height="200" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 511 [1] => 248 [2] => 18 [3] => width="511" height="248" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 320 [1] => 200 [2] => 18 [3] => width="320" height="200" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 511 [1] => 248 [2] => 18 [3] => width="511" height="248" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 320 [1] => 200 [2] => 18 [3] => width="320" height="200" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 511 [1] => 248 [2] => 18 [3] => width="511" height="248" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 320 [1] => 200 [2] => 18 [3] => width="320" height="200" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 511 [1] => 248 [2] => 18 [3] => width="511" height="248" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 320 [1] => 200 [2] => 18 [3] => width="320" height="200" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 511 [1] => 248 [2] => 18 [3] => width="511" height="248" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 320 [1] => 200 [2] => 18 [3] => width="320" height="200" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 511 [1] => 248 [2] => 18 [3] => width="511" height="248" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 320 [1] => 200 [2] => 18 [3] => width="320" height="200" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 511 [1] => 248 [2] => 18 [3] => width="511" height="248" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 320 [1] => 200 [2] => 18 [3] => width="320" height="200" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 511 [1] => 248 [2] => 18 [3] => width="511" height="248" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 320 [1] => 200 [2] => 18 [3] => width="320" height="200" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 511 [1] => 248 [2] => 18 [3] => width="511" height="248" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 320 [1] => 200 [2] => 18 [3] => width="320" height="200" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 511 [1] => 248 [2] => 18 [3] => width="511" height="248" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 320 [1] => 200 [2] => 18 [3] => width="320" height="200" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 511 [1] => 248 [2] => 18 [3] => width="511" height="248" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 320 [1] => 200 [2] => 18 [3] => width="320" height="200" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 511 [1] => 248 [2] => 18 [3] => width="511" height="248" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 320 [1] => 200 [2] => 18 [3] => width="320" height="200" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 511 [1] => 248 [2] => 18 [3] => width="511" height="248" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 320 [1] => 200 [2] => 18 [3] => width="320" height="200" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 511 [1] => 248 [2] => 18 [3] => width="511" height="248" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 320 [1] => 200 [2] => 18 [3] => width="320" height="200" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 511 [1] => 248 [2] => 18 [3] => width="511" height="248" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 320 [1] => 200 [2] => 18 [3] => width="320" height="200" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 511 [1] => 248 [2] => 18 [3] => width="511" height="248" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 320 [1] => 200 [2] => 18 [3] => width="320" height="200" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 511 [1] => 248 [2] => 18 [3] => width="511" height="248" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 320 [1] => 200 [2] => 18 [3] => width="320" height="200" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 511 [1] => 248 [2] => 18 [3] => width="511" height="248" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 320 [1] => 200 [2] => 18 [3] => width="320" height="200" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 511 [1] => 248 [2] => 18 [3] => width="511" height="248" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 320 [1] => 200 [2] => 18 [3] => width="320" height="200" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 511 [1] => 248 [2] => 18 [3] => width="511" height="248" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 320 [1] => 200 [2] => 18 [3] => width="320" height="200" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 511 [1] => 248 [2] => 18 [3] => width="511" height="248" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 320 [1] => 200 [2] => 18 [3] => width="320" height="200" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 511 [1] => 248 [2] => 18 [3] => width="511" height="248" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 320 [1] => 200 [2] => 18 [3] => width="320" height="200" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 511 [1] => 248 [2] => 18 [3] => width="511" height="248" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 320 [1] => 200 [2] => 18 [3] => width="320" height="200" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 511 [1] => 248 [2] => 18 [3] => width="511" height="248" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 320 [1] => 200 [2] => 18 [3] => width="320" height="200" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 511 [1] => 248 [2] => 18 [3] => width="511" height="248" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 320 [1] => 200 [2] => 18 [3] => width="320" height="200" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 511 [1] => 248 [2] => 18 [3] => width="511" height="248" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 320 [1] => 200 [2] => 18 [3] => width="320" height="200" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 511 [1] => 248 [2] => 18 [3] => width="511" height="248" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 320 [1] => 200 [2] => 18 [3] => width="320" height="200" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 511 [1] => 248 [2] => 18 [3] => width="511" height="248" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 320 [1] => 200 [2] => 18 [3] => width="320" height="200" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 511 [1] => 248 [2] => 18 [3] => width="511" height="248" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 320 [1] => 200 [2] => 18 [3] => width="320" height="200" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 511 [1] => 248 [2] => 18 [3] => width="511" height="248" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 320 [1] => 200 [2] => 18 [3] => width="320" height="200" [bits] => 8 [mime] => image/webp ) ---mark-------mark----Array ( [0] => 511 [1] => 248 [2] => 18 [3] => width="511" height="248" [bits] => 8 [mime] => image/webp ) ---mark----
it seems you are still on v4.5 , please try upgrade to v4.6 first
i can’t.
v4.6 kills my jetpack stats. i have registered a separate bug for that.
- The topic ‘[BUG} non numeric in media.cls’ is closed to new replies.