[php-src] Issue #9845: `empty("0")` returns `true` when it should return `false`
| From: | NiklasBr | Date: | Fri, 28 Oct 2022 12:54:57 +0000 |
| Subject: | [php-src] Issue #9845: `empty("0")` returns `true` when it should return `false` | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-242695@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/9845
Author: NiklasBr
### Description
The following code:
```php
<?php
// A string of length 1 with an ASCII character such as zero
var_dump(empty('0'));
// A string of length 1 with an ASCII character such as a letter
var_dump(empty('A'));
```
Resulted in this output:
```
bool(true)
bool(false)
```
But I expected this output instead:
```
bool(false)
bool(false)
```
## I expected this because
The documentation states:
> A variable is considered empty if it does not exist or if its value equals false.
But
"0" === false is not true.
### PHP Version
8.1.11
### Operating System
_No response_