I'm not exactly sure if I'm getting this error when I access the website with my iPhone or when CRONjob is executed via server-side (which seems to be what triggers it), but this is showing up on my admin/reports/dblog:

Notice: Undefined index: HTTP_USER_AGENT in phone_field_formatter_view() (line 205 of /home/storage/6/8a/ef/site1372096455/public_html/sites/all/modules/phone/phone.module).

Does anyone know how to solve this?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

gfed’s picture

This small patch checks first if HTTP_USER_AGENT is set.

1kenthomas’s picture

What do we need to do to get this committed to a release? :) Thanks.

dpovshed’s picture

@1kenthomas , to move issue forward after patch is provided you need to change status "need work".

Without that, patches may not be reviewed. I just spotted this issue having similar problem in my site.

So, I did a review of patch from comment #1 - and it just was not applied. :)

I rewrite it without a header information (and with additional parentesis for readability) and attached to this message.

Basically fix is fine!

dpovshed’s picture

Assigned: kaduwall » Unassigned
Status: Active » Needs review
dpovshed’s picture

FileSize
629 bytes

Sorry, interdiff should be in plain text - updating.

tmin’s picture

Status: Needs review » Reviewed & tested by the community

Seems to be working without issues for me.

jrb’s picture

Status: Reviewed & tested by the community » Postponed

This patch does fix the notice, but this code to check the device should be removed entirely per the issue here #2627596: iPhone renders phone numbers differently than every other device.

Quoting that issue:

The module should not alter output HTML based on device. Period.
It breaks caching, making things inconsistent. For example: a user hits a page from their iPhone that isn't cached, and the version of the page gets set with the <a href="tel:"> tags. This HTML will now show up for all future users to the page regardless of device.

This is a code smell that I spent a couple hours trying to debug why phone numbers were rendering wrong on just iPhones.

People looking to fix this notice should use the patch here: #2627596-2: iPhone renders phone numbers differently than every other device.

Not sure what the status of this issue should be, but it's not RTBC.