WordPress.org

Ready to get started?Download WordPress

Forums

Bug with backdated post before 1 January 1970 - wp2.8 (23 posts)

  1. carboncopy
    Member
    Posted 5 years ago #

    We are encountering problems when changing the published date to before 1 January 1970.

    For example,

    The post is backdated to 2 April 1968
    Link :
    http://bibliotheca.limkitsiang.com/1968/04/02

    However, it appears on the web saying its published today (1 July 2009).
    Example:
    Posted by Curator in Education a statement released on July 1st, 2009

    If post is after 1 January 1970, there's no problem.

    Did not have this problem initially (earlier WP)

    To proof my point, please check the two following links:
    http://bibliotheca.limkitsiang.com/1969/12/
    http://bibliotheca.limkitsiang.com/1970/01/

  2. esmi
    Forum Moderator
    Posted 5 years ago #

    Could this be a PHP issue? Unix timestamps are based on January 1 1970 00:00:00 GMT.

  3. It wouldn't be PHP, but the server, actually. To get a date pre 1/1/1970, you're actually putting in negative timestamps. And Windows barfs on those, IIRC.

    That said, it worked before upgrading to 2.8, so there may be a problem with 2.8 and negative time stamps.

  4. carboncopy
    Member
    Posted 5 years ago #

    The server is running :
    Linux
    Lighttpd
    mysql
    php

    Is this the place to do bug report?

  5. carboncopy
    Member
    Posted 5 years ago #

    I confirmed this works fine on WP 2.7

  6. Report the bug here: http://core.trac.wordpress.org/

  7. gorky5
    Member
    Posted 5 years ago #

    I spoke to Matt Mullenweg about this very issue a couple of days ago at WordCamp UK in Cardiff. He said it's not a problem with the WP core, and if you can't get pre 1969 dates displaying properly then it's to do with your host (he seemed aware of the talk around the issue).

    Matt mentioned a Benjamin Franklin historical blog powered by WP which works fine, but I've been unable to find it. He also said it's OK to have dates going right back to year zero (pre-Jesus blogging might be a problem, he said).

    My site, the Beatles Bible, isn't displaying pre-1969 dates properly either (see, for example http://www.beatlesbible.com/1965/01/). I used the MySQL query workaround detailed by Hallsofmontezuma in this thread: http://wordpress.org/support/topic/159409
    It's not ideal, however, as it doesn't seem to allow data formatting (eg 20 January 1965, rather than 1965-01-20 22:00:18, which includes the time down to the second), and the breadcrumb trail is effectively useless (it displays today's date rather than January 1965).

    I'll give my hosting company a shout and see if they can help.

    Interestingly, http://core.trac.wordpress.org/ticket/2149 was recently closed - not because, as Matt claims, the problem is fixed, but because the patch was out of date. It seems odd, possibly unhelpful, to change the status to wontfix/closed rather than needs-patch or even fixed.

  8. gorky5
    Member
    Posted 5 years ago #

    Just to update this, I have a dev area on my site with a separate install of WP, which I use to check theme changes, widgets etc in a live environment. I rolled this back to 2.7.1, and the pre-1970 datestamps worked absolutely fine.

    So it seems that the problem is a new(ish) one, specific to WP 2.8x.

    If anyone cleverer than me can navigate the trac site I'd be grateful if this bug could be reported. Alternatively, if the patch detailed in ticket 2149 could be updated that would be useful.

  9. gosunatxrea
    Member
    Posted 5 years ago #

    Try "http://core.trac.wordpress.org/attachment/ticket/10332/functions.php.diff", it works for me.
    (I am new at php and wordpress...)

  10. dougvdotcom
    Member
    Posted 5 years ago #

    @gosunatxrea: The link you provided is pretty much the best solution to this problem. Removing those lines from wp-includes/functions.php will prevent dates from looking incorrect in most themes and the WP admin section.

    The lines of code that are indicated for removal check to see if the Unix timestamp of a post is less than 0 (that is, before the Unix epoch of midnight, January 1, 1970). If so, the post's date is automatically set to be the time, right now.

    The code block in question is noted as a "sanity check for PHP 5.1.0", but I don't see why that's needed, as to the best of my knowledge, PHP 5.1.0 doesn't have a problem with negative timestamps.

  11. gosunatxrea
    Member
    Posted 5 years ago #

    Win32 / fresh install : date_i18n() outputs error
    (http://core.trac.wordpress.org/ticket/7186)

    To correct this bug, that code block was added.

    that code block was modified (added) in :
    Revision 8199 Fix date() warning on Windows. Props ozh. fixes #7186
    Revision 8742 date_i18n() fixes. Props nbachiyski. fixes #8153
    Revision 9616 Use localized dates on General Options page. Props nbachiyski. fixes #8153
    Revision 9742 date_i18n() fixes. Props nbachiyski. fixes #8153

    Does it only has to do with php 4 and apache on win32 ?

  12. gorky5
    Member
    Posted 5 years ago #

    gosunatxrea - I can't thank you enough for that! Commenting out those lines worked a treat. Hopefully this bug will be fixed in the WP core during future revisions.

  13. herko
    Member
    Posted 4 years ago #

    The uncommenting doesn't work for me, I'm afraid. Fresh install of 2.8.4, but the post date keeps changing to 1-1-1970 :-(

    Herko

  14. herko
    Member
    Posted 4 years ago #

    I started my log afresh, wanting to add content from before 1900 even, hoping that the published date would show up in the URL as well. But I can't create an archive from before 1969 (and only then because of my server timezone enables a few hours difference from the unix epoch 0).

    There seems to be another check for negative dates because I commented out the lines in functions.php, but to no avail.

  15. herko
    Member
    Posted 4 years ago #

  16. amandafrench
    Member
    Posted 4 years ago #

    gosunatxrea's fix worked for me on a historical blog on FDR's first hundred days I just set up on Dreamhost that's running 2.8.4. I'd give you the link, but we literally just put it up, so it'll be in flux for quite awhile.

  17. gorky5
    Member
    Posted 4 years ago #

    Please note the bug is still present in 2.8.5, so if you upgrade WP you'll have to re-edit the functions.php file in wp-includes and comment out the rogue lines again.

  18. gosunatxrea
    Member
    Posted 4 years ago #

    This bug will not be fixed in wordpress2.9.

    http://core.trac.wordpress.org/ticket/10332

    * milestone changed from 2.9 to Future Release

    Agree this bug should be fixed, but since we're in beta 2 now, punting to next release cycle for further testing and/or revision.

  19. chartinael
    Member
    Posted 4 years ago #

    http://wordpress.org/support/topic/307257?replies=4

    Solution proposed (commenting out) solved issue for me using 2.8.6.

    Still annoying ... meanwhile I have several edits in the core files system I need to re-do with every update.

  20. herko
    Member
    Posted 4 years ago #

    * milestone changed from 2.9 to Future Release

    Agree this bug should be fixed, but since we're in beta 2 now, punting to next release cycle for further testing and/or revision.

    Wow. this is an issue that's been open for a year, and it gets delayed because 'we're in beta 2 now'? I thought putting issues in milestones was meant to ensure they'd be fixed in those milestones, and motivated if and when this would not be the case. This is just bad release management!

  21. gorky5
    Member
    Posted 4 years ago #

    That is frustrating. I really wish this would be fixed - it's a hassle having to change WP core files to get a website working properly.

    I've just upgraded to 2.9. The lines that need commenting out are still 90-98 (though 95 and 96 are already comments) in wp-includes/functions.php

  22. gorky5
    Member
    Posted 4 years ago #

    Does anyone know if this issue is fixed in the latest release candidate for WP3? Herco's latest message here suggests not.

    If that's the case, can someone please let me know if the same lines in functions.php will need commenting out when WP3 is released, or, if not, how this bug can be overcome?

  23. Checked those files in my 3.0 RC3 build, and you are correct that the changes will still need to be made.

    It may be worthwhile to, tomorrow, mention this on http://wpdevel.wordpress.com/ (they usually make an open post for agenda items). It may just need a reminder?

Topic Closed

This topic has been closed to new replies.

About this Topic