From: [EMAIL PROTECTED] Operating system: PHP version: 4.2.3 PHP Bug Type: Feature/Change Request Bug description: Function to parse Accept-like headers
Using content negotiation I often find myself wanting a low-cost but correct way of parsing Accept headers, e.g, Accept: for application/xhtml+xml or application/rdf+xml, or Accept-Language: for en/fr/de/klingon, or Accept-Encoding: for UTF, or whatever. Although parsing these in PHP isn't particularly difficult, it's fairly expensive if you want to do it properly, handling weights and levels -- most don't bother. A function to pass this work off to C would be nice, and would discourage broken Accept header checks that ignore weighting (e.g. just searching HTTP_ACCEPT for application/xhtml+xml breaks when it's q=0.0, and results in undesirable behavior when text/html has a higher q=). Given that serving XHTML as application/xhtml+xml is gaining in popularity, I think this would be a valuable addition to PHP's API. -- Edit bug report at http://bugs.php.net/?id=21115&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=21115&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=21115&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=21115&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=21115&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=21115&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=21115&r=support Expected behavior: http://bugs.php.net/fix.php?id=21115&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=21115&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=21115&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=21115&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=21115&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=21115&r=dst IIS Stability: http://bugs.php.net/fix.php?id=21115&r=isapi