Fixed Fatal error: Uncaught TypeError: array_replace_recursive(): Argument #1 ($array) must be of type array, null given in /var/ncc/packages/net.nosial.configlib=1.0.2/src/ConfigLib/Configuration.php:331

This commit is contained in:
Netkas 2023-07-13 17:05:32 -04:00
parent 4cffe41bf0
commit 01e9502179
No known key found for this signature in database
GPG key ID: 5DAF58535614062B
3 changed files with 17 additions and 4 deletions

View file

@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.0.3] - 2023-07-13
### Fixed
* Fixed `Fatal error: Uncaught TypeError: array_replace_recursive(): Argument #1 ($array) must be of type array, null given in /var/ncc/packages/net.nosial.configlib=1.0.2/src/ConfigLib/Configuration.php:331`
## [1.0.2] - 2023-07-11 ## [1.0.2] - 2023-07-11
### Fixed ### Fixed

View file

@ -35,7 +35,7 @@
"company": "Nosial", "company": "Nosial",
"copyright": "Copyright (c) 2022-2023 Nosial", "copyright": "Copyright (c) 2022-2023 Nosial",
"description": "ConfigLib is a library for reading and writing configuration files via the NCC Runtime API", "description": "ConfigLib is a library for reading and writing configuration files via the NCC Runtime API",
"version": "1.0.1", "version": "1.0.2",
"uuid": "9347259e-8e4d-11ed-85a7-fd07cf28ef35" "uuid": "9347259e-8e4d-11ed-85a7-fd07cf28ef35"
}, },
"build": { "build": {

View file

@ -328,15 +328,23 @@
return; return;
} }
$fs = new Filesystem();
// If the configuration file is a YAML file, import it instead // If the configuration file is a YAML file, import it instead
if(str_ends_with($this->path, '.yaml') || str_ends_with($this->path, '.yml')) if(str_ends_with($this->path, '.yaml') || str_ends_with($this->path, '.yml'))
{ {
$this->import($this->path);
if(!$fs->exists($this->path))
{
throw new RuntimeException(sprintf('Unable to import configuration file "%s" from environment, file does not exist', $path));
}
$yaml = file_get_contents($this->path);
$this->configuration = Yaml::parse($yaml);
return; return;
} }
$fs = new Filesystem();
if (!$fs->exists($this->path)) if (!$fs->exists($this->path))
{ {
return; return;