mirror of
https://github.com/getformwork/formwork.git
synced 2025-02-25 02:02:57 +01:00
Fix errors when using PHP Yaml extension
This commit is contained in:
parent
bab01136be
commit
fb147fd094
@ -24,7 +24,7 @@ class YAML extends AbstractParser
|
|||||||
*/
|
*/
|
||||||
public static function parse($input, array $options = [])
|
public static function parse($input, array $options = [])
|
||||||
{
|
{
|
||||||
if (function_exists('yaml_parse') && $options['usePHPYAML'] ?? static::PHPYAMLmode('parse')) {
|
if (function_exists('yaml_parse') && ($options['usePHPYAML'] ?? static::PHPYAMLmode('parse'))) {
|
||||||
if (!preg_match('/^---\n/', $input)) {
|
if (!preg_match('/^---\n/', $input)) {
|
||||||
$input = "---\n" . $input;
|
$input = "---\n" . $input;
|
||||||
}
|
}
|
||||||
@ -47,7 +47,7 @@ class YAML extends AbstractParser
|
|||||||
if (empty($data)) {
|
if (empty($data)) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
if (function_exists('yaml_emit') && $options['usePHPYAML'] ?? static::PHPYAMLmode('emit')) {
|
if (function_exists('yaml_emit') && ($options['usePHPYAML'] ?? static::PHPYAMLmode('emit'))) {
|
||||||
return preg_replace('/^---[\n ]|\n\.{3}$/', '', yaml_emit($data));
|
return preg_replace('/^---[\n ]|\n\.{3}$/', '', yaml_emit($data));
|
||||||
}
|
}
|
||||||
return SymfonyYaml::dump($data);
|
return SymfonyYaml::dump($data);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user