Closed davefx closed 1 year ago
Thanks for submitting the PR @davefx.
@mattallan what are your thoughts on just getting rid of the reliance on strptime()
all together. There's a couple of reasons why I think this is a good idea:
I've also been doing some research and there might even be better ways for us to check the format matches and is a valid date. eg
$date = DateTime::createFromFormat( $format, $date_time );
return $date && $date->format($format) == $date_time;
I'm going to close this as #396 is a more complete fix and has now been merged.
Fixes #212
Description
This PR fixes the problem that causes a deprecation warning in PHP 8.1 due to the usage of function strptime.
As the method already includes a fallback for the cases where strptime is not available (like Windows), I've simply added a check so in PHP >= 8.1 we use the alternative implementation.
How to test this PR
Function "wcs_is_datetime_mysql_format()" should keep working as it does until now, but without generating a warning in PHP >= 8.1.
Product impact