ZF-820: Method in Zend_Controller_Request_Http for analyzing USER_AGENT

Issue Type: New Feature Created: 2007-01-29T15:01:13.000+0000 Last Updated: 2010-11-26T22:28:41.000+0000 Status: Resolved Fix version(s): - 1.11.0 (02/Nov/10)

Reporter: Bill Karwin (bkarwin) Assignee: Marc Hodgins (mjh_ca) Tags: - Zend_Controller

Related issues: Attachments:


This is a feature request for a method in Zend_Controller_Request_Http to provide structured information about the request's USER_AGENT to a ZF application.

Sometimes an application must output custom markup, javascript, or css depending on the browser brand or version. Parsing the USER_AGENT of a request is difficult and error-prone, because so many browsers use nonstandard syntax.

It makes sense that the Zend Framework can provide a "best-practices" method to parse known USER_AGENT strings and return the information in some kind of canonical, structured form, using an associative array for individual information pieces for instance. Then this information can be used by the View or even by the Controller to deliver custom output in the response.


This is probably not a mandatory feature for ZF 1.0, but we may want to revisit this in a subsequent release.


Posted by Matthew Weier O'Phinney (matthew) on 2007-11-16T14:38:16.000+0000

Scheduling for 1.1.0

Posted by julien PAULI (doctorrock83) on 2007-11-30T04:41:53.000+0000

In addition to that, ZendFramework could care about the wonderfull PHP function called get_browser(). browscap.ini must be provided in php.ini for that function to work, so ZF could check about that, and use it if available in addition to 'standard parsings'

Posted by Wil Sinclair (wil) on 2008-04-18T13:12:04.000+0000

This doesn't appear to have been fixed in 1.5.0. Please update if this is not correct.

Posted by Matthew Weier O'Phinney (matthew) on 2008-04-22T10:41:11.000+0000

Scheduling for next minor release; would be good to have for use with ContextSwitch.

Posted by julien PAULI (doctorrock83) on 2009-04-30T13:59:52.000+0000

This could serve as well for a future HTTP-based caching mechanism.

I suggest the creation of classe(s) and object(s) that could answer

<pre class="highlight">
$infos = $request->getClientInfo();
$info-> ...

- isIE(), isFireFox() is{any-familly}()
- getVersion()
- supportsCompression()
- supportsCookies() (that needs a 3xx refresh ...)
- isFlashRequest() and isXmlHttpRequest() could move to that object
- getLanguage() to map with Zend_Locale that actually does the job itself if I remember
- getIP()
- isProxied()

Just some ideas ...

Posted by Marc Hodgins (mjh_ca) on 2010-11-26T22:28:29.000+0000

Resolved by the addition of Zend_Http_UserAgent in ZF 1.11.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.