Errors on \DatabaseConnectors\TeraWurflDatabase_MySQL5.php

Installing and configuring Tera-WURFL on your server.

Errors on \DatabaseConnectors\TeraWurflDatabase_MySQL5.php

Postby bhupendra » Tue Jan 11, 2011 1:58 am

Hi,

I am using tera wurfl 2.1.3 and I am recieving these errors


Notice: Undefined offset: -1 in \terawurfl\DatabaseConnectors\TeraWurflDatabase_MySQL5.php on line 156
Notice: Undefined offset: -1 in \terawurfl\DatabaseConnectors\TeraWurflDatabase_MySQL5.php on line 158
Notice: Undefined offset: -1 in \terawurfl\DatabaseConnectors\TeraWurflDatabase_MySQL5.php on line 158


In my site setup I am using tera wurfl with mobile joomla which is a extension to joomla.These errors occur when my browser spoofs user agent of nokia 6300, ipad etc. and It doesn't occur only in case of IPhone(Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16).
Also, I have other sites who use tera wurfl directly and they don't display such errors in browser, but in eclipse PDT when it validate the entire site it displays the same errors.So I think this is a issue with tera wurfl.

In the function below condition in do loop is not getting true, so that the value of i remains 0 and hence error comes.

Code: Select all
   public function getDeviceFallBackTree($wurflID){
      if($this->use_nested_set){
         return $this->getDeviceFallBackTree_NS($wurflID);
      }
      $data = array();
      $this->numQueries++;
      $query = sprintf("CALL ".TeraWurflConfig::$TABLE_PREFIX."_FallBackDevices(%s)",$this->SQLPrep($wurflID));
      $this->dbcon->multi_query($query);
      $i = 0;
      do{
         if($res = $this->dbcon->store_result()){
            $row = $res->fetch_row();
            $data[$i++]=unserialize($row[0]);
            $res->free();
         }
      }while($this->dbcon->more_results() && $this->dbcon->next_result());
      if($data[$i-1]['id'] != WurflConstants::$GENERIC){
         $tw = new TeraWurfl();
         $tw->toLog("WURFL Error: device {$data[$i-1]['id']} falls back on an inexistent device: {$data[$i-1]['fall_back']}",LOG_ERR,__CLASS__.'::'.__FUNCTION__);
      }
      return $data;
   }


Thanks,
bhupendra
 
Posts: 10
Joined: Wed Jun 23, 2010 1:01 pm

Re: Errors on \DatabaseConnectors\TeraWurflDatabase_MySQL5.p

Postby kamermans » Tue Jan 11, 2011 2:07 am

Strange. Can you use your browser to spoof a request to my server at http://www.tera-wurfl.com/m/, then post the Request Headers back here?
Thanks,

Steve Kamerman
Tera-WURFL Author
COO of ScientiaMobile

IMPORTANT ANNOUNCEMENT! Tera-WURFL and WURFL have joined forces! We have launched ScientiaMobile to provide commercial support for our device detection solutions.

Tera-WURFL.com | Device Explorer
kamermans
Site Admin
 
Posts: 323
Joined: Wed Mar 10, 2010 12:06 pm
Location: Fort Worth, TX

Re: Errors on \DatabaseConnectors\TeraWurflDatabase_MySQL5.p

Postby kamermans » Tue Jan 11, 2011 2:18 am

The problem must be that the MySQL stored procedure is returning nothing - I'm not quite sure how this is possible, but here's one way to find out - can you find this line:

Code: Select all
$query = sprintf("CALL ".TeraWurflConfig::$TABLE_PREFIX."_FallBackDevices(%s)",$this->SQLPrep($wurflID));

(for me it's 145)

and add the following after it, on the next line:
Code: Select all
file_put_contents('/tmp/tw_debug.log', $query."\n", FILE_APPEND);


Then rerun your test (the one that fails) and post the contents of that file.

Also, you can try the current dev version of Tera-WURFL from https://github.com/kamermans/Tera-WURFL, which now includes PHP unit tests that we can use to check the sanity of your WURFL database + patch files.
Thanks,

Steve Kamerman
Tera-WURFL Author
COO of ScientiaMobile

IMPORTANT ANNOUNCEMENT! Tera-WURFL and WURFL have joined forces! We have launched ScientiaMobile to provide commercial support for our device detection solutions.

Tera-WURFL.com | Device Explorer
kamermans
Site Admin
 
Posts: 323
Joined: Wed Mar 10, 2010 12:06 pm
Location: Fort Worth, TX

Re: Errors on \DatabaseConnectors\TeraWurflDatabase_MySQL5.p

Postby bhupendra » Tue Jan 11, 2011 2:32 am

Request Headers are

Code: Select all
array (
  'Host' => 'www.tera-wurfl.com',
  'User-Agent' => 'Mozilla/5.0 (Linux; U; Android 2.0; en-us; Droid Build/ESD20) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17',
  'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
  'Accept-Language' => 'en-gb,en;q=0.5',
  'Accept-Encoding' => 'gzip,deflate',
  'Accept-Charset' => 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
  'Keep-Alive' => '115',
  'Connection' => 'keep-alive',
  'Referer' => 'http://www.tera-wurfl.com/forum/viewtopic.php?f=2&t=73',
  'Cookie' => '__utma=84365852.421006174.1294724426.1294724426.1294727233.2; __utmb=84365852; __utmz=84365852.1294724426.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none); tw_forum_u=83; tw_forum_k=3f6bf0dd07ef8c01; tw_forum_sid=a6b34b2eab7af86912da509eca659d3a; style_cookie=printonly; __utmc=84365852',
)


Contents of tw_debug.log
Code: Select all
CALL jos_TeraWurfl_FallBackDevices('verizon_droid_ver1_subua')
bhupendra
 
Posts: 10
Joined: Wed Jun 23, 2010 1:01 pm

Re: Errors on \DatabaseConnectors\TeraWurflDatabase_MySQL5.p

Postby kamermans » Tue Jan 11, 2011 2:43 am

Well, I hate to leave you hangin but it almost 1am and I've got to get some sleep, but you may want to try run that query on your mysql server and see what it returns. Is it possible that the WURFL isn't loaded?
Thanks,

Steve Kamerman
Tera-WURFL Author
COO of ScientiaMobile

IMPORTANT ANNOUNCEMENT! Tera-WURFL and WURFL have joined forces! We have launched ScientiaMobile to provide commercial support for our device detection solutions.

Tera-WURFL.com | Device Explorer
kamermans
Site Admin
 
Posts: 323
Joined: Wed Mar 10, 2010 12:06 pm
Location: Fort Worth, TX

Re: Errors on \DatabaseConnectors\TeraWurflDatabase_MySQL5.p

Postby bhupendra » Tue Jan 11, 2011 2:47 am

No, Problem have a nice sleep and good dreams :-) , I shall try to get it solved and as soon as it is done will get back here.
bhupendra
 
Posts: 10
Joined: Wed Jun 23, 2010 1:01 pm

Re: Errors on \DatabaseConnectors\TeraWurflDatabase_MySQL5.p

Postby bhupendra » Tue Jan 11, 2011 3:00 am

These procedures

    TeraWurfl_FallBackDevices
    TeraWurfl_RIS


does not exist in database that is being used by mobile joomla, while they exists in original installations of tera wurfl.I think I should contact the mobile joomla community and I guess this problem can be solved by using mysql 4 adapter temporarily.
bhupendra
 
Posts: 10
Joined: Wed Jun 23, 2010 1:01 pm

Re: Errors on \DatabaseConnectors\TeraWurflDatabase_MySQL5.p

Postby kamermans » Tue Jan 11, 2011 8:23 am

Ah, that'll do it! You can also disable those procedures in the mysql5 adapter by changing $db_implements_fallback and $db_implements_ris to false, but it will be about the same speed as the mysql 4 connector.
Thanks,

Steve Kamerman
Tera-WURFL Author
COO of ScientiaMobile

IMPORTANT ANNOUNCEMENT! Tera-WURFL and WURFL have joined forces! We have launched ScientiaMobile to provide commercial support for our device detection solutions.

Tera-WURFL.com | Device Explorer
kamermans
Site Admin
 
Posts: 323
Joined: Wed Mar 10, 2010 12:06 pm
Location: Fort Worth, TX

Re: Errors on \DatabaseConnectors\TeraWurflDatabase_MySQL5.p

Postby bhupendra » Tue Jan 11, 2011 9:36 am

Yeah that would work too,
Thanks :-) .
bhupendra
 
Posts: 10
Joined: Wed Jun 23, 2010 1:01 pm

Re: Errors on \DatabaseConnectors\TeraWurflDatabase_MySQL5.p

Postby skyvic » Wed Feb 23, 2011 4:48 am

Hi,

I am using Tera Wurfl 2.1.4 version.

Got some issue with Database connector MYSQL 5

Notice: Trying to get property of non-object in DatabaseConnectors/TeraWurflDatabase_MySQL5.php on line 530

line 530 is basically try to get the value from Settings table. But i think the problem occur even before that, because the script doesn't really create the table for me. I am sure i am able to connect to my db as i passed the installation step.

Any idea?

Thanks.
skyvic
 
Posts: 1
Joined: Wed Feb 23, 2011 4:44 am

Next

Return to Installation / Configuration

Who is online

Users browsing this forum: No registered users and 4 guests