Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: symfony/yaml
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v4.4.7
Choose a base ref
...
head repository: symfony/yaml
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v4.4.8
Choose a head ref
  • 5 commits
  • 5 files changed
  • 3 contributors

Commits on Apr 6, 2020

  1. Copy the full SHA
    e366a2e View commit details
  2. Merge branch '3.4' into 4.4

    * 3.4:
      [PropertyAccess] fix tests
      [WebProfilerBundle] fix test
      remove assertions that can never be reached
      [PropertyAccess] Improve message of unitialized property in php 7.4
      [HttpFoundation] Fixed session migration with custom cookie lifetime
      [Serializer] Remove unused variable
      Allow URL-encoded special characters in basic auth part of URLs
      [Serializer] Fix unitialized properties (from PHP 7.4.2) when serializing context for the cache key
      [Validator] Add missing Ukrainian and Russian translations
      No need to reconnect the bags to the session
      Support for Content Security Policy style-src-elem and script-src-elem in WebProfiler
      [PropertyInfo][ReflectionExtractor] Check the array mutator prefixes last when the property is singular
    nicolas-grekas committed Apr 6, 2020
    Copy the full SHA
    7c77e4e View commit details

Commits on Apr 15, 2020

  1. [PhpUnitBridge] add PolyfillTestCaseTrait::expectExceptionMessageMatc…

    …hes to provide FC with recent phpunit versions
    soyuka authored and nicolas-grekas committed Apr 15, 2020
    Copy the full SHA
    8a65d0f View commit details

Commits on Apr 24, 2020

  1. [YAML] escape DEL(\x7f)

    sdkawata committed Apr 24, 2020
    Copy the full SHA
    8fef49a View commit details

Commits on Apr 28, 2020

  1. Merge branch '3.4' into 4.4

    * 3.4:
      updated VERSION for 3.4.40
      update CONTRIBUTORS for 3.4.40
      updated CHANGELOG for 3.4.40
      [WebProfilerBundle] changed label of peak memory usage in the time & memory panels (MB into MiB)
      add tests for the ConstraintViolationBuilder class
      Improve dirname usage
      [PhpUnitBridge] Use COMPOSER_BINARY env var if available
      [YAML] escape DEL(\x7f)
      fix compatibility with phpunit 9
      [Cache] skip APCu in chains when the backend is disabled
      [Form] apply automatically step=1 for datetime-local input
    nicolas-grekas committed Apr 28, 2020
    Copy the full SHA
    b385dce View commit details
Showing with 12 additions and 9 deletions.
  1. +3 −1 Escaper.php
  2. +1 −1 Inline.php
  3. +1 −0 Tests/DumperTest.php
  4. +3 −3 Tests/InlineTest.php
  5. +4 −4 Tests/ParserTest.php
4 changes: 3 additions & 1 deletion Escaper.php
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@
class Escaper
{
// Characters that would cause a dumped string to require double quoting.
const REGEX_CHARACTER_TO_ESCAPE = "[\\x00-\\x1f]|\xc2\x85|\xc2\xa0|\xe2\x80\xa8|\xe2\x80\xa9";
const REGEX_CHARACTER_TO_ESCAPE = "[\\x00-\\x1f]|\x7f|\xc2\x85|\xc2\xa0|\xe2\x80\xa8|\xe2\x80\xa9";

// Mapping arrays for escaping a double quoted string. The backslash is
// first to ensure proper escaping because str_replace operates iteratively
@@ -33,13 +33,15 @@ class Escaper
"\x08", "\x09", "\x0a", "\x0b", "\x0c", "\x0d", "\x0e", "\x0f",
"\x10", "\x11", "\x12", "\x13", "\x14", "\x15", "\x16", "\x17",
"\x18", "\x19", "\x1a", "\x1b", "\x1c", "\x1d", "\x1e", "\x1f",
"\x7f",
"\xc2\x85", "\xc2\xa0", "\xe2\x80\xa8", "\xe2\x80\xa9",
];
private static $escaped = ['\\\\', '\\"', '\\\\', '\\"',
'\\0', '\\x01', '\\x02', '\\x03', '\\x04', '\\x05', '\\x06', '\\a',
'\\b', '\\t', '\\n', '\\v', '\\f', '\\r', '\\x0e', '\\x0f',
'\\x10', '\\x11', '\\x12', '\\x13', '\\x14', '\\x15', '\\x16', '\\x17',
'\\x18', '\\x19', '\\x1a', '\\e', '\\x1c', '\\x1d', '\\x1e', '\\x1f',
'\\x7f',
'\\N', '\\_', '\\L', '\\P',
];

2 changes: 1 addition & 1 deletion Inline.php
Original file line number Diff line number Diff line change
@@ -615,7 +615,7 @@ private static function evaluateScalar(string $scalar, int $flags, array $refere
throw new ParseException(sprintf('The constant "%s" is not defined.', $const), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename);
}
if (self::$exceptionOnInvalidType) {
throw new ParseException(sprintf('The string "%s" could not be parsed as a constant. Have you forgotten to pass the "Yaml::PARSE_CONSTANT" flag to the parser?', $scalar), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename);
throw new ParseException(sprintf('The string "%s" could not be parsed as a constant. Did you forget to pass the "Yaml::PARSE_CONSTANT" flag to the parser?', $scalar), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename);
}

return null;
1 change: 1 addition & 0 deletions Tests/DumperTest.php
Original file line number Diff line number Diff line change
@@ -223,6 +223,7 @@ public function getEscapeSequences()
'double-quote' => ['"', "'\"'"],
'slash' => ['/', '/'],
'backslash' => ['\\', '\\'],
'del' => ["\x7f", '"\x7f"'],
'next-line' => ["\xC2\x85", '"\\N"'],
'non-breaking-space' => ["\xc2\xa0", '"\\_"'],
'line-separator' => ["\xE2\x80\xA8", '"\\L"'],
6 changes: 3 additions & 3 deletions Tests/InlineTest.php
Original file line number Diff line number Diff line change
@@ -74,7 +74,7 @@ public function testParsePhpConstantThrowsExceptionWhenUndefined()
public function testParsePhpConstantThrowsExceptionOnInvalidType()
{
$this->expectException('Symfony\Component\Yaml\Exception\ParseException');
$this->expectExceptionMessageRegExp('#The string "!php/const PHP_INT_MAX" could not be parsed as a constant.*#');
$this->expectExceptionMessageMatches('#The string "!php/const PHP_INT_MAX" could not be parsed as a constant.*#');
Inline::parse('!php/const PHP_INT_MAX', Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE);
}

@@ -599,7 +599,7 @@ public function getBinaryData()
public function testParseInvalidBinaryData($data, $expectedMessage)
{
$this->expectException('Symfony\Component\Yaml\Exception\ParseException');
$this->expectExceptionMessageRegExp($expectedMessage);
$this->expectExceptionMessageMatches($expectedMessage);

Inline::parse($data);
}
@@ -787,7 +787,7 @@ public function phpConstTagWithEmptyValueProvider()
public function testUnquotedExclamationMarkThrows(string $value)
{
$this->expectException(ParseException::class);
$this->expectExceptionMessageRegExp('/^Using the unquoted scalar value "!" is not supported\. You must quote it at line 1 \(near "/');
$this->expectExceptionMessageMatches('/^Using the unquoted scalar value "!" is not supported\. You must quote it at line 1 \(near "/');

Inline::parse($value);
}
8 changes: 4 additions & 4 deletions Tests/ParserTest.php
Original file line number Diff line number Diff line change
@@ -602,7 +602,7 @@ public function testShortcutKeyUnindentedCollectionException()
public function testMultipleDocumentsNotSupportedException()
{
$this->expectException('Symfony\Component\Yaml\Exception\ParseException');
$this->expectExceptionMessageRegExp('/^Multiple documents are not supported.+/');
$this->expectExceptionMessageMatches('/^Multiple documents are not supported.+/');
Yaml::parse(<<<'EOL'
# Ranking of 1998 home runs
---
@@ -1348,7 +1348,7 @@ public function getBinaryData()
public function testParseInvalidBinaryData($data, $expectedMessage)
{
$this->expectException('Symfony\Component\Yaml\Exception\ParseException');
$this->expectExceptionMessageRegExp($expectedMessage);
$this->expectExceptionMessageMatches($expectedMessage);

$this->parser->parse($data);
}
@@ -2102,14 +2102,14 @@ public function testParseFile()
public function testParsingNonExistentFilesThrowsException()
{
$this->expectException('Symfony\Component\Yaml\Exception\ParseException');
$this->expectExceptionMessageRegExp('#^File ".+/Fixtures/nonexistent.yml" does not exist\.$#');
$this->expectExceptionMessageMatches('#^File ".+/Fixtures/nonexistent.yml" does not exist\.$#');
$this->parser->parseFile(__DIR__.'/Fixtures/nonexistent.yml');
}

public function testParsingNotReadableFilesThrowsException()
{
$this->expectException('Symfony\Component\Yaml\Exception\ParseException');
$this->expectExceptionMessageRegExp('#^File ".+/Fixtures/not_readable.yml" cannot be read\.$#');
$this->expectExceptionMessageMatches('#^File ".+/Fixtures/not_readable.yml" cannot be read\.$#');
if ('\\' === \DIRECTORY_SEPARATOR) {
$this->markTestSkipped('chmod is not supported on Windows');
}