Please upgrade here. These earlier versions are no longer being updated and have security issues.

Incorrect datetime value

This discussion is related to the Yet Another Gamification Application addon.

Ok, so my host changed the "infrastructure" last night and reactions suddenly stopped working ever since.

Anyone seen this before?

When trying to react to a post now I get:

Incorrect datetime value: '2019-06-03T08:25:09+0000' for column `pmono_no`.`v2018_Reaction`.`DateInserted` at row 1|Gdn_Database|Query|insert `v2018_Reaction` (`ActionID`, `ParentID`, `ParentType`, `ParentAuthorID`, `InsertUserID`, `DateInserted`) values (:ActionID, :ParentID, :ParentType, :ParentAuthorID, :InsertUserID, :DateInserted)
mcmcclur

Comments

  • Yes! I have the exact same problem on Vanilla Forums V2.6 running PHP 7.3 on Reclaim Hosting. I get a very similar error message as soon as I enable YAGA:

    [02-Jun-2019 20:44:19 UTC] PHP Fatal error: Incorrect datetime value: '2019-06-02T20:44:19+0000' for column `marksmat_vf4`.`GDN_BadgeAward`.`DateInserted` at row 1|Gdn_Database|Query|insert GDN_BadgeAward (`BadgeID`, `UserID`, `InsertUserID`, `Reason`, `DateInserted`) values (:BadgeID, :UserID, :InsertUserID, :Reason, :DateInserted) in /home/marksmat/public_html/classes/Summer2019Stat185/StatForum/library/database/class.database.php on line 421

  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    Can you provide more information on that error? Maybe after adding $Configuration['Garden']['Debug'] = true; to your config, it will show the sql that has been built and in which file. Or maybe you can provide the config trail so that I can see which file and maybe even what code is causing the problem (the path to the file must be inside the YAGA application)


    mcmcclur
  • @R_J $Configuration['Garden']['Debug'] = true. does not seem change the error as reported in my error log in any way. I'm not sure what you mean by the "config trail". Thanks, though!

  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    I meant the debug trail, sorry. You have pasted this line:

    in /home/marksmat/public_html/classes/Summer2019Stat185/StatForum/library/database/class.database.php on line 421

    I have hoped that there are more filenames below that visible. The first file which is inside the path of the yaga application is the one that creates this sql and we need to look at that file to find out what exactly is causing the error. It would make it much more easy, at least.


    The other approach means more research work, but it also needs more details from your side: you need to tell me exactly at which page and at which place the error occurs. If anyone of you can post a link to your forum, that would be best.


  • @R_J Here is a link to my forum: https://www.marksmath.org/classes/Summer2019Stat185/StatForum/

    It's working right now. If I enable the YAGA application, it will just show the something went wrong screen shown below. I'm sure that's not enough information for you but I'm not sure what else you need. Thanks again!


  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    Please add $Configuration ['Debug'] = true; to your config and try again. That will give explanations what exactly has gone wrong.


  • OK, Debug is now on and YAGA reinstalled. You can have a look, if you like. For the record, I get a trace that looks like so:


    Incorrect datetime value: '2019-06-05T10:07:08+0000' for column `marksmat_vf4`.`GDN_BadgeAward`.`DateInserted` at row 1

    insert GDN_BadgeAward

    (`BadgeID`, `UserID`, `InsertUserID`, `Reason`, `DateInserted`)

    values (:BadgeID, :UserID, :InsertUserID, :Reason, :DateInserted)The error occurred on or near: /home/marksmat/public_html/classes/Summer2019Stat185/StatForum/library/database/class.database.php

    417:                 if (!$message) {
    418:                     $message = $ex->getMessage();
    419:                 }
    420: 
    421:                 trigger_error($message, E_USER_ERROR);
    422:             }
    423: 
    424:         }
    425: 
    

    Backtrace:

    /home/marksmat/public_html/classes/Summer2019Stat185/StatForum/library/database/class.database.phpPHP::gdn_ErrorHandler();
    [/home/marksmat/public_html/classes/Summer2019Stat185/StatForum/library/database/class.database.php:421] PHP::trigger_error();
    [/home/marksmat/public_html/classes/Summer2019Stat185/StatForum/library/database/class.sqldriver.php:1684] Gdn_Database->query();
    [/home/marksmat/public_html/classes/Summer2019Stat185/StatForum/library/database/class.sqldriver.php:1101] Gdn_SQLDriver->query();
    [/home/marksmat/public_html/classes/Summer2019Stat185/StatForum/applications/yaga/models/class.badgeawardmodel.php:73] Gdn_SQLDriver->insert();
    [/home/marksmat/public_html/classes/Summer2019Stat185/StatForum/applications/yaga/library/class.yaga.php:212] BadgeAwardModel->Award();
    [/home/marksmat/public_html/classes/Summer2019Stat185/StatForum/applications/yaga/settings/class.hooks.php:624] Yaga::ExecuteBadgeHooks();
    [/home/marksmat/public_html/classes/Summer2019Stat185/StatForum/applications/yaga/settings/class.hooks.php:624] YagaHooks->Gdn_Dispatcher_AppStartup_Handler();
    [/home/marksmat/public_html/classes/Summer2019Stat185/StatForum/library/Garden/EventManager.php:278] PHP::call_user_func_array();
    [/home/marksmat/public_html/classes/Summer2019Stat185/StatForum/library/core/class.pluginmanager.php:806] Garden\EventManager->fire();
    [/home/marksmat/public_html/classes/Summer2019Stat185/StatForum/library/core/class.pluginmanager.php:765] Gdn_PluginManager->callEventHandler();
    [/home/marksmat/public_html/classes/Summer2019Stat185/StatForum/library/core/class.pluggable.php:133] Gdn_PluginManager->callEventHandlers();
    [/home/marksmat/public_html/classes/Summer2019Stat185/StatForum/library/core/class.dispatcher.php:193] Gdn_Pluggable->fireEvent();
    [/home/marksmat/public_html/classes/Summer2019Stat185/StatForum/index.php:28] Gdn_Dispatcher->start();
    

    Variables in local scope:

    [sql] 'insert GDN_BadgeAward 
    (`BadgeID`, `UserID`, `InsertUserID`, `Reason`, `DateInserted`) 
    values (:BadgeID, :UserID, :InsertUserID, :Reason, :DateInserted)'
    [inputParameters] array (
      ':BadgeID' => 13,
      ':UserID' => 2,
      ':InsertUserID' => 2,
      ':Reason' => '',
      ':DateInserted' => '2019-06-05T10:07:08+0000',
    )
    [options] array (
      'Type' => 'insert',
      'Slave' => NULL,
      'ReturnType' => 'ID',
    )
    [returnType] 'ID'
    [tries] 2
    [try] 0
    [pDO] array (
    )
    [pDOStatement] array (
      'queryString' => 'insert GDN_BadgeAward 
    (`BadgeID`, `UserID`, `InsertUserID`, `Reason`, `DateInserted`) 
    values (:BadgeID, :UserID, :InsertUserID, :Reason, :DateInserted)',
    )
    [state] '00000'
    [code] NULL
    [message] 'Incorrect datetime value: \'2019-06-05T10:07:08+0000\' for column `marksmat_vf4`.`GDN_BadgeAward`.`DateInserted` at row 1|Gdn_Database|Query|insert GDN_BadgeAward 
    (`BadgeID`, `UserID`, `InsertUserID`, `Reason`, `DateInserted`) 
    values (:BadgeID, :UserID, :InsertUserID, :Reason, :DateInserted)'
    [ex] array (
    )
    


    Thanks again!

  • I notice that you have to be logged in to trigger the fatal error. The error occurs as soon as anyone logs in.

  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    Thanks for the details!

    Open /applications/yaga/models/class.badgeawardmodel.php and exchange line 73 which looks like this:

               'DateInserted' => date(DATE_ISO8601)
    

    with that:

               'DateInserted' => Gdn_Format::toDateTime()
    


    By searching the code for more occurances of that problematic code, i would advice to also make the following changes:


    Line 188 in /applications/yaga/models/class.reactionmodel.php from

                 ->Set('DateInserted', date(DATE_ISO8601))
    

    to

                 ->Set('DateInserted', Gdn_Format::toDateTime())
    

    and line 206 in the same file from

                          'DateInserted' => date(DATE_ISO8601)));
    

    to

                          'DateInserted' => Gdn_Format::toDateTime()));
    


    That should solve those date problems


    mcmcclurhgtonightShadowdaresoviet9k
  • @R_J Yes, that seems to have done the trick - thanks!!

Sign In or Register to comment.