Skip to content

config: scalar top-level JSON returns scalar from array-typed method (TypeError instead of Parse) #31

Description

@loks0n

packages/config/src/Config/Parser/JSON.php (~line 30) accepts any valid JSON, but inputs like "foo", 123, or true decode to a scalar and are returned from a method declared : array, causing a TypeError instead of the package's Parse exception.

Fix: check is_array($config) after decoding and throw Parse when the top-level value is not a config map.

Surfaced by Greptile on #25 (config absorption). Pre-existing in the upstream library; filed as follow-up rather than fixed in the absorption PR to keep that change faithful to upstream behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions