diff --git a/CHANGELOG.md b/CHANGELOG.md index a89f4e7..735efef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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/), 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 ### Fixed diff --git a/project.json b/project.json index abd4cae..a37387c 100644 --- a/project.json +++ b/project.json @@ -35,7 +35,7 @@ "company": "Nosial", "copyright": "Copyright (c) 2022-2023 Nosial", "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" }, "build": { diff --git a/src/ConfigLib/Configuration.php b/src/ConfigLib/Configuration.php index 3154347..10f65dd 100644 --- a/src/ConfigLib/Configuration.php +++ b/src/ConfigLib/Configuration.php @@ -328,15 +328,23 @@ return; } + $fs = new Filesystem(); + // If the configuration file is a YAML file, import it instead 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; } - $fs = new Filesystem(); - if (!$fs->exists($this->path)) { return;