Hello,
I’m trying to use this scripts on my Synology NAS with Postgresql and php72. I’m getting some PHP errors: Can someone give me a hint?
Fatal error: Uncaught TypeError: Argument 1 passed to solax_php\Config::commandLineParser() must be of the type array, null given, called in /volume1/web/solax-php-master/lib/Config.php on line 18 and defined in /volume1/web/solax-php-master/lib/Config.php:22 Stack trace: #0 /volume1/web/solax-php-master/lib/Config.php(18): solax_php\Config->commandLineParser(NULL) #1 /volume1/web/solax-php-master/lib/Config.php(41): solax_php\Config->__construct() #2 /volume1/web/solax-php-master/lib/Config.php(54): solax_php\Config::getInstance() #3 /volume1/web/solax-php-master/scripts/import.php(10): solax_php\Config::get(‘database.hostna…’) #4 {main} thrown in /volume1/web/solax-php-master/lib/Config.php on line 22
Script: Config.php
<?php
namespace solax_php;
class Config {
protected static $instance;
protected $config = [];
/**
* constructor, reads ini file
*/
protected function __construct(){
$this->config = parse_ini_file(__DIR__ . '/../config/solax-php.ini', true);
$this->commandLineParser($GLOBALS['argv']);
}
protected function commandLineParser(array $args) : void {
$len = count($args);
for ( $i = 1; $i < $len; $i++ ){
if ( $args[$i] == '--date' ){
$this->_set('global.date', $args[($i+1)]);
$i++;
} elseif ( $args[$i] == '--set' ){
list($term, $value) = explode('=', $args[($i+1)]);
$this->_set($term, $value);
$i++;
}
}