Skip to content

[HttpFoundation] AcceptHeader ignores */* #25877

@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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy