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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2021 The PHP Group
All rights reserved.
Last updated: Tue Oct 19 22:03:37 2021 UTC