[php-src] Issue #15650: BackedEnum support for http_build_query
| From: | taka-oyama | Date: | Fri, 30 Aug 2024 01:33:58 +0000 |
| Subject: | [php-src] Issue #15650: BackedEnum support for http_build_query | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-247635@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/15650
Author: taka-oyama
### Description
Currently,
http_build_query converts BackedEnums into an object, which is not very
useful.
I would like the result to be aligned with json_encode which returns the backed value.
```php
<?php
enum Status: int
{
case Active = 1;
}
$status = Status::Active;
echo http_build_query($status) . PHP_EOL; // "name=Active&value=1"
echo json_encode($status) . PHP_EOL; // "1"
```