• Hello,

    on one of my WP sites, I’m constantly getting PDOExceptions in the error log. The error is always the same, only row ID differs:

    PHP Fatal error:  Uncaught PDOException: SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect integer value: '' for column database.wp_independent_analytics_resources.cached_author_id at row 1234 in .../wp-content/plugins/independent-analytics/vendor/illuminate/database/Connection.php:446

    The corresponding row is always for a custom type post that and it no longer exists in the posts table:

                   id: 1234
             resource: singular
          singular_id: 9876
            author_id: NULL
      virtual_page_id: NULL
         date_archive: NULL
         search_query: NULL
            post_type: NULL
              term_id: NULL
        not_found_url: NULL
         cached_title: Some title
           cached_url: https://...
          cached_type: custom_ad
    cached_type_label: Inzerát
     cached_author_id: 5678
        cached_author: Abc Xyz
      cached_category: NULL
          cached_date: 2024-03-22

    (some values above were anonymized).

    I’m not sure, if the post yet existed when the error occurred or not. The error is always caused by following request:

    POST /wp-json/iawp/search

    Could you please check where the problem is? Thank you very much!

    • This topic was modified 3 months, 2 weeks ago by mkrause.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Ben Sibley

    (@bensibley)

    Thanks for bringing this to our attention.

    Does the cached_url point to a URL that still exists on the site? And if you visit that URL, does it trigger a new error in the debug log?

    Thread Starter mkrause

    (@mkrause)

    Hi Ben, the URL in cached_url doesn’t exist anymore (these are user-published ads and are deleted by the owner when the item is sold). Calling the URL again doesn’t trigger a new error (normal 404 page is displayed).

    I tried to identify the moment when it appears, but without success. It occurred to me that it might be related to the use of the page caching plugin (WP-Optimize). Maybe some kind of race condition between deleting the post and removing the page from the cache? Not sure, just an idea.

    Plugin Author Ben Sibley

    (@bensibley)

    I think what’s happening is that WP-Optimize is serving a cached copy of a deleted page, at least temporarily. I’m sure that they clear the cache when pages are deleted through the admin, but I’m wondering if the method of deletion is different since these pages are being deleted by users. For instance, if these users are deleting the pages from a specialized front-end interface.

    Based on the error, WP must be telling IA it’s a valid page still because we use functions like is_singular() and is_404() to find the page type. It sounds like is_singular() returns true, but when the post is looked up, the author can’t be found, and saving an empty string in cached_author_id causes a fatal error. I’m guessing that’s just the first one to completely fail, but the other fields would cause errors too.

    Thread Starter mkrause

    (@mkrause)

    When the user deletes the post, the standard WordPress method wp_delete_post function is used, so there should be no difference for WP-Optimize. It is also strange that the cached_author_id is NULL because only the post was deleted, but the author still exists.

    Plugin Author Ben Sibley

    (@bensibley)

    Could you reach out to support@independentwp.com to discuss this further? I need to ask about some potentially sensitive data about the site that isn’t appropriate to share on the public forum.

    Thank you!

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.