[php-src] Issue #13753: Bug empty() function
| From: | microwin7 | Date: | Tue, 19 Mar 2024 03:52:55 +0000 |
| Subject: | [php-src] Issue #13753: Bug empty() function | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-246611@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/13753
Author: microwin7
### Description
The following code:
```php
#[AsArguments(whereSearch: HTTP::POST, required: ['code'])]
public static function activate(string $username)
{
$args = new RequiredArguments(
new \ReflectionMethod(
static::class,
__FUNCTION__
)
);
// var_dump($args);
// var_dump($args->code);
if (empty($args->code)) JsonResponse::failed(error: 'Вы не ввели
"'.$args->code.'" gift-код');
.....
```
Resulted in this output:
```json
{
"error": "Вы не ввели \"JSIF-1809-AYLY-7494\"
gift-код"
}
```
Translated:
I don’t know how I could get this bug, it’s strange, for now I left several autoloaders in which
there is code from another connected autoloader with composer. I receive the attributes of the
method through reflection, the class reads them, gives the data to me upon request through the magic
call to the get() function. Before this, the code worked fine elsewhere, but now it has started to
be transferred to functions. As you can see, it is checked through the function and if it is empty,
we all know the rules what is empty and what is not. And here is clearly a string containing
characters, which I then receive in the response
### PHP Version
8.3.1
### Operating System
Ubuntu 22.04