PHP Classes

PHP 7 bug

Recommend this page to a friend!

      PHP Geo Location by Internet Protocol API  >  All threads  >  PHP 7 bug  >  (Un) Subscribe thread alerts  
Subject:PHP 7 bug
Summary:Getting notice with PHP 7.1
Author:Larry Wakeman
Date:2018-10-26 15:32:02

  1. PHP 7 bug   Reply   Report abuse  
Picture of Larry Wakeman Larry Wakeman - 2018-10-26 15:32:02
getting '[26-Oct-2018 07:08:34 UTC] PHP Notice: Undefined property: ipapiWrapper::$params in /home/rscdshosting/public_html/Test/ipapi.class.php on line 132' when running on PHP 7.1

$params is not defined in the class. Line 132 is
' if( is_array($this->params) ){'
and with PHP 5 this would return a false, with PHP 7, you get the notice instead. Either add a definition in the class or change the line to
' if(isset($this->params) && is_array($this->params) ){'

  2. Re: PHP 7 bug   Reply   Report abuse  
Picture of Dave Smith Dave Smith - 2018-10-26 20:48:33 - In reply to message 1 from Larry Wakeman
Thanks for the heads up. Added the property to the class so that anyone running PHP with E_ALL error reporting wont't get a warning.