From 559d48147253165cdacbd946beb7075a2589bf47 Mon Sep 17 00:00:00 2001 From: Dillon Date: Sun, 19 Jul 2020 16:03:44 -0400 Subject: [PATCH] Removed array_key_exists() on objects Replaced with https://www.php.net/manual/en/function.property-exists.php Closes #24 --- src/IniParser.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/IniParser.php b/src/IniParser.php index 893a941..f5c51c6 100644 --- a/src/IniParser.php +++ b/src/IniParser.php @@ -3,14 +3,14 @@ /** * [MIT Licensed](http://www.opensource.org/licenses/mit-license.php) * Copyright (c) 2013 Austin Hyde - * + * * Implements a parser for INI files that supports * * Section inheritance * * Property nesting * * Simple arrays - * + * * Compatible with PHP 5.2.0+ - * + * * @author Austin Hyde * @author Till Klampaeckel */ @@ -24,13 +24,13 @@ class IniParser { /** * Enable/disable property nesting feature - * @var boolean + * @var boolean */ public $property_nesting = true; /** * Use ArrayObject to allow array work as object (true) or use native arrays (false) - * @var boolean + * @var boolean */ public $use_array_object = true; @@ -58,7 +58,7 @@ class IniParser { /** * Array literals parse mode - * @var int + * @var int */ public $array_literals_behavior = self::PARSE_SIMPLE; @@ -146,9 +146,9 @@ private function parseSections(array $simple_parsed) { foreach ($sects as $s) { if ($s === '^') { $arr = array_merge($globals, $arr); - } elseif (array_key_exists($s, $output_sections)) { + } elseif (property_exists($output_sections, $s)) { $arr = array_merge($output_sections[$s], $arr); - } elseif (array_key_exists($s, $sections)) { + } elseif (property_exists($sections, $s)) { $arr = array_merge($sections[$s], $arr); } else { throw new UnexpectedValueException("IniParser: In file '{$this->file}', section '{$root}': Cannot inherit from unknown section '{$s}'"); @@ -194,7 +194,7 @@ private function parseKeys(array $arr) { $current = array($current); } - if (!array_key_exists($current_key, $current)) { + if (!property_exists($current, $current_key)) { if (!empty($path)) { $current[$current_key] = $this->getArrayValue(); } else {