Fixing "Call to undefined function _zen_theme" in simple_mobile_redirect (Drupal)

As a quick note, I was able to fix this error in the Drupal simple_mobile_redirect module:

[Sun Mar 01 14:23:25 2015] [error]
PHP Notice: Undefined index: HTTP_ACCEPT in
/var/www/example.com/html/sites/all/modules/simple_mobile_redirect/simple_mobile_redirect.module on line 121

by changing this line of PHP code:

case ((strpos($_SERVER['HTTP_ACCEPT'], 'text/vnd.wap.wml') > 0) || (strpos($_SERVER['HTTP_ACCEPT'], 'application/vnd.wap.xhtml+xml') > 0)):

to this line:

case ((strpos(isset($_SERVER['HTTP_ACCEPT']), 'text/vnd.wap.wml') > 0) || (strpos(isset($_SERVER['HTTP_ACCEPT']), 'application/vnd.wap.xhtml+xml') > 0)):

Note that the solution makes calls to isset before attempting to use the SERVER variable.

I found the solution at this url, but there’s a problem with that patch: it uses non-standard characters for the single quotes in two places, which causes the code to fail. That is, you need to use ' in your code, not .

Once I made these changes, the “Call to undefined function _zen_theme()” error went away.