#22085 [Opn]: negotiateLanguage() in HTTP.php not case-insensitive

From: Date: Thu, 06 Feb 2003 03:10:29 +0000
Subject: #22085 [Opn]: negotiateLanguage() in HTTP.php not case-insensitive
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-12997@lists.php.net to get a copy of this message
ID: 22085 User updated by: stanbery@miyazaki-catv.ne.jp Reported By: stanbery@miyazaki-catv.ne.jp Status: Open Bug Type: PEAR related Operating System: Linux 2.4.x PHP Version: 4.2.2 New Comment: Ok, it seems that array_change_key_case() might be of use (didn't notice it before), as well as strtolower(). Only issue now is getting array_change_key_case() to work -- doesn't do anything as I'm calling it. Oh, btw, why is $supported passed in by reference instead of by value? Previous Comments: ------------------------------------------------------------------------ [2003-02-05 20:54:16] stanbery@miyazaki-catv.ne.jp Problem with negotiateLanguage() in HTTP.php: Using M$ 5.5, with "en-us" as my language (correct by RFC), and with "ja" as my secondary language (q=0.5), I ran into a page detecting my broswer as preferring Japanese. Looked at HTTP.php, checked cvs.php.net and diff'd 1.15 (which I have) with 1.17 (latest in CVS), and the only _code_ delta was with the eregi() test. I upgraded HTTP.php, then retested -- with no luck. I then read the RFC -- RFC 2068 section 3.10 states: ... Whitespace is not allowed within the tag and all tags are case-insensitive. ... So, somehow we need a case-insensitive key for $supported (not very likely, I guess). A solution would be to force all keys of $supported to lower case, then force the $accepted array to also be lower case. Over all, not very pretty. I'll see if I can come up with an easy fix -- but if someone beats me to it, that's great. =) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=22085&edit=1

« previous php.pear.dev (#12997) next »