Skip to content

[HttpFoundation] AcceptHeader ignores */* #25877

Closed
@javiereguiluz

Description

@javiereguiluz
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version all

Consider this example:

use Symfony\Component\HttpFoundation\AcceptHeader;

$acceptHeader = 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8';
$quality = AcceptHeader::fromString($acceptHeader)
    ->get('text/xml')
    ->getQuality();

I thought this code was going to return 0.8, because text/xml falls into */* category ... but instead I see this error message:

Call to a member function getQuality() on null

Is this a Symfony bug or is this strange behavior really expected?

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