[php-src] Issue #9378: The number 0 fails validation as a valid integer
| From: | ollieread | Date: | Fri, 19 Aug 2022 14:22:13 +0000 |
| Subject: | [php-src] Issue #9378: The number 0 fails validation as a valid integer | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-242258@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/9378
Author: ollieread
### Description
The following code:
```php
<?php
declare(strict_types=1);
var_dump(filter_var(00, FILTER_VALIDATE_INT));
var_dump(filter_var(0, FILTER_VALIDATE_INT));
var_dump(filter_var(01, FILTER_VALIDATE_INT));
var_dump(filter_var(1, FILTER_VALIDATE_INT));
```
Resulted in this output:
```
int(0)
int(0)
int(1)
int(1)
```
But I expected this output instead:
```
int(1)
int(1)
int(1)
int(1)
```
### PHP Version
PHP 8.1.4
### Operating System
_No response_