• Resolved andrew.alba

    (@andrewalba)


    This has been reported multiple times and never formally resolved. You can view the various stack traces in previous ticket. Basically this is a warning that is being logged. Have not had issues with this breaking a page as it is wrapped in catch, but this will flood error log with the warning.

    https://wordpress.org/support/topic/datetime__construct-failed-to-parse-time-string-raw/

    It is not something that is easy to step through, but was able to recreate by visiting a calendar event. Was able to step through from
    wp-content/plugins/the-events-calendar/common/src/Tribe/Models/Post_Types/Base.php:to_post()
    method. The $filter attribute defaults to raw when no value is passed.

    The $filter value in turn gets passed to the get_properties() which in turn passes to the build_properties() method which is inherited by the
    wp-content/plugins/the-events-calendar/src/Tribe/Models/Post_Types/Event.php. If you look at wp-content/plugins/the-events-calendar/src/Tribe/Models/Post_Types/Event.php:116 you will see the Date_Utils class is trying to validate the $filter, but is obviously expecting a date.

    Believe you can resolve this issue by changing line 116 from

    if ( Dates::is_valid_date( $filter ) ) {

    to

    if ( $filter !== 'raw' && Dates::is_valid_date( $filter ) ) {

    Please review this and if acceptable, please add to the next update. Thank you.

    • This topic was modified 4 years, 10 months ago by andrew.alba.
    • This topic was modified 4 years, 10 months ago by andrew.alba.

The topic ‘DateTime::__construct(): Failed to parse time string (raw)’ is closed to new replies.