Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0eb696f

Browse filesBrowse files
committed
prevent notice for invalid octal numbers on PHP 7.4
1 parent cfa048c commit 0eb696f
Copy full SHA for 0eb696f

File tree

Expand file treeCollapse file tree

2 files changed

+12
-2
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+12
-2
lines changed

‎src/Symfony/Component/Yaml/Inline.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Yaml/Inline.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -762,12 +762,12 @@ private static function evaluateScalar($scalar, $flags, $references = [])
762762
$raw = $scalar;
763763
$cast = (int) $scalar;
764764

765-
return '0' == $scalar[0] ? octdec($scalar) : (((string) $raw == (string) $cast) ? $cast : $raw);
765+
return '0' === $scalar[0] ? octdec($scalar) : (((string) $raw == (string) $cast) ? $cast : $raw);
766766
case '-' === $scalar[0] && ctype_digit(substr($scalar, 1)):
767767
$raw = $scalar;
768768
$cast = (int) $scalar;
769769

770-
return '0' == $scalar[1] ? -octdec(substr($scalar, 1)) : (($raw === (string) $cast) ? $cast : $raw);
770+
return '0' === $scalar[1] ? -octdec(substr($scalar, 1)) : (($raw === (string) $cast) ? $cast : $raw);
771771
case is_numeric($scalar):
772772
case Parser::preg_match(self::getHexRegex(), $scalar):
773773
$scalar = str_replace('_', '', $scalar);

‎src/Symfony/Component/Yaml/Tests/InlineTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Yaml/Tests/InlineTest.php
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -842,4 +842,14 @@ public function phpConstTagWithEmptyValueProvider()
842842
[['' => 'foo', 'bar' => 'ccc'], '{!php/const : foo, bar: ccc}'],
843843
];
844844
}
845+
846+
public function testParseInvalidPositiveOctalNumber()
847+
{
848+
self::assertSame(342391, Inline::parse('0123456789'));
849+
}
850+
851+
public function testParseInvalidNegativeOctalNumber()
852+
{
853+
self::assertSame(-342391, Inline::parse('-0123456789'));
854+
}
845855
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.