[php-src] Issue #11185: PHP Version 8.2.5
| From: | dppham1 | Date: | Wed, 03 May 2023 22:00:04 +0000 |
| Subject: | [php-src] Issue #11185: PHP Version 8.2.5 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-244367@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/11185
Author: dppham1
### Description
The following code:
```php
<?php
$x = "Hello\0world";
var_dump($date_time = DateTime::createFromFormat('H:i:s', $x));
```
Resulted in this output:
```
Fatal error: Uncaught ValueError: DateTime::createFromFormat(): Argument #2 ($datetime) must not
contain any null bytes
```
But I expected this output instead:
```
NULL
```
Per the [documentation](https://www.php.net/manual/en/datetime.createfromformat.php), this function
should return either a DateTime or NULL. In this case, an unhandled
ValueError is being thrown.
Note that I tried this with PHP v8.0.19 and this was working as intended.
### PHP Version
PHP 8.2.5
### Operating System
Ubuntu 20.04.4 LTS (Focal Fossa)