FAQ
Edit report at http://pear.php.net/bugs/bug.php?id=17262&edit=1

ID: 17262
Updated by: daniel.oconnor@gmail.com
Reported By: konrness at gmail dot com
Summary: Net_GeoIP_Location setter not valid
Status: Open
Type: Bug
Package: Net_GeoIP
Operating System: Linux
Package Version: Unknown
PHP Version: 5.2.6
Roadmap Versions:
New Comment:

Added test to SVN


Previous Comments:
------------------------------------------------------------------------

[2010-03-24 16:25:36] konrness

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

------------------------------------------------------------------------

Search Discussions

  • Daniel Oconnor at Mar 25, 2010 at 12:54 am
    Edit report at http://pear.php.net/bugs/bug.php?id=17262&edit=1

    ID: 17262
    Updated by: daniel.oconnor@gmail.com
    Reported By: konrness at gmail dot com
    Summary: Net_GeoIP_Location setter not valid
    -Status: Open
    +Status: Closed
    Type: Bug
    Package: Net_GeoIP
    Operating System: Linux
    Package Version: Unknown
    PHP Version: 5.2.6
    -Assigned To:
    +Assigned To: doconnor
    Roadmap Versions:
    New Comment:

    -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]


    Previous Comments:
    ------------------------------------------------------------------------

    [2010-03-25 01:37:54] doconnor

    Added test to SVN

    ------------------------------------------------------------------------

    [2010-03-24 16:25:36] konrness

    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

    ------------------------------------------------------------------------

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedMar 25, '10 at 12:42a
activeMar 25, '10 at 12:54a
posts2
users1
websitepear.php.net

1 user in discussion

Daniel Oconnor: 2 posts

People

Translate

site design / logo © 2022 Grokbase