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

Bug #17262 Net_GeoIP_Location setter not valid
Submitted: 2010-03-24 20:25 UTC
From: konrness Assigned: doconnor
Status: Closed Package: Net_GeoIP (version Unknown)
PHP Version: 5.2.6 OS: Linux
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 1 + 31 = ?

 
 [2010-03-24 20:25 UTC] konrness (Konr Ness)
Description: ------------ Line 133 in Net_GeoIP_Location is the set() function. But this should actually be the __set() magic method so that the __get(), __toString(), and __isset() magic methods and the serialize(), unserialize(), and getData() methods work properly. This is because all data should be stored in the protected $aData member instead of implied public vars. Note, all of these values are set via Net_GeoIP on lines 826-894. Test script: --------------- require_once 'Net/GeoIP.php'; $geoip = Net_GeoIP::getInstance(DATA_PATH . 'GeoLiteCity.dat'); $location = $geoip->lookupLocation('24.24.24.24'); var_dump($location); Expected result: ---------------- object(Net_GeoIP_Location)[60] protected 'aData' => array 'countryCode' => string 'US' (length=2) 'countryCode3' => string 'USA' (length=3) 'countryName' => string 'United States' (length=13) 'region' => string 'NY' (length=2) 'city' => string 'Jamaica' (length=7) 'postalCode' => string '11434' (length=5) 'latitude' => float 40.6763 'longitude' => float -73.7752 'areaCode' => int 718 'dmaCode' => float 501 array 'countryCode' => string 'US' (length=2) 'countryCode3' => string 'USA' (length=3) 'countryName' => string 'United States' (length=13) 'region' => string 'NY' (length=2) 'city' => string 'Jamaica' (length=7) 'postalCode' => string '11434' (length=5) 'latitude' => float 40.6763 'longitude' => float -73.7752 'areaCode' => int 718 'dmaCode' => float 501 Actual result: -------------- object(Net_GeoIP_Location)[60] protected 'aData' => array 'countryCode' => null 'countryCode3' => null 'countryName' => null 'region' => null 'city' => null 'postalCode' => null 'latitude' => null 'longitude' => null 'areaCode' => null 'dmaCode' => null public 'countryCode' => string 'US' (length=2) public 'countryCode3' => string 'USA' (length=3) public 'countryName' => string 'United States' (length=13) public 'region' => string 'NY' (length=2) public 'city' => string 'Jamaica' (length=7) public 'postalCode' => string '11434' (length=5) public 'latitude' => float 40.6763 public 'longitude' => float -73.7752 public 'dmaCode' => float 501 public 'areaCode' => int 718 array 'countryCode' => null 'countryCode3' => null 'countryName' => null 'region' => null 'city' => null 'postalCode' => null 'latitude' => null 'longitude' => null 'areaCode' => null 'dmaCode' => null

Comments

 [2010-03-25 05:37 UTC] doconnor (Daniel O'Connor)
Added test to SVN
 [2010-03-25 05:49 UTC] doconnor (Daniel O'Connor)
-Status: Open +Status: Closed -Assigned To: +Assigned To: doconnor
This bug has been fixed in SVN. 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. Fixed as of [296763]