[php-src] Issue #10558: Backport DateTime::getLastErrors() not returning false when no errors/warnings to PHP 8.1.x stream
| From: | W1DJM | Date: | Fri, 10 Feb 2023 19:26:01 +0000 |
| Subject: | [php-src] Issue #10558: Backport DateTime::getLastErrors() not returning false when no errors/warnings to PHP 8.1.x stream | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-243707@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/10558
Author: W1DJM
### Description
This is the original [report for PHP 8.2.1](https://github.com/php/php-src/issues/9431).
This is the [fix for 8.2.1](https://github.com/vufind-org/vufinddate/pull/6/files).
The following code:
```php
<?php
$dateTime = DateTime::createFromFormat('Y-m-d', '2022-08-26');
$lastErrors = DateTime::getLastErrors();
var_dump($lastErrors);
<?php
```
Resulted in this output:
```
array(4) {
["warning_count"]=>
int(0)
["warnings"]=>
array(0) {
}
["error_count"]=>
int(0)
["errors"]=>
array(0) {
}
}
```
But I expected this output instead:
```
bool(false)
```
As shown at this test URL https://3v4l.org/eU2ra#v8.1.15 version 8.2.2 returns the
correct result but 8.1.15 does not.
### PHP Version
PHP 8.1.15
### Operating System
Windows 10