title: Cannot use isset () on the result of a function call (you can use "null != Func ()" instead)
body: <pre><code>( ! ) Fatal error: Cannot use isset() on the result of a function call (you can use "null !== func()" instead) in C:\Users\sanoj\Documents\NetBeansProjects\video-site\app\detect.php on line 45
  Call Stack
  #   Time    Memory  Function    Location
  1   0.0000  234208  {main}( )   ..\index.php:0
  </code></pre>
  
  <p>Previously my code was</p>
  
  <pre><code>if(!defined('WAP'))
      define('WAP', isset($_REQUEST['wap']) || isset($_REQUEST['wap2']) || isset($_REQUEST['imode'])|| isset($_REQUEST['html'])|| isset($_REQUEST['Android'])|| isset($_REQUEST['iphone'])|| isset($_REQUEST['IEMobile']));
  
      if (WAP)
  {
      define('WIRELESS_PROTOCOL', isset($_REQUEST['wap']) ? 'wap' : (isset($_REQUEST['wap2']) ? 'wap2' : (isset($_REQUEST['iphone']) ? 'iphone' : (isset($_REQUEST['imode']) ? 'imode' : (isset($_REQUEST['IEMobile']) ? 'IEMobile' :(isset($_REQUEST['html']) ? 'html' : (isset($_REQUEST['Android']) ? 'Android' : '')))))));  
  </code></pre>
  
  <p>And my IDE warned <code>Do Not Access SuperGlobal $_REQUEST Array Directly</code>
  So I used this following code</p>
  
  <pre><code>if(!defined('WAP'))
  {
      define('WAP', isset(filter_input(INPUT_REQUEST, 'wap', FILTER_SANITIZE_STRING)) || isset(filter_input(INPUT_REQUEST, 'wap2', FILTER_SANITIZE_STRING)) || isset(filter_input(INPUT_REQUEST, 'imode', FILTER_SANITIZE_STRING))|| isset(filter_input(INPUT_REQUEST, 'html', FILTER_SANITIZE_STRING))|| isset(filter_input(INPUT_REQUEST, 'Android', FILTER_SANITIZE_STRING))|| isset(filter_input(INPUT_REQUEST, 'iphone', FILTER_SANITIZE_STRING))|| isset(filter_input(INPUT_REQUEST, 'IEMobile', FILTER_SANITIZE_STRING)));
  }
      if (WAP)
  {
      define('WIRELESS_PROTOCOL', isset(filter_input(INPUT_REQUEST, 'wap', FILTER_SANITIZE_STRING)) ? 'wap' : (isset(filter_input(INPUT_REQUEST, 'wap2', FILTER_SANITIZE_STRING)) ? 'wap2' : (isset(filter_input(INPUT_REQUEST, 'iphone', FILTER_SANITIZE_STRING)) ? 'iphone' : (isset(filter_input(INPUT_REQUEST, 'imode', FILTER_SANITIZE_STRING)) ? 'imode' : (isset(filter_input(INPUT_REQUEST, 'IEMobile', FILTER_SANITIZE_STRING)) ? 'IEMobile' :(isset(filter_input(INPUT_REQUEST, 'html', FILTER_SANITIZE_STRING)) ? 'html' : (isset(filter_input(INPUT_REQUEST, 'Android', FILTER_SANITIZE_STRING)) ? 'Android' : '')))))));  
  </code></pre>
  
  <p>Here is <code>detect.php</code></p>
  
  <pre><code>&lt;?php
  $userBrowser = $_SERVER['HTTP_ACCEPT']; 
  if(stristr($userBrowser, 'application/vnd.wap.xhtml+xml')) 
  {
  $_REQUEST['wap2'] = 1;
  }
  
  elseif(stripos($_SERVER['HTTP_USER_AGENT'],"iPod"))
  {
  $_REQUEST['iphone'] = 1;
  
  }
  elseif(stripos($_SERVER['HTTP_USER_AGENT'],"iPhone"))
  {
  $_REQUEST['iphone'] = 1;
  
  }
  elseif(stripos($_SERVER['HTTP_USER_AGENT'],"Android"))
  {
  $_REQUEST['Android'] = 1;
  
  }
  elseif(stripos($_SERVER['HTTP_USER_AGENT'],"IEMobile"))
  {
  $_REQUEST['IEMobile'] = 1;
  
  }
  elseif(stristr($userBrowser, 'DoCoMo/' || 'portalmmm/'))
  {
  $_REQUEST['imode'] = 1;
  }
  
  elseif(stristr($userBrowser, 'text/vnd.wap.wml')) 
  {
  $_REQUEST['wap'] = 1;
  }
  elseif(stristr($userBrowser, 'text/html')) 
  {
  $_REQUEST['html'] = 1;
  }
  
  
  if(!defined('WAP'))
      define('WAP', isset($_REQUEST['wap']) || isset($_REQUEST['wap2']) || isset($_REQUEST['imode'])|| isset($_REQUEST['html'])|| isset($_REQUEST['Android'])|| isset($_REQUEST['iphone'])|| isset($_REQUEST['IEMobile']));
  
      if (WAP)
  {
      define('WIRELESS_PROTOCOL', isset($_REQUEST['wap']) ? 'wap' : (isset($_REQUEST['wap2']) ? 'wap2' : (isset($_REQUEST['iphone']) ? 'iphone' : (isset($_REQUEST['imode']) ? 'imode' : (isset($_REQUEST['IEMobile']) ? 'IEMobile' :(isset($_REQUEST['html']) ? 'html' : (isset($_REQUEST['Android']) ? 'Android' : '')))))));  
  
  if (WIRELESS_PROTOCOL == 'wap')
        {
  $browser_t = "mobile";
        }
  elseif (WIRELESS_PROTOCOL == 'wap2')
        {
  
  
  $browser_t = "mobile";
  
  
        }
  elseif (WIRELESS_PROTOCOL == 'imode')
        {
  
  $browser_t = "mobile";
  
        }
        elseif (WIRELESS_PROTOCOL == 'iphone')
        {
  
  
  $browser_t = "smartphone";
  
        }
        elseif (WIRELESS_PROTOCOL == 'Android')
        {
  
  
  $browser_t = "smartphone";
  
        }
         elseif (WIRELESS_PROTOCOL == 'IEMobile')
        {
  
  $browser_t = "smartphone";
  
        }
        elseif (WIRELESS_PROTOCOL == 'html')
        {
  
       $mobile_browser = '0';
  
  if(preg_match('/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone)/i',
      strtolower($_SERVER['HTTP_USER_AGENT']))){
      $mobile_browser++;
      }
  
  if((strpos(strtolower($_SERVER['HTTP_ACCEPT']),'application/vnd.wap.xhtml+xml')&gt;0) or 
      ((isset($_SERVER['HTTP_X_WAP_PROFILE']) or isset($_SERVER['HTTP_PROFILE'])))){
      $mobile_browser++;
      }
  
  $mobile_ua = strtolower(substr($_SERVER['HTTP_USER_AGENT'],0,4));
  $mobile_agents = array(
      'w3c ','acs-','alav','alca','amoi','audi','avan','benq','bird','blac',
      'blaz','brew','cell','cldc','cmd-','dang','doco','eric','hipt','inno',
      'ipaq','java','jigs','kddi','keji','leno','lg-c','lg-d','lg-g','lge-',
      'maui','maxo','midp','mits','mmef','mobi','mot-','moto','mwbp','nec-',
      'newt','noki','oper','palm','pana','pant','phil','play','port','prox',
      'qwap','sage','sams','sany','sch-','sec-','send','seri','sgh-','shar',
      'sie-','siem','smal','smar','sony','sph-','symb','t-mo','teli','tim-',
      'tosh','tsm-','upg1','upsi','vk-v','voda','wap-','wapa','wapi','wapp',
      'wapr','webc','winw','winw','xda','xda-');
  
  if(in_array($mobile_ua,$mobile_agents)){
      $mobile_browser++;
      }
  if (strpos(strtolower($_SERVER['ALL_HTTP']),'OperaMini')&gt;0) {
      $mobile_browser++;
      }
          if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']),'iemobile')&gt;0) {
  $mobile_browser++;
  }
  if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']),'windows')&gt;0) {
      $mobile_browser=0;
      }
  
  
  if($mobile_browser&gt;0){
     // do something wap
  
  $browser_t = "mobile";
  
  }
  // non-mobile
  else
  {
  
  $_SESSION['Browser_d'] = "web";
  $browser_t = "web";
  
  }
     } else {
     // do something else html
  
  $_SESSION['Browser_d'] = "web";
  $browser_t = "web";
     }
  
        }
  
  
      else
      {
  $mobile_browser = '0';
  
  if(preg_match('/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone)/i',
      strtolower($_SERVER['HTTP_USER_AGENT']))){
      $mobile_browser++;
      }
  
  if((strpos(strtolower($_SERVER['HTTP_ACCEPT']),'application/vnd.wap.xhtml+xml')&gt;0) or 
      ((isset($_SERVER['HTTP_X_WAP_PROFILE']) or isset($_SERVER['HTTP_PROFILE'])))){
      $mobile_browser++;
      }
  
  $mobile_ua = strtolower(substr($_SERVER['HTTP_USER_AGENT'],0,4));
  $mobile_agents = array(
      'w3c ','acs-','alav','alca','amoi','audi','avan','benq','bird','blac',
      'blaz','brew','cell','cldc','cmd-','dang','doco','eric','hipt','inno',
      'ipaq','java','jigs','kddi','keji','leno','lg-c','lg-d','lg-g','lge-',
      'maui','maxo','midp','mits','mmef','mobi','mot-','moto','mwbp','nec-',
      'newt','noki','oper','palm','pana','pant','phil','play','port','prox',
      'qwap','sage','sams','sany','sch-','sec-','send','seri','sgh-','shar',
      'sie-','siem','smal','smar','sony','sph-','symb','t-mo','teli','tim-',
      'tosh','tsm-','upg1','upsi','vk-v','voda','wap-','wapa','wapi','wapp',
      'wapr','webc','winw','winw','xda','xda-');
  
  if(in_array($mobile_ua,$mobile_agents)){
      $mobile_browser++;
      }
      if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']),'iemobile')&gt;0) {
  $mobile_browser++;
  }
  if (strpos(strtolower($_SERVER['ALL_HTTP']),'OperaMini')&gt;0) {
      $mobile_browser++;
      }
  if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']),'windows')&gt;0) {
      $mobile_browser=0;
      }
  
  
  if($mobile_browser&gt;0){
     // do something wap
  
  $browser_t = "mobile";
  
  }
  // non-mobile
  else
  {
  $_SESSION['Browser_d'] = "web";
  $browser_t = "web";
  }
  
      }
       ?&gt;
  </code></pre>
  
  <p>And <code>index.php</code></p>
  
  <pre><code>&lt;?php 
  include "app/config.php";
  include "app/detect.php";
  
  if ($page_name=='') {
      include $browser_t.'/index.html';
      }
  elseif ($page_name=='index.html') {
      include $browser_t.'/index.html';
      }
  elseif ($page_name=='singlepage.html') {
      include $browser_t.'/singlepage.html';
      }
  elseif ($page_name=='categories.html') {
      include $browser_t.'/categories.html';
      }
  elseif ($page_name=='contact.html') {
      include $browser_t.'/contact.html';
      }
  else
      {
          include $browser_t.'/404.html';
      }
  
  ?&gt;
  </code></pre>
  
  <p>And <code>config.php</code></p>
  
  <pre><code>&lt;?php
  $current_page_uri = $_SERVER['REQUEST_URI'];
  $part_url = explode("/", $current_page_uri);
  $page_name = end($part_url);
  $email_id = "s.hidayath@agileits.com";
  ?&gt;
  </code></pre>
  
  <p>when index file is loaded it should detect device and redirect it to proper root but in my case it doesn't
  I get following error</p>
  
  <pre><code>( ! ) Notice: Undefined index: ALL_HTTP in C:\Users\sanoj\Documents\NetBeansProjects\video-site-2\app\detect.php on line 118
  Call Stack
  #   Time    Memory  Function    Location
  1   0.0090  233992  {main}( )   ..\index.php:0
  2   0.0230  295896  include( 'C:\Users\sanoj\Documents\NetBeansProjects\video-site-2\app\detect.php' )  ..\index.php:11
  
  ( ! ) Warning: include(web/404.html): failed to open stream: No such file or directory in C:\Users\sanoj\Documents\NetBeansProjects\video-site-2\index.php on line 30
  Call Stack
  #   Time    Memory  Function    Location
  1   0.0090  233992  {main}( )   ..\index.php:0
  
  ( ! ) Warning: include(): Failed opening 'web/404.html' for inclusion (include_path='.;C:\php\pear') in C:\Users\sanoj\Documents\NetBeansProjects\video-site-2\index.php on line 30
  Call Stack
  #   Time    Memory  Function    Location
  1   0.0090  233992  {main}( )   ..\index.php:0
  </code></pre>