• airfoxtwo

    (@airfoxtwo)


    Hello,

    we have issues in several if statements with the following code pieces:
    method_exists( $sitepress, …..)

    We are using Polylang which defines the function “icl_object_id” and therefore the if fails with a fatal error, because $sitepress is null.

    Can you please add “… && $sitepress && ….” to the if statements which are beginning with “function_exists(‘icl_object_id’)”, so the error will be catched in the future?

Viewing 1 replies (of 1 total)
  • payalrajyaguru

    (@payalrajyaguru)

    Hi @airfoxtwo

    It looks like you are using WooCommerce based auction plugin on your site. We have checked the auction plugin with the?Polylang?plugin on our server. When both plugins are activated, the below fatal error comes.

    “Fatal error: Uncaught Error: method_exists(): Argument #1 ($object_or_class) must be of type object|string, null given”

    Please add the “is_object($sitepress)” code in “if condition” like below. It will fix this error.

    From
    if ( function_exists( ‘icl_object_id’ ) && method_exists( $sitepress, ‘get_default_language’ ) ) {

    To
    if ( function_exists( ‘icl_object_id’ ) && is_object($sitepress) && method_exists( $sitepress, ‘get_default_language’ ) ) {

    We will fix it and update the code in the next release of the auction plugin.

    Thank You

Viewing 1 replies (of 1 total)
  • The topic ‘issues on several if statements’ is closed to new replies.