Support » Plugin: LiteSpeed Cache » [BUG} non numeric in media.cls

  • Resolved the5krunner

    (@the5krunner)


    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 614

    The page I need help with: [log in to see the link]

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Support qtwrk

    (@qtwrk)

    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.

    Thread Starter the5krunner

    (@the5krunner)

    hi
    add this to line 614 of what? I’m not THAT techie. just reporting an error i see in cpanel

    Thread Starter the5krunner

    (@the5krunner)

    php 8 or 8.1 are same

    Plugin Support qtwrk

    (@qtwrk)

    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

    Thread Starter the5krunner

    (@the5krunner)

    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?

    Plugin Support qtwrk

    (@qtwrk)

    					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 ];
    Thread Starter the5krunner

    (@the5krunner)

    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----
    Plugin Support qtwrk

    (@qtwrk)

    it seems you are still on v4.5 , please try upgrade to v4.6 first

    Thread Starter the5krunner

    (@the5krunner)

    i can’t.
    v4.6 kills my jetpack stats. i have registered a separate bug for that.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[BUG} non numeric in media.cls’ is closed to new replies.