Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 587b2f7

Browse files
committed
feature #23286 [Yaml] remove deprecated unspecific tag behavior (xabbuh)
This PR was merged into the 4.0-dev branch. Discussion ---------- [Yaml] remove deprecated unspecific tag behavior | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | yes | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | Commits ------- a12b8c3 [Yaml] remove deprecated unspecific tag behavior
2 parents 4cd4cb4 + a12b8c3 commit 587b2f7

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

src/Symfony/Component/Yaml/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ CHANGELOG
44
4.0.0
55
-----
66

7+
* The behavior of the non-specific tag `!` is changed and now forces
8+
non-evaluating your values.
79
* complex mappings will throw a `ParseException`
810
* support for the comma as a group separator for floats has been dropped, use
911
the underscore instead

src/Symfony/Component/Yaml/Inline.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -553,9 +553,7 @@ private static function evaluateScalar($scalar, $flags, $references = array())
553553
case 0 === strpos($scalar, '!str'):
554554
return (string) substr($scalar, 5);
555555
case 0 === strpos($scalar, '! '):
556-
@trigger_error('Using the non-specific tag "!" is deprecated since version 3.4 as its behavior will change in 4.0. It will force non-evaluating your values in 4.0. Use plain integers or !!float instead.', E_USER_DEPRECATED);
557-
558-
return (int) self::parseScalar(substr($scalar, 2), $flags);
556+
return substr($scalar, 2);
559557
case 0 === strpos($scalar, '!php/object:'):
560558
if (self::$objectSupport) {
561559
return unserialize(substr($scalar, 12));

src/Symfony/Component/Yaml/Tests/Fixtures/YtsSpecificationExamples.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -908,13 +908,12 @@ documents: 2
908908

909909
---
910910
test: Explicit typing
911-
deprecated: Using the non-specific tag "!" is deprecated since version 3.4 as its behavior will change in 4.0.
912911
yaml: |
913912
integer: 12
914-
also int: ! "12"
913+
no int: ! 12
915914
string: !str 12
916915
php: |
917-
array( 'integer' => 12, 'also int' => 12, 'string' => '12' )
916+
array( 'integer' => 12, 'no int' => '12', 'string' => '12' )
918917
---
919918
test: Private types
920919
todo: true

0 commit comments

Comments
 (0)