Skip to:
Content
Pages
Categories
Search
Top
Bottom

‘Incorrect DATETIME value: 0’ error when viewing new forum


  • redevelop
    Participant

    @redevelop

    Hi there, I’m experiencing the following error after installing bbPress on my local PC (the site is not public) and setting up a test forum:

    “WordPress database error Incorrect DATETIME value: ‘0’ for query SELECT p.ID FROM wp_posts AS p WHERE p.post_date < ‘0’ AND p.post_type = ‘forum’ AND ( p.post_status = ‘publish’ OR p.post_status = ‘private’ OR p.post_status = ‘hidden’ ) ORDER BY p.post_date DESC LIMIT 1 made by require(‘wp-blog-header.php’), require_once(‘wp-includes/template-loader.php’), include(‘/themes/twentytwenty/singular.php’), get_header, locate_template, load_template, require_once(‘/themes/twentytwenty/header.php’), wp_head, do_action(‘wp_head’), WP_Hook->do_action, WP_Hook->apply_filters, adjacent_posts_rel_link_wp_head, adjacent_posts_rel_link, get_adjacent_post_rel_link, get_adjacent_post”

    My setup:
    A new WordPress 5.4 install with no other self-installed plugins
    Theme: Twenty Twenty
    Windows 10
    PHP 7.4.4
    MySQL 8.0.19
    I created a forum called ‘Test Forum1’ & this appears in the WordPress Admin. When I click the permalink to view the forum I see the above error on a blank white screen.

    Any advice much appreciated – thanks.

Viewing 13 replies - 1 through 13 (of 13 total)

  • redevelop
    Participant

    @redevelop

    Just to add – bbPress version 2.6.4.


    Robin W
    Moderator

    @robin-w

    try

    dashboard>settings>permalink and just click save – this resets the permalinks.


    redevelop
    Participant

    @redevelop

    Thanks for coming back to me. Unfortunately that doesn’t seem to have resolved, I’ve also cleared the browser cache. The permalinks are set to ‘Plain’.

    So the test forum URLs are below, both give the same error:

    http://localhost/sitename/?forum=forum-test1

    http://localhost/sitename/?forum=forumtest2

    Thanks for your help.


    Robin W
    Moderator

    @robin-w

    ok, let’s try adding this

    add_filter( 'bbp_verify_nonce_request_url', 'my_bbp_verify_nonce_request_url', 999, 1 );
    function my_bbp_verify_nonce_request_url( $requested_url )
    {
        return 'http://localhost:8888' . $_SERVER['REQUEST_URI'];
    }

    Put this in your child theme’s function file – or use

    Code Snippets


    redevelop
    Participant

    @redevelop

    Thanks for the reply – sorry for the delay, had to remind myself of child themes setup 🙂
    Still the same error sadly…

    Viewing the default pages and ‘Hello World’ post is OK though, if any help.


    Robin W
    Moderator

    @robin-w

    hmmm…ok bbpress can have issues on local sites, which is what I hoped then above would clear.

    so ‘Viewing the default pages and ‘Hello World’ post is OK though, if any help. ‘ is that same as before, or is helped by the above and was wrong before?


    redevelop
    Participant

    @redevelop

    Yes – viewing the default pages & post was possible before creating the child theme…


    Robin W
    Moderator

    @robin-w

    ok, site specific issue, without being able to view the site, I can’t really help further


    redevelop
    Participant

    @redevelop

    OK thanks for looking at this anyway. I’m now thinking it may relate to the MySQL 8 settings, specifically SQL_MODE which included ‘STRICT_TRANS_TABLES’ (strict SQL mode > no zero dates).

    I’ve tried removing this setting from SQL_MODE (for both session & global), but this doesn’t seem to resolve – when logging in to MySQL as the WordPress user I still get this error

    Error Code: 1525. Incorrect DATETIME value: ‘0’

    when running the query:

    SELECT p.ID FROM wp_posts AS p WHERE p.post_date < ‘0’ AND p.post_type = ‘forum’ AND ( p.post_status = ‘publish’ OR p.post_status = ‘private’ OR p.post_status = ‘hidden’ ) ORDER BY p.post_date DESC LIMIT 1;

    If I make any more progress I’ll post it here 🙂


    Robin W
    Moderator

    @robin-w

    thanks for the update, and yes please come back if you get any further


    jensksa
    Participant

    @jensksa

    I am experiencing a similar problem.

    I get the exact same error message, although the forum does render (ie. no blank page).

    As far as I understand, it appears to be because bbp_remove_adjacent_posts does not get called, and it tries to fetch adjacent posts with a default post_date of 0.


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    MySQL 8 removing support for zero dates is the problem.

    WordPress is incompatible with NO_ZERO_DATE mode, but it being dropped entirely means these errors are going to pop up.

    See: https://bbpress.trac.wordpress.org/ticket/3354

    Going to patch and fix for 2.6.6, likely for a release next week.


    redevelop
    Participant

    @redevelop

    Thanks for everyone’s help on this, sorry I’ve taken an age to reply – had some problems with my forum login.

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