-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Yaml] deprecate unquoted indicator characters #16433
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
Conversation
xabbuh
commented
Nov 3, 2015
Q | A |
---|---|
Bug fix? | no |
New feature? | no |
BC breaks? | no |
Deprecations? | yes |
Tests pass? | yes |
Fixed tickets | FriendsOfPHP/security-advisories#111 |
License | MIT |
Doc PR |
@@ -237,7 +237,7 @@ public static function parseScalar($scalar, $delimiters = null, $stringDelimiter | |||
} | |||
|
|||
// a non-quoted string cannot start with @ or ` (reserved) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this comment should be updated too
We should also handle the case of unquoted values containing a |
5f54121
to
dd6418a
Compare
I updated the handling of the |
@@ -472,6 +473,13 @@ private function parseValue($value, $exceptionOnInvalidType, $objectSupport, $ob | |||
return $this->parseBlockScalar($matches['separator'], preg_replace('#\d+#', '', $modifiers), (int) abs($modifiers)); | |||
} | |||
|
|||
if ('mapping' === $context && '"' !== $value[0] && "'" !== $value[0] && '[' !== $value[0] && '{' !== $value[0] && '!' !== $value[0] && false !== strpos($value, ': ')) { | |||
@trigger_error('Using a colon in an unquoted mapping value is deprecated since Symfony 2.8 and will throw a ParseException in 3.0.', E_USER_DEPRECATED); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any way to provide some context like the line of the YAML file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
e76395f
to
a9d7d07
Compare
EOF; | ||
|
||
$this->deprecations = array(); | ||
set_error_handler(array($this, 'handleError')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you inline the error handler as an anonymous function? It's done like that in Twig because of PHP 5.2 but we don't need that here. I should have referenced the Twig docs instead where it's done the "modern way" (sorry about that): http://twig.sensiolabs.org/doc/recipes.html#displaying-deprecation-notices
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I should have thought about this myself.
a9d7d07
to
8416f7b
Compare
Thank you @xabbuh. |
This PR was merged into the 2.8 branch. Discussion ---------- [Yaml] deprecate unquoted indicator characters | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | FriendsOfPHP/security-advisories#111 | License | MIT | Doc PR | Commits ------- 8416f7b [Yaml] deprecate unquoted indicator characters
Any planned upgrade notes about that @xabbuh? |
@soullivaneuh see #16654 |
Thank you @xabbuh. |