• Resolved krut1

    (@krut1)


    We are using Smart Crawl with Hello-Elementor Theme.

    Sometimes I see such errors in our logs:

    [15-Jun-2020 07:46:23 UTC] PHP Fatal error:  Uncaught Error: Object of class WP_Error could not be converted to string in /wordpress/wp-includes/formatting.php:1117
    Stack trace:
    #0 /wordpress/wp-includes/formatting.php(4499): wp_check_invalid_utf8()
    #1 /wordpress/wp-content/plugins/smartcrawl-wordpress-seo/includes/tools/onpage.php(258): esc_attr()
    #2 /wordpress/wp-content/plugins/smartcrawl-wordpress-seo/includes/tools/onpage.php(158): Smartcrawl_OnPage->smartcrawl_canonical()
    #3 /wordpress/wp-includes/class-wp-hook.php(287): Smartcrawl_OnPage->smartcrawl_head()
    #4 /wordpress/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters()
    #5 /wordpress/wp-includes/plugin.php(478): WP_Hook->do_action()
    #6 /wordpress/wp-includes/general-template.php(2884): do_action()
    #7 /wordpress/wp-content/themes/hello-elementor/header.php(21): wp_head()
    #8 /wordpress/wp-includes/template.php(723): require_once('/var/www/wireca...')
    #9 /wordpress/wp-includes/template.php(672): load_template()
    #10 /wordpress/wp-includes/general-template.php(41): locate_template()
    #11 /wordpress/wp-content/themes/hello-elementor/index.php(15): get_header()
    #12 /wordpress/wp-includes/template-loader.php(106): include('/var/www/wireca...')
    #13 /wordpress/wp-blog-header.php(19): require_once('/var/www/wireca...')
    #14 /wordpress/index.php(17): require('/var/www/wireca...')
    #15 {main}
      thrown in /wordpress/wp-includes/formatting.php on line 1117

    Could you please look on it?

    P.S. We are using version 2.6.0.

    • This topic was modified 4 years, 5 months ago by krut1.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Hello @krut1

    I trust you’re doing well!

    Please make sure to have the latest versions of plugins on your site, including theme and WordPress core.

    I’ve tested the latest version of SmartCrawl and the Hello Elementor theme and can’t replicate the error on my end so it looks like it is specific to your site set up.

    Please check under what circumstances this error os showing up on your add, wich action triggers it?

    Once the error is back, backup your site and run a test for a conflict. Deactivate all plugins besides the SmartCrawl and see if the error will be there. If all is well enable the Elementor plugin and continues checking by enabling one plugin at a time, till the error will be back.

    Let us know how it went!

    Kind regards,
    Nastia

    Thread Starter krut1

    (@krut1)

    The problem is here: /wordpress/wp-content/plugins/smartcrawl-wordpress-seo/includes/tools/onpage.php:232

    Look on this function: smartcrawl_canonical(): there is such code:

    ...
    // Set decent canonicals for homepage, singulars and taxonomy pages.
    $canonical = $this->get_canonical_url();
    ...
    if ( ! empty( $canonical ) ) {
      $this->print_html_tag( '<link rel="canonical" href="' . esc_attr( $canonical ) . '" />' . "\n" );
    }
    ...

    The function get_canonical_url can return not only string, but also bool|mixed|string|WP_Error (according your documentation).

    The right check is: if ( is_string( $canonical ) && ! empty( $canonical ) ) { instead of simple if ( ! empty( $canonical ) ) {.

    Please fix ??

    Hello @krut1

    I trust you’re doing well!

    I’ve forwarded your suggestion to our developers so they could face a closer look.

    Thank you!

    Cheers,
    Nastia

    Thread Starter krut1

    (@krut1)

    Thank you. We will wait for the fix.

    Hello @krut1

    I hope you are doing well!

    Our developers have confirmed this bug. A future version of the plugin will contain the fix for this issue.

    For now, I’ve marked this ticket as resolved. If you do have any followup questions or require further assistance feel free to reopen it and let us know here.

    Kind regards,
    Nastia

    Thread Starter krut1

    (@krut1)

    Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘PHP Fatal error: bject of class WP_Error could not be converted to string’ is closed to new replies.