Skip to content

BackedEnum support for http_build_query #15650

Closed
@taka-oyama

Description

@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

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"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions