Viewing 15 replies - 1 through 15 (of 26 total)
  • Same, I’ve had the error for 24 hours now, even though I was already on the latest version on Monday when everything worked.

    • This reply was modified 10 months, 1 week ago by ldinforeso.

    Same!! Could it be after updating the WooCommerce plugin that it generates an error?

    Same here. It’s pretty sure that Woocommerce has an issue with PhP 8.1

    I have changed the PHP version to 8.0 and the problem continues.

    Same issue here. Had to go down to PHP 7.4 to fix it..

    Same… i worked yesterday, without any kind of problem, all day… but when I came home from the office I found the product pages without attributes, without footers and with many other errors… uff

    • This reply was modified 10 months, 1 week ago by greg5388.

    Exactly! I also just changed to PHP version 7.4 and it works. It must be an incompatibility error.

    Confirmed with PHP 8.1

    A pull request that can help: https://github.com/woocommerce/woocommerce/pull/44007

    • This reply was modified 10 months, 1 week ago by WPSolr free.

    The same issue cropped up for me this morning on all my sites.

    I have applied a temporary patch of my own making to the relevant woocommerce file, which is /plugins/woocommerce/src/Admin/RemoteInboxNotifications/ComparisonOperation.php.

    For those who want to try it themselves, replace the compare function in this file with the following (back up the old file first though).

    Seems to get around the issue, but would be interested to see if this works for others too.

    public static function compare( $left_operand, $right_operand, $operation ) {
    		switch ( $operation ) {
    			case '=':
    				return $left_operand === $right_operand;
    			case '<':
    				return $left_operand < $right_operand;
    			case '<=':
    				return $left_operand <= $right_operand;
    			case '>':
    				return $left_operand > $right_operand;
    			case '>=':
    				return $left_operand >= $right_operand;
    			case '!=':
    				return $left_operand !== $right_operand;
    			case 'contains':
    				if ( is_array( $left_operand ) && is_string( $right_operand ) ) {
    					return in_array( $right_operand, $left_operand, true );
    				}
                    if(is_string( $left_operand ) && is_string( $right_operand )) {
    				    return strpos( $right_operand, $left_operand ) !== false;
                    }
    			case '!contains':
    				if ( is_array( $left_operand ) && is_string( $right_operand ) ) {
    					return ! in_array( $right_operand, $left_operand, true );
    				}
                    if(is_string( $left_operand ) && is_string( $right_operand )) {
    				    return strpos( $right_operand, $left_operand ) === false;
                    }
    			case 'in':
    				if ( is_array( $right_operand ) && is_string( $left_operand ) ) {
    					return in_array( $left_operand, $right_operand, true );
    				}
                    if(is_string( $left_operand ) && is_string( $right_operand )) {
                        return strpos( $left_operand, $right_operand ) !== false;
                    }
    				
    			case '!in':
    				if ( is_array( $right_operand ) && is_string( $left_operand ) ) {
    					return ! in_array( $left_operand, $right_operand, true );
    				}
                    if(is_string( $left_operand ) && is_string( $right_operand )) {
    				    return strpos( $left_operand, $right_operand ) === false;
                    }
    		}
    
    		return false;
    	}
    Thread Starter rakeshdecipher

    (@rakeshdecipher)

    Temporarily changed to PHP version 7.4 , working for me .

    Will leave this thread open for a permanent fix

    Thanks @oliverpierceuk

    rakeshdecipher did you have to restore the site with the latest backup?

    gazzazzag your solution has made my day. Thanks!! It works perfect for me now until woocommerce fix the issue

    Also having the same issue with a website. Attempted the temp fix by @gazzazzag caused more errors, only fix was to drop PHP Version to 7.4.
    Tested this against PHP 8(8.1,8.2,8.3) all had the same errors.

    I used the solution that @gazzazzag posted and it worked for me . Many Thanks

    annsomarketingdigital

    (@annsomarketingdigital)

    hello, same probleme

Viewing 15 replies - 1 through 15 (of 26 total)
  • The topic ‘There has been a critical error on this website’ is closed to new replies.