I've successfully implemented device detection as a plugin following the steps documented here.
http://framework.zend.com/manual/en/zend.http.user-agent.html I have the latest Zend framework release and the latest WURFL release. Detection works well, at least with desktop devices. However with iPhone and iPad the situation is not so good. On all devices, accessing the UserAgent object works: $userAgent = $bootstrap->getResource('useragent'); A var_dump shows that everything is at least superficially as I would expect: object(Zend_Http_UserAgent)#39 (10) { ["_browserType:protected"]=> NULL ["_browserTypeClass:protected"]=> array(0) { } ["_config:protected"]=> array(3) { ["identification_sequence"]=> string(14) "mobile,desktop" ["storage"]=> array(1) { ["adapter"]=> string(7) "Session" } ["wurflapi"]=> array(3) { ["wurfl_api_version"]=> string(3) "1.1" ["wurfl_lib_dir"]=> string(92) "/path/to/webapp/application/../library/wurfl-php-1.1/WURFL/" ["wurfl_config_file"]=> string(85) "/path/to/webapp/application/configs/wurfl-config.php" } } ["_device:protected"]=> NULL ["_immutable:protected"]=> bool(false) ["_loaders:protected"]=> array(0) { } ["_loaderTypes:protected"]=> array(2) { [0]=> string(7) "storage" [1]=> string(6) "device" } ["_matchLog:protected"]=> array(0) { } ["_server:protected"]=> NULL ["_storage:protected"]=> NULL } However, calling getDevice(): $device = $userAgent->getDevice(); on an iPad/iPhone causes execution of the plugin to stop dead. I've wrapped this in a try/catch block but i can't manage to get it to throw an exception - it just stops. There's also no PHP error in the log. The rest of the plugin logic is never called, but subsequent plugins and everything else in general is executed as expected. So, to reiterate, detection using zend_http_useragent and WURFL seems to work fine when the device is "desktop", but on the only mobile devices I have handy, it fails conclusively. I'm away from my usual development environment (working on my iPad), otherwise I would set up FireFox to mimic a different mobile device to see if I could reproduce the behaviour. At this stage, however, I'm starting to think that zend_http_useragent is not working correctly for iPad and iPhone - crazy though that seems, given the popularity of the devices. Am I missing something very obvious about how device detection works? Cab you see anything in that var_dump that might indicate the nature of the problem? -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/Problem-with-getDevice-on-iPad-Safari-tp3472977p3472977.html Sent from the Zend Framework mailing list archive at Nabble.com. -- List: [email protected] Info: http://framework.zend.com/archives Unsubscribe: [email protected]
