osCommerce / oscommerce2

osCommerce Online Merchant v2.x
http://www.oscommerce.com
MIT License
281 stars 222 forks source link

OSCM - loadConfigFile function miss define variable #609

Open oitsuki opened 6 years ago

oitsuki commented 6 years ago

OSCOM.php $ini no define inside function

    public static function loadConfigFile($file, $group) {

      $cfg = [];

      if (is_file($file)) {
        include($file );

        if (isset($ini)) {
            $cfg = parse_ini_string($ini);
        }
      }

      if (!empty($cfg)) {
        static::$cfg[$group] = (isset(static::$cfg[$group])) ? array_merge(static::$cfg[$group], $cfg) : $cfg;
      }
    }
Gergely commented 6 years ago

@oitsuki

$ini declared in site_conf.php and included before.

oitsuki commented 6 years ago

Ok, I understand but inside the function / class is not declared

Gergely commented 6 years ago

$ini "protected and static". Global variables never be protected and never be static. PHP use defined constant for it. Here we use class "style". (variable scope)

    protected static $cfg = [];

http://php.net/manual/en/language.variables.scope.php

If is not set $ini means that not has configured yet. Probably not installed apps or somehing else.