-- k7n4n5t3w4rt <[email protected]> wrote
(on Monday, 25 April 2011, 04:32 AM -0700):
> 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:

<snip>

>  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.

I've used UserAgent with iP* devices with no issues
(http://mobile.mwop.net is a "demo" area, and I've tested it with
iPhone, Android, a Nokia device (can't remember which), and one or two
others). 

My inclination, based on the fact that you only hit the issue when
detecting mobile devices, is that your WURFL config is incorrect, and as
a result, hitting it with a mobile device triggers an error.

Turn on the most verbose error reporting you can, and ensure
display_errors is on, and test that way. Also, utilize plugins for FF or
Chrome that allow you to mimic UserAgent strings, as this will allow you
to test without using your device (and also test many other device
types).

Common problems with WURFl range from invalid write rights to your
cache, missing trailing "/" on the cache path, and more; many are
outlined in the ZF manual.

> 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?

-- 
Matthew Weier O'Phinney
Project Lead            | [email protected]
Zend Framework          | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

-- 
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]


Reply via email to