Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

Zend/Http/Header/AbstractAccept throws php notice when "HTTP_ACCEPT_LANGUAGE" is non well formatted #21

@neilime

Description

@neilime

Hi,

An error occured when we try to retrieve "Accept-Language" from request headers and "$_SERVER['HTTP_ACCEPT_LANGUAGE']" is non well formatted : ""Undefined offset: 1" - /.../Zend/Http/Header/AbstractAccept.php (173)"

The following unit test shows this behavior.

    public function testDefineDefaultLocaleWithWrongHttpAcceptLanguageHeader()
    {
        $_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'en-US;en';
        $oRequest = new \Zend\Http\PhpEnvironment\Request();
        $oRequest->getHeaders()->get('Accept-Language'); // Php notice
    }

Thanks for helping me to fix it

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