[php-src] Issue #12348: strtotime()evaluating a bad date as an actual date.

From: Date: Mon, 02 Oct 2023 19:56:31 +0000
Subject: [php-src] Issue #12348: strtotime()evaluating a bad date as an actual date.
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-245481@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/12348
Author: calevans

### Description

The following code:

```php
<?php
php -r 'var_export(strtotime("202343-2208-153523"));
```

Resulted in this output:
```
1696357903
```

But I expected this output instead:
```
false
```

**Notes:**
- This changed in 8.1.7
https://3v4l.org/HT4tt
- Looking at the changes to Date made in 8.1.7 my best GUESS is that it was this one.
https://bugs.php.net/bug.php?id=51987
- If you look at the date for that timespan, it is today's date. I'm not sure if that is
jsut a coincidence or if it will change every day.
var_export((new DateTimeImmutable("202345-2208-153523"))->format("Y-m-d
H:i:s"));

Cheers! :)
=C=


### PHP Version

PHP 8.1.12

### Operating System

_No response_


Thread (1 message)

  • calevans
« previous php.bugs (#245481) next »