DateTime::__construct(): Failed to parse time string (raw)
-
In regards to the original topic posted by @jonathanstegall that was closed but never actually solved titled “DateTime::__construct(): Failed to parse time string (raw)” from over a year ago…
TEC Support team, can we all try to look into some of these claims even if you can’t replicate some of these issues?
This is very annoying and cluttering up server logs. Just by going directly to where the error is being thrown that was given to you in the previous thread, it’s obviously a developer known issue and looks to actually be deliberate.
In version 5.12.4
In file the-events-calendar/common/src/Tribe/Date_Utils.php
In function build_date_object()
Around lines 1247 – 1288There is a try/catch that clearly states the knowledge of this problem
// PHP 5.2 will not throw an exception but will generate an error.
Is this really an acceptable solution? To force a PHP error so that you can catch it? Should I hold my breath for a fix here?
try { // PHP 5.2 will not throw an exception but will generate an error. $utc = new DateTimeZone( 'UTC' ); $timezone_object = Tribe__Timezones::build_timezone_object( $timezone ); if ( self::is_timestamp( $datetime ) ) { $timestamp_timezone = $timezone ? $timezone_object : $utc; return new Date_I18n( '@' . $datetime, $timestamp_timezone ); } set_error_handler( 'tribe_catch_and_throw' ); $date = new Date_I18n( $datetime, $timezone_object ); restore_error_handler(); }
The page I need help with: [log in to see the link]
- The topic ‘DateTime::__construct(): Failed to parse time string (raw)’ is closed to new replies.