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

Bug #18640 Class has no unserializer
Submitted: 2011-06-30 23:50 UTC
From: matthewslyman Assigned:
Status: Bogus Package: Net_GeoIP (version 1.0.0)
PHP Version: 5.2.12 OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2011-06-30 23:50 UTC] matthewslyman (Matthew Slyman)
Description: ------------ Tried storing the results of: $geoip->lookupLocation($_SERVER['REMOTE_ADDR']) in a session variable. The session_start() function results in a warning. Test script: --------------- <?php session_start(); if(!isset($_SESSION['location'])){//ONLY LOOKUP LOCATION DATA ONCE PER SESSION (which we insist will be on only one IP address anyway) require_once "Net/GeoIP.php"; $geoip = Net_GeoIP::getInstance("/home/aaabitco/php/Net/GeoIP/GeoLiteCity.dat"); try { session_register('location'); $_SESSION['location'] = $geoip->lookupLocation($_SERVER['REMOTE_ADDR']); } catch (Exception $e) {// Handle exception } } ?> Expected result: ---------------- If the session is new, location data should be cached in a session variable (this works fine). I would expect this to work without errors or warnings (this is where it goes wrong). Actual result: -------------- Session variable correctly caches the data, but when session_start() function is called, this warning message is displayed on the web: Warning: Class __PHP_Incomplete_Class has no unserializer in /home/{accountname}/public_html/news/index.php on line 1 I reckon this is happening because the Class of the location data is missing an "unserializer" method. Am I wrong?

Comments

 [2011-07-01 02:12 UTC] ohill (Olivier Hill)
-Status: Open +Status: Bogus
Sorry, but your problem does not imply a bug in PEAR itself. For a list of more appropriate places to ask for help using PEAR, please visit http://pear.php.net/support/ as this bug system is not the appropriate forum for asking support questions. Thank you for your interest in PEAR. The method returns an object. You could serialize an array containing the different values, ie: $_SESSION['location'] = array($location->city, $location->region, $location->latitude, $location->longitude);