php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57807 http_negotiate_* does not return default value on non-match
Submitted: 2007-08-29 09:42 UTC Modified: 2007-08-29 12:24 UTC
From: boen dot robot at gmail dot com Assigned: mike (profile)
Status: Closed Package: pecl_http (PECL)
PHP Version: 5_2 CVS-2007-08-29 OS: Windows XP SP2
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: boen dot robot at gmail dot com
New email:
PHP Version: OS:

 

 [2007-08-29 09:42 UTC] boen dot robot at gmail dot com
Description:
------------
http_negotiate_language() doesn't return the default language when there are no matching languages. Oddly enough, when there is no Accept-Language header, the default language is returned, as it should. It's just that when there IS such, but it doesn't contain any matches (even partial ones), no value is returned.

Please note that the actual version I'm using is 5.2.4RC2. The whole HTTP extension doesn't seem to be loading properly in RC3 (or at least in yesterday's snapshot I tried).

Reproduce code:
---------------
<?php
$lang = http_negotiate_language(array('bg','en'),$results);
print_r($results);
echo $lang;
?>

Expected result:
----------------
With
Accept-Language: fr
header, the output should have been the same as if no header was present which from the above sample means:

Array
(
    [bg] => 1
    [en] => 1
)
bg

Actual result:
--------------
With
Accept-Language: fr
header, the output is:

Array
(
)


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-08-29 12:24 UTC] mike@php.net
This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC