safe
safe copied to clipboard
TypeError: Argument 4 passed to yaml_parse_file() must be of the type array, null given
Q | A |
---|---|
Safe version | ^0.11.12 |
PHP version | 7.4.0 |
PHP Strict Type? | True |
Operating system | MacOS |
description
TypeError: Argument 4 passed to yaml_parse_file() must be of the type array, null given
Are you explicitly passing null as an argument or using the default value?
Do you still have the porblem when upgrading to v1.0?
Do you still have the porblem when upgrading to v1.0?
Yes.
Are you explicitly passing null as an argument or using the default value?
using the default value.
The PHP's default value for this parameter is empty array. The Safe version has null as default value and passes it to the core function, which MUST result in a TypeError. Still broken in 1.1.3.
The workaround for this is to call it with all arguments. I.e.
$i = 0;
return \Safe\yaml_parse_file(__DIR__ . '/openapi.yml', 0, $i, []);
Pretty annoying.
This issue seems to be fixed in v2.0.1