-
Notifications
You must be signed in to change notification settings - Fork 290
Closed
Description
Hello,
I'm seeing a strange behaviour with isset() and empty(), both returning invalid results for valid data.
$ipAddress = '128.101.101.200';
$reader = new \GeoIp2\Database\Reader('/usr/share/GeoIP/GeoLite2-Country.mmdb');
$countryRecord = $reader->country($ipAddress);
echo $countryRecord->country->name , "\n"; // United States
$isset = isset($countryRecord->country->name);
var_dump($isset); // bool(false) ?
$empty = empty($countryRecord->country->name);
var_dump($empty); // bool(true) ?
$empty = ($countryRecord->country->name == '');
var_dump($empty); // bool(false)
echo "\n";
$reader = new \GeoIp2\Database\Reader('/usr/share/GeoIP/GeoLite2-City.mmdb');
$cityRecord = $reader->city($ipAddress);
echo $cityRecord->country->name , "\n"; // United States
$isset = isset($cityRecord->country->name);
var_dump($isset); // bool(false) ?
$empty = empty($cityRecord->country->name);
var_dump($empty); // bool(true) ?
$empty = ($cityRecord->country->name == '');
var_dump($empty); // bool(false)
echo "\n";Metadata
Metadata
Assignees
Labels
No labels