[Yaml] Fixed #10597: Improved Yaml directive parsing
This commit is contained in:
parent
1b39930dad
commit
95d8ce3031
@ -586,7 +586,7 @@ class Parser
|
||||
|
||||
// strip YAML header
|
||||
$count = 0;
|
||||
$value = preg_replace('#^\%YAML[: ][\d\.]+.*\n#su', '', $value, -1, $count);
|
||||
$value = preg_replace('#^\%YAML[: ][\d\.]+.*\n#u', '', $value, -1, $count);
|
||||
$this->offset += $count;
|
||||
|
||||
// remove leading comments
|
||||
|
@ -650,6 +650,17 @@ map_in_map: { foo: { bar: *var } }
|
||||
EOF
|
||||
));
|
||||
}
|
||||
|
||||
public function testYamlDirective()
|
||||
{
|
||||
$yaml = <<<EOF
|
||||
%YAML 1.2
|
||||
---
|
||||
foo: 1
|
||||
bar: 2
|
||||
EOF;
|
||||
$this->assertEquals(array('foo' => 1, 'bar' => 2), $this->parser->parse($yaml));
|
||||
}
|
||||
}
|
||||
|
||||
class B
|
||||
|
Reference in New Issue
Block a user