Assuming a config like
{"foo": "bar"}
Testing
$config->has('foo.bar.baz')
will throw PHP Fatal error: Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type array, string given in /.../vendor/hassankhan/config/src/AbstractConfig.php:127
A simple fix to make has() return expected false in this case could be to add is_array($root) && .. before running the array_key_exists($segment, $root) statement
Assuming a config like
{"foo": "bar"}
Testing$config->has('foo.bar.baz')
will throwPHP Fatal error: Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type array, string given in /.../vendor/hassankhan/config/src/AbstractConfig.php:127
A simple fix to make
has()
return expectedfalse
in this case could be to addis_array($root) && ..
before running thearray_key_exists($segment, $root)
statement