Calculation/DateTime Failure With PHP8 (#1661)
The following code generates an error with PHP8: if ($t1[1] > 29) { $t1[1] += 1900; Under the "right" conditions, PHP8 evaluates the condition as true when PHP8 is a non-numeric string and then generates an error trying to perform += on that non-numeric string. Adding a numeric test eliminates the problem. All unit tests involving this code now succeed with both PHP7 and PHP8.
This commit is contained in:
parent
9683e5be18
commit
43db94e94f
|
@ -489,7 +489,7 @@ class DateTime
|
|||
if ($yearFound) {
|
||||
array_unshift($t1, 1);
|
||||
} else {
|
||||
if ($t1[1] > 29) {
|
||||
if (is_numeric($t1[1]) && $t1[1] > 29) {
|
||||
$t1[1] += 1900;
|
||||
array_unshift($t1, 1);
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue