Support » Plugin: Yoast SEO » Database Error caused by Yoast

  • Resolved chrimby

    (@chrimby)



    Hi there,

    wordpress says, my website has a database error:

    [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘%1$s )’ at line 3]
    SELECT internal_link_count, incoming_link_count, object_id FROM wp_yoast_seo_meta WHERE object_id IN ( %1$s )

    Is this a problem caused by Yoast Plugin or with my server?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Indeed, i got the same error on a project i’m working right now.
    After a quick check of the 4.8.2 update, i’ve seen that was changed the file wp-db.php in a point about the preparing queries.
    Infact, from:

    https://codex.wordpress.org/Version_4.8.2

    $wpdb->prepare() can create unexpected and unsafe queries leading to potential SQL injection (SQLi). WordPress core is not directly vulnerable to this issue, but we’ve added hardening to prevent plugins and themes from accidentally causing a vulnerability. Reported by Slavco.

    I suspect that’s related to the mentioned problem.

    • This reply was modified 1 year, 2 months ago by  Rics1983.

    Something Stupid

    • This reply was modified 1 year, 2 months ago by  enky.
    sakshi

    (@wordpressbeta)

    Hi,

    Try This in File wordpress-seo\admin\links\class-link-column-count.php in function name get_results().

    Please change the following query.

    Before Changing query:

    $results = $wpdb->get_results(
    $wpdb->prepare( ‘
    SELECT internal_link_count, incoming_link_count, object_id
    FROM ‘ . $storage->get_table_name() . ‘
    WHERE object_id IN ( %1$s )’,
    implode( ‘,’, $post_ids )
    ),
    ARRAY_A
    );

    After Changing query:

    $imploded_post_ids = implode( ‘,’, $post_ids );
    $results = $wpdb->get_results(
    ‘SELECT internal_link_count, incoming_link_count, object_id
    FROM ‘ . $storage->get_table_name() . ‘
    WHERE object_id IN ( ‘.$imploded_post_ids.’)’,ARRAY_A
    );
    and check.
    This will help you.

    I would wait for a reply by the plugin author.
    That’s not a safe solution, just temporary workaround.

    Plugin Support marcanor

    (@marcanor)

    Hello,
    This issue has been corrected in the latest release of the Yoast plugin. Please update to Yoast SEO 5.4.1.

    Thanks!

    Same thing happend on my blog. Is that mean when i update to Yoast SEO 5.4.1, this error will disappear? @ plugin support

    it fixed !

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Database Error caused by Yoast’ is closed to new replies.