Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yaml parse fails to understand or allow %YAML #10597

Closed
Dragonrun1 opened this issue Mar 31, 2014 · 0 comments
Closed

Yaml parse fails to understand or allow %YAML #10597

Dragonrun1 opened this issue Mar 31, 2014 · 0 comments
Labels
Good first issue Ideal for your first contribution! (some Symfony experience may be required) Yaml

Comments

@Dragonrun1
Copy link

Directly from the docs at http://www.yaml.org/spec/1.2/spec.html#id2781553
A version 1.2 YAML processor must accept documents with an explicit “%YAML 1.2” directive, as well as documents lacking a “YAML” directive.

example yaml file:

%YAML 1.2

---
yapeal:
    application_agent: ""
    registered_mode: "optional"

Using:

$handler = new Yaml();
$result = $handler->parse($yapealYaml);
var_dump($result);
print PHP_EOL;

Expect:

Array
(
    [yapeal] => Array
        (
            [application_agent] =>
            [registered_mode] => optional
)

Get:

NULL

If I use %YAML 1.1 also get the same result. This is also covered in the above spec about how it should be handled.

@jakzal jakzal added the Yaml label Mar 31, 2014
@fabpot fabpot added the Good first issue Ideal for your first contribution! (some Symfony experience may be required) label Dec 29, 2014
VictoriaQ added a commit to VictoriaQ/symfony that referenced this issue Jan 8, 2015
fabpot added a commit that referenced this issue Jan 9, 2015
…oriaQ)

This PR was submitted for the 2.7 branch but it was merged into the 2.3 branch instead (closes #13334).

Discussion
----------

[Yaml] Fixed #10597: Improved Yaml directive parsing

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #10597
| License       | MIT
| Doc PR        | N/A

There was a problem with the regular expression used to process the YAML directive. The modifier `s` made the regex too greedy, replacing everything but the last line of the YAML. Existing tests using the YAML directive contained only one line, that's why they were passing.

Commits
-------

95d8ce3 [Yaml] Fixed #10597: Improved Yaml directive parsing
@fabpot fabpot closed this as completed Jan 9, 2015
fabpot added a commit that referenced this issue Jan 9, 2015
* 2.3:
  [PropertyAccessor] Added test to allow null value for a array
  [Yaml] Fixed #10597: Improved Yaml directive parsing
  [Form] Set a child type to text if added to the form without a type.

Conflicts:
	src/Symfony/Component/PropertyAccess/PropertyAccessor.php
	src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php
fabpot added a commit that referenced this issue Jan 9, 2015
* 2.5:
  [PropertyAccessor] Added test to allow null value for a array
  [Yaml] Fixed #10597: Improved Yaml directive parsing
  [Form] Set a child type to text if added to the form without a type.
fabpot added a commit that referenced this issue Jan 9, 2015
* 2.6:
  [PropertyAccessor] Added test to allow null value for a array
  [Yaml] Fixed #10597: Improved Yaml directive parsing
  [Form] Fixed check of violation constraint #12792
  [Form] Set a child type to text if added to the form without a type.
fabpot added a commit that referenced this issue Jan 9, 2015
* 2.7: (22 commits)
  [DependencyInjection] deprecated synchronized services
  [FrameworkBundle] adds legacy tests for deprecated configuration keys.
  [TwigBundle] adds legacy tests for deprecated configuration keys.
  [PropertyAccessor] Added test to allow null value for a array
  [Yaml] Fixed #10597: Improved Yaml directive parsing
  [Validator] always use the lazy loading metadata factory
  [Validator] removed usage of deprecated getMessageParameters() and getMessagePluralization() in unit tests
  [Validator] fixed deprecation notices for BuildViolation() calls in constraints
  [Validator] fixed usage of deprecate Validator features
  [Validator] removed obsolete code
  removed the Validator BC layer for PHP < 5.3.9
  removed code for PHP < 5.3.9
  bumped min PHP version to 5.3.9
  fixed deprecation summary and missing error_reporting() in tests
  [Form] Fixed check of violation constraint #12792
  [FrameworkBundle] adds deprecation notice on framework.csrf_protection.field_name configuration key.
  [TwigBundle] adds missing deprecation notice for the twig.form.resources configuration key.
  [FrameworkBundle] avoid using deprecated classes for reflection
  [FrameworkBundle] Add a test case for service aliases used with AddExpressionLanguageProviderPass.
  [FrameworkBundle] fixed #12847 AddExpressionLanguageProviderPass
  ...

Conflicts:
	.travis.yml
	composer.json
	src/Symfony/Bridge/Doctrine/composer.json
	src/Symfony/Bridge/Monolog/composer.json
	src/Symfony/Bridge/Propel1/composer.json
	src/Symfony/Bridge/ProxyManager/composer.json
	src/Symfony/Bridge/Swiftmailer/composer.json
	src/Symfony/Bridge/Twig/composer.json
	src/Symfony/Bundle/DebugBundle/composer.json
	src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
	src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
	src/Symfony/Bundle/FrameworkBundle/composer.json
	src/Symfony/Bundle/SecurityBundle/composer.json
	src/Symfony/Bundle/TwigBundle/composer.json
	src/Symfony/Bundle/WebProfilerBundle/composer.json
	src/Symfony/Component/BrowserKit/composer.json
	src/Symfony/Component/ClassLoader/composer.json
	src/Symfony/Component/Config/composer.json
	src/Symfony/Component/Console/composer.json
	src/Symfony/Component/CssSelector/composer.json
	src/Symfony/Component/Debug/composer.json
	src/Symfony/Component/DependencyInjection/composer.json
	src/Symfony/Component/DomCrawler/composer.json
	src/Symfony/Component/EventDispatcher/composer.json
	src/Symfony/Component/ExpressionLanguage/composer.json
	src/Symfony/Component/Filesystem/composer.json
	src/Symfony/Component/Finder/composer.json
	src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php
	src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php
	src/Symfony/Component/Form/composer.json
	src/Symfony/Component/HttpFoundation/composer.json
	src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php
	src/Symfony/Component/HttpKernel/composer.json
	src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php
	src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php
	src/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php
	src/Symfony/Component/Intl/composer.json
	src/Symfony/Component/Locale/composer.json
	src/Symfony/Component/OptionsResolver/composer.json
	src/Symfony/Component/Process/composer.json
	src/Symfony/Component/PropertyAccess/composer.json
	src/Symfony/Component/Routing/composer.json
	src/Symfony/Component/Security/Acl/composer.json
	src/Symfony/Component/Security/Core/composer.json
	src/Symfony/Component/Security/Csrf/composer.json
	src/Symfony/Component/Security/Http/composer.json
	src/Symfony/Component/Security/composer.json
	src/Symfony/Component/Serializer/composer.json
	src/Symfony/Component/Stopwatch/composer.json
	src/Symfony/Component/Templating/composer.json
	src/Symfony/Component/Translation/composer.json
	src/Symfony/Component/Validator/Tests/Validator/Abstract2Dot5ApiTest.php
	src/Symfony/Component/Validator/Tests/ValidatorBuilderTest.php
	src/Symfony/Component/Validator/composer.json
	src/Symfony/Component/VarDumper/composer.json
	src/Symfony/Component/Yaml/composer.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good first issue Ideal for your first contribution! (some Symfony experience may be required) Yaml
Projects
None yet
Development

No branches or pull requests

3 participants