Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'*' preferred over earlier specified language #83

Open
brianjmiller opened this issue Aug 27, 2016 · 1 comment
Open

'*' preferred over earlier specified language #83

brianjmiller opened this issue Aug 27, 2016 · 1 comment

Comments

@brianjmiller
Copy link

Given a list of languages like:

['en-US' => '...', 'en-UK' => '....']

And a language string of:

en-US, *

I get the value for en-UK using getBest and based on my (admittedly new) reading of the RFC suggests that I should get the 'en-US' value since it is listed first and they have the same quality factor. (Common sense suggests that is the better value.)

Switching the accept string to be en-US, *;q=0 resolves the matter but seems either incorrect or at least unnecessary.

Am I doing something wrong or is this a bug? It looked similar to some of the other open issues, but not quite the same. It also wasn't a problem in the 1.x release series.

@mcaskill
Copy link

I'm having this issue with the Accept request HTTP header.

My given accepted content types:

[ 'application/json', 'text/html', 'application/xhtml+xml', 'application/xml' ]

MSIE11

  • Request: text/html, application/xhtml+xml, */*
  • Response: application/json

Chrome

  • Request: text/html, application/xhtml+xml, application/xml;q=0.9, image/webp, */*;q=0.8
  • Response: text/html (the correct content type to respond)

The solution I used is similar to yours, I forced a lower priority on the wildcard:

preg_replace('/(\*\/\*)(?!;q=)/i', '$1;q=0.8', getenv('HTTP_ACCEPT'));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants