ip2location / ip2location-laravel

IP2Location Laravel extension enables the user to find the country, region, city, coordinates, zip code, time zone, ISP, domain name, connection type, area code, weather, MCC, MNC, mobile brand name, elevation, usage type, IP address type and IAB advertising category from IP address using IP2Location database.
http://www.ip2location.com
MIT License
77 stars 13 forks source link

PHP 8.2+ support: Deprecated:Creation of dynamic property #5

Closed andreypopov closed 11 months ago

andreypopov commented 11 months ago

Please, fix this one:

Deprecated:Creation of dynamic property Ip2location\IP2LocationLaravel\IP2LocationLaravel::$db is deprecated(8192) File: /vendor/ip2location/ip2location-laravel/src/IP2LocationLaravel.php:11 $this->db = new \IP2Location\Database($this->getDatabasePath(), \IP2Location\Database::FILE_IO);

2023-11-28_14-14-31

andreypopov commented 11 months ago

PR https://github.com/ip2location/ip2location-laravel/pull/6

ip2location commented 11 months ago

Hi andrey,

We have tested our library in PHP 8.2.6 and 8.3.0 but unable to reproduce the issue. Can you please provide us:

  1. Your environment, eg PHP and Laravel version?
  2. The code that you have produced the issue with?
andreypopov commented 11 months ago

Just capture errors like:

<php

set_error_handler(['ErrorHandlerLaravel', 'captureNormal'], E_ALL & ~(E_STRICT));

class ErrorHandlerLaravel
{
    public static function captureNormal($number, $message, $file, $line)
    {
        $error = [
            'type' => $number,
            'message' => $message,
            'file' => $file,
            'line' => $line,
        ];
        dump($error);
    }
}

\Ip2location\IP2LocationLaravel\Facade\IP2LocationLaravel::get(request()->ip());
ip2location commented 11 months ago

Hi andrey,

Thanks for the reply, we will check on this deprecation message and your PR.