fix: update test for DateTime parse errors to work in php8.2
check if getLastErrors() returns a false bool, rather than specific array elements, as this throws an error in php8.2 if there are no errors returned.
This commit is contained in:
parent
3824e6e9aa
commit
32667285a8
|
|
@ -204,7 +204,8 @@ class DateParser extends Base
|
|||
|
||||
if ($date !== false) {
|
||||
$errors = DateTime::getLastErrors();
|
||||
if ($errors['error_count'] === 0 && $errors['warning_count'] === 0) {
|
||||
if ($errors === false ||
|
||||
$errors['error_count'] === 0 && $errors['warning_count'] === 0) {
|
||||
$timestamp = $date->getTimestamp();
|
||||
return $timestamp > 0 ? $timestamp : 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,8 @@ class Date extends Base
|
|||
|
||||
if ($date !== false) {
|
||||
$errors = DateTime::getLastErrors();
|
||||
if ($errors['error_count'] === 0 && $errors['warning_count'] === 0) {
|
||||
if ($errors === false ||
|
||||
$errors['error_count'] === 0 && $errors['warning_count'] === 0) {
|
||||
return $date->getTimestamp() > 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue