• Resolved nebbens

    (@nebbens)


    I would like to request a code change. I would like to request that backticks be added to the column names in the method: Jetpack_Sitemap_Librarian::get_sanitized_post_columns($wpdb). I’m sure it can be done different ways, but I solved it temporarily by changing line 483 to:

    return '' . implode( ',', array_map( 'esc_sql', $columns ) ) . '';

    I was getting a sql error due to having a column name that is a keyword (order) in my wp_posts table. I’m not sure what plugin added that column in the past (nor whether it is even used still), but escaping the column names takes care of the problem.

    This problem was discovered when it conflicted with Solid Backups Legacy plugin causing the backup to fail.

    Thank you for considering this change.

Viewing 1 replies (of 1 total)
  • Plugin Support Alin (a11n)

    (@alinclamba)

    Hi @nebbens,

    Thanks for the detailed report, and for sharing the workaround you tested, that’s really helpful.

    I see what you mean about the column name causing issues when it overlaps with a reserved SQL keyword like order. That can definitely lead to query errors in cases like this.

    Since this involves a change in how queries are built in Jetpack core, the best next step would be to open an issue on our GitHub repo so it can be reviewed by the development team:

    https://github.com/Automattic/jetpack/issues

    If you include the method you mentioned, Jetpack_Sitemap_Librarian::get_sanitized_post_columns(), along with your example and the adjustment you made, that should give them enough context to evaluate whether this can be safely improved.

    In the meantime, your workaround sounds like a reasonable temporary solution for your setup.

    Thanks again for taking the time to report this.

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.