Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.0.0

Request #13061 Support for Yahoo search Crawler
Submitted: 2008-02-04 23:48 UTC Modified: 2008-02-10 00:41 UTC
From: kawai Assigned: kuboa
Status: Closed Package: Net_UserAgent_Mobile (version 0.30.0)
PHP Version: 5.2.5 OS: Windows
Roadmaps: 0.31.0    
Subscription  


 [2008-02-04 23:48 UTC] kawai (Hiroaki Kawai)
Description: ------------ Yahoo mobile search engine crawler is not detected and we get Net_UserAgent_Mobile_Error. Attached patch will fix this. Test script: --------------- Index: Net/UserAgent/Mobile/DoCoMo.php =================================================================== --- Net/UserAgent/Mobile/DoCoMo.php (revision 41597) +++ Net/UserAgent/Mobile/DoCoMo.php (working copy) @@ -538,6 +538,9 @@ } if (preg_match('/^[^(]+\((.*?)\)$/', $foma, $matches)) { + if(preg_match('/^compatible/', $matches[1])){ // The user-agent is DoCoMo compatible. + return; + } $rest = explode(';', $matches[1]); foreach ($rest as $value) { if (preg_match('/^c(\d+)/', $value, $matches)) { Expected result: ---------------- object(Net_UserAgent_Mobile_DoCoMo)[2] public '_model' => string 'SH902i ' (length=7) public '_status' => string '' (length=0) public '_bandwidth' => null public '_serialNumber' => null public '_isFOMA' => boolean true public '_cardID' => null public '_comment' => null public '_cacheSize' => null public '_displayBytes' => string '' (length=0) public 'name' => string 'DoCoMo' (length=6) public 'version' => string '2.0' (length=3) public '_display' => null public '_request' => object(Net_UserAgent_Mobile_Request_Env)[1] public '_env' => array 'HTTP_USER_AGENT' => string 'DoCoMo/2.0 SH902i (compatible; Y!J-SRD/1.0; http://help.yahoo.co.jp/help/jp/search/indexing/indexing-27.html)' (length=109) public '_error' => null public '_debug' => boolean false public '_default_error_mode' => null public '_default_error_options' => null public '_default_error_handler' => string '' (length=0) public '_error_class' => string 'Net_UserAgent_Mobile_Error' (length=26) public '_expected_errors' => array empty Actual result: -------------- object(Net_UserAgent_Mobile_Error)[3] public 'error_message_prefix' => string '' (length=0) public 'mode' => int 1 public 'level' => int 1024 public 'code' => int -2 public 'message' => string 'Net_UserAgent_Mobile Error: no match' (length=36) public 'userinfo' => string 'DoCoMo/2.0 SH902i (compatible; Y!J-SRD/1.0; http://help.yahoo.co.jp/help/jp/search/indexing/indexing-27.html): might be new variants. Please contact the author of Net_UserAgent_Mobile!' (length=184) public 'backtrace' => array 0 => array 'file' => string 'D:\apache\front\libphp\Net\UserAgent\Mobile.php' (length=47) 'line' => int 326 'function' => string 'PEAR_Error' (length=10) 'class' => string 'PEAR_Error' (length=10) 'type' => string '->' (length=2) 'args' => array ... 1 => array 'file' => string 'D:\apache\front\libphp\PEAR.php' (length=31) 'line' => int 569 'function' => string 'Net_UserAgent_Mobile_Error' (length=26) 'class' => string 'Net_UserAgent_Mobile_Error' (length=26) 'object' => &object(Net_UserAgent_Mobile_Error)[3] 'type' => string '->' (length=2) 'args' => array ... 2 => array 'file' => string 'D:\apache\front\libphp\Net\UserAgent\Mobile\Common.php' (length=54) 'line' => int 163 'function' => string 'raiseError' (length=10) 'class' => string 'PEAR' (length=4) 'object' => object(Net_UserAgent_Mobile_DoCoMo)[2] ... 'type' => string '->' (length=2) 'args' => array ... 3 => array 'file' => string 'D:\apache\front\libphp\Net\UserAgent\Mobile\Common.php' (length=54) 'line' => int 251 'function' => string 'raiseError' (length=10) 'class' => string 'Net_UserAgent_Mobile_Common' (length=27) 'object' => object(Net_UserAgent_Mobile_DoCoMo)[2] ... 'type' => string '->' (length=2) 'args' => array ... 4 => array 'file' => string 'D:\apache\front\libphp\Net\UserAgent\Mobile\DoCoMo.php' (length=54) 'line' => int 568 'function' => string 'noMatch' (length=7) 'class' => string 'Net_UserAgent_Mobile_Common' (length=27) 'object' => object(Net_UserAgent_Mobile_DoCoMo)[2] ... 'type' => string '->' (length=2) 'args' => array ... 5 => array 'file' => string 'D:\apache\front\libphp\Net\UserAgent\Mobile\DoCoMo.php' (length=54) 'line' => int 197 'function' => string '_parseFOMA' (length=10) 'class' => string 'Net_UserAgent_Mobile_DoCoMo' (length=27) 'object' => object(Net_UserAgent_Mobile_DoCoMo)[2] ... 'type' => string '->' (length=2) 'args' => array ... 6 => array 'file' => string 'D:\apache\front\libphp\Net\UserAgent\Mobile\Common.php' (length=54) 'line' => int 103 'function' => string 'parse' (length=5) 'class' => string 'Net_UserAgent_Mobile_DoCoMo' (length=27) 'object' => object(Net_UserAgent_Mobile_DoCoMo)[2] ... 'type' => string '->' (length=2) 'args' => array ... 7 => array 'file' => string 'D:\apache\front\libphp\Net\UserAgent\Mobile.php' (length=47) 'line' => int 170 'function' => string 'Net_UserAgent_Mobile_Common' (length=27) 'class' => string 'Net_UserAgent_Mobile_Common' (length=27) 'object' => object(Net_UserAgent_Mobile_DoCoMo)[2] ... 'type' => string '->' (length=2) 'args' => array ... 8 => array 'file' => string 'D:\apache\front\htdocs\t.php' (length=28) 'line' => int 5 'function' => string 'factory' (length=7) 'class' => string 'Net_UserAgent_Mobile' (length=20) 'type' => string '::' (length=2) 'args' => array ... public 'callback' => null

Comments

 [2008-02-04 23:50 UTC] kawai (Hiroaki Kawai)
Sorry, I mistook. I pasted a patch into "Test script" field. The test script is: Test script: ---------------------- <?php require_once('Net/UserAgent/Mobile.php'); $ua="DoCoMo/2.0 SH902i (compatible; Y!J-SRD/1.0; http://help.yahoo.co.jp/help/jp/search/indexing/indexing-27.html)"; $n=Net_UserAgent_Mobile::factory($ua); var_dump($n);
 [2008-02-10 00:41 UTC] kuboa (KUBO Atsuhiro)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.