From faef73888e2b018e94aa2ce222d227c537ba979a Mon Sep 17 00:00:00 2001 From: Aleksandr Dankovtsev Date: Thu, 1 Aug 2019 14:16:39 +0300 Subject: [PATCH 1/4] [Yaml] PHP-8: Uncaught TypeError: abs() expects parameter 1 to be int or float, string given --- src/Symfony/Component/Yaml/Parser.php | 2 +- .../Component/Yaml/Tests/ParserTest.php | 42 +++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Yaml/Parser.php b/src/Symfony/Component/Yaml/Parser.php index 4f5c30e168..013810df7a 100644 --- a/src/Symfony/Component/Yaml/Parser.php +++ b/src/Symfony/Component/Yaml/Parser.php @@ -715,7 +715,7 @@ class Parser if (self::preg_match('/^(?:'.self::TAG_PATTERN.' +)?'.self::BLOCK_SCALAR_HEADER_PATTERN.'$/', $value, $matches)) { $modifiers = isset($matches['modifiers']) ? $matches['modifiers'] : ''; - $data = $this->parseBlockScalar($matches['separator'], preg_replace('#\d+#', '', $modifiers), (int) abs($modifiers)); + $data = $this->parseBlockScalar($matches['separator'], preg_replace('#\d+#', '', $modifiers), (int) abs((int) $modifiers)); if ('' !== $matches['tag']) { if ('!!binary' === $matches['tag']) { diff --git a/src/Symfony/Component/Yaml/Tests/ParserTest.php b/src/Symfony/Component/Yaml/Tests/ParserTest.php index d3217b6302..56dc748a18 100644 --- a/src/Symfony/Component/Yaml/Tests/ParserTest.php +++ b/src/Symfony/Component/Yaml/Tests/ParserTest.php @@ -2307,6 +2307,48 @@ YAML; $this->assertSame(['parameters' => 'abc'], $this->parser->parse($yaml)); } + + public function testParseValueWithModifiers() + { + $yaml = <<assertSame( + [ + 'parameters' => [ + 'abc' => implode("\n", ['one', 'two', 'three', 'four', 'five']), + ], + ], + $this->parser->parse($yaml) + ); + } + + public function testParseValueWithNegativeModifiers() + { + $yaml = <<assertSame( + [ + 'parameters' => [ + 'abc' => implode("\n", ['one', 'two', 'three', 'four', 'five']), + ], + ], + $this->parser->parse($yaml) + ); + } } class B From 3b3582eeaff2890004fc77c985176f7ae6cd70be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?= Date: Sat, 3 Aug 2019 23:41:59 +0200 Subject: [PATCH 2/4] Fix path to phpunit binary --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8ccbc40da3..89fbf93a42 100644 --- a/.travis.yml +++ b/.travis.yml @@ -299,7 +299,7 @@ install: tfold src/Symfony/Component/Console.tty $PHPUNIT src/Symfony/Component/Console --group tty if [[ $PHP = ${MIN_PHP%.*} ]]; then export PHP=$MIN_PHP - echo -e "1\\n0" | xargs -I{} bash -c "tfold src/Symfony/Component/Process.sigchild{} SYMFONY_DEPRECATIONS_HELPER=weak ENHANCE_SIGCHLD={} php-$MIN_PHP/sapi/cli/php .phpunit/phpunit-4.8/phpunit --colors=always src/Symfony/Component/Process/" + echo -e "1\\n0" | xargs -I{} bash -c "tfold src/Symfony/Component/Process.sigchild{} SYMFONY_DEPRECATIONS_HELPER=weak ENHANCE_SIGCHLD={} php-$MIN_PHP/sapi/cli/php .phpunit/phpunit-4.8-0/phpunit --colors=always src/Symfony/Component/Process/" fi fi } From f1cb5559c9c69dbe0676e509ba45f54902facdd7 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sun, 4 Aug 2019 00:08:43 +0200 Subject: [PATCH 3/4] cs fix --- .../Component/Cache/Tests/Adapter/PredisClusterAdapterTest.php | 1 - .../Cache/Tests/Adapter/PredisRedisClusterAdapterTest.php | 1 - .../Component/Cache/Tests/Adapter/RedisArrayAdapterTest.php | 1 - .../Component/Cache/Tests/Adapter/RedisClusterAdapterTest.php | 1 - src/Symfony/Component/Cache/Tests/Simple/RedisArrayCacheTest.php | 1 - .../Component/Cache/Tests/Simple/RedisClusterCacheTest.php | 1 - src/Symfony/Component/Filesystem/Tests/FilesystemTest.php | 1 - .../Component/Finder/Tests/Iterator/RealIteratorTestCase.php | 1 - .../Form/Tests/Extension/Core/Type/BirthdayTypeTest.php | 1 - .../Component/Form/Tests/Extension/Core/Type/ButtonTypeTest.php | 1 - .../Component/Form/Tests/Extension/Core/Type/UrlTypeTest.php | 1 - src/Symfony/Component/Intl/Tests/Locale/LocaleTest.php | 1 - src/Symfony/Component/Lock/Tests/Store/PredisStoreTest.php | 1 - src/Symfony/Component/Lock/Tests/Store/RedisArrayStoreTest.php | 1 - src/Symfony/Component/Lock/Tests/Store/RedisClusterStoreTest.php | 1 - src/Symfony/Component/Lock/Tests/Store/RedisStoreTest.php | 1 - .../PropertyAccess/Tests/PropertyAccessorCollectionTest.php | 1 - 17 files changed, 17 deletions(-) diff --git a/src/Symfony/Component/Cache/Tests/Adapter/PredisClusterAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/PredisClusterAdapterTest.php index b083703eea..cd0dfb7a59 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/PredisClusterAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/PredisClusterAdapterTest.php @@ -11,7 +11,6 @@ namespace Symfony\Component\Cache\Tests\Adapter; - class PredisClusterAdapterTest extends AbstractRedisAdapterTest { public static function setUpBeforeClass() diff --git a/src/Symfony/Component/Cache/Tests/Adapter/PredisRedisClusterAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/PredisRedisClusterAdapterTest.php index a06477342b..5b09919e28 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/PredisRedisClusterAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/PredisRedisClusterAdapterTest.php @@ -11,7 +11,6 @@ namespace Symfony\Component\Cache\Tests\Adapter; - class PredisRedisClusterAdapterTest extends AbstractRedisAdapterTest { public static function setUpBeforeClass() diff --git a/src/Symfony/Component/Cache/Tests/Adapter/RedisArrayAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/RedisArrayAdapterTest.php index 77d3eadc8a..bd9def326d 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/RedisArrayAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/RedisArrayAdapterTest.php @@ -11,7 +11,6 @@ namespace Symfony\Component\Cache\Tests\Adapter; - class RedisArrayAdapterTest extends AbstractRedisAdapterTest { public static function setUpBeforeClass() diff --git a/src/Symfony/Component/Cache/Tests/Adapter/RedisClusterAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/RedisClusterAdapterTest.php index 0df9b00331..9c339d2dd7 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/RedisClusterAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/RedisClusterAdapterTest.php @@ -11,7 +11,6 @@ namespace Symfony\Component\Cache\Tests\Adapter; - class RedisClusterAdapterTest extends AbstractRedisAdapterTest { public static function setUpBeforeClass() diff --git a/src/Symfony/Component/Cache/Tests/Simple/RedisArrayCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/RedisArrayCacheTest.php index 4b60da4c62..ec5e4c06e2 100644 --- a/src/Symfony/Component/Cache/Tests/Simple/RedisArrayCacheTest.php +++ b/src/Symfony/Component/Cache/Tests/Simple/RedisArrayCacheTest.php @@ -11,7 +11,6 @@ namespace Symfony\Component\Cache\Tests\Simple; - class RedisArrayCacheTest extends AbstractRedisCacheTest { public static function setUpBeforeClass() diff --git a/src/Symfony/Component/Cache/Tests/Simple/RedisClusterCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/RedisClusterCacheTest.php index de0f936589..6b7f8039d7 100644 --- a/src/Symfony/Component/Cache/Tests/Simple/RedisClusterCacheTest.php +++ b/src/Symfony/Component/Cache/Tests/Simple/RedisClusterCacheTest.php @@ -11,7 +11,6 @@ namespace Symfony\Component\Cache\Tests\Simple; - class RedisClusterCacheTest extends AbstractRedisCacheTest { public static function setUpBeforeClass() diff --git a/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php b/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php index 1ed86fc65e..9b8d1a716a 100644 --- a/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php +++ b/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php @@ -11,7 +11,6 @@ namespace Symfony\Component\Filesystem\Tests; - /** * Test class for Filesystem. */ diff --git a/src/Symfony/Component/Finder/Tests/Iterator/RealIteratorTestCase.php b/src/Symfony/Component/Finder/Tests/Iterator/RealIteratorTestCase.php index 1a4d9ababa..70048a5ea6 100644 --- a/src/Symfony/Component/Finder/Tests/Iterator/RealIteratorTestCase.php +++ b/src/Symfony/Component/Finder/Tests/Iterator/RealIteratorTestCase.php @@ -11,7 +11,6 @@ namespace Symfony\Component\Finder\Tests\Iterator; - abstract class RealIteratorTestCase extends IteratorTestCase { protected static $tmpDir; diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/BirthdayTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/BirthdayTypeTest.php index 90a78898ce..8fef1d154b 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/BirthdayTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/BirthdayTypeTest.php @@ -11,7 +11,6 @@ namespace Symfony\Component\Form\Tests\Extension\Core\Type; - /** * @author Stepan Anchugov */ diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/ButtonTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/ButtonTypeTest.php index 53a69c1f34..9ed86fe459 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/ButtonTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/ButtonTypeTest.php @@ -11,7 +11,6 @@ namespace Symfony\Component\Form\Tests\Extension\Core\Type; - /** * @author Bernhard Schussek */ diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/UrlTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/UrlTypeTest.php index 97fae69a7f..74c4efb82f 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/UrlTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/UrlTypeTest.php @@ -11,7 +11,6 @@ namespace Symfony\Component\Form\Tests\Extension\Core\Type; - class UrlTypeTest extends TextTypeTest { const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\UrlType'; diff --git a/src/Symfony/Component/Intl/Tests/Locale/LocaleTest.php b/src/Symfony/Component/Intl/Tests/Locale/LocaleTest.php index 8d58293df6..7cf527946b 100644 --- a/src/Symfony/Component/Intl/Tests/Locale/LocaleTest.php +++ b/src/Symfony/Component/Intl/Tests/Locale/LocaleTest.php @@ -11,7 +11,6 @@ namespace Symfony\Component\Intl\Tests\Locale; - class LocaleTest extends AbstractLocaleTest { public function testAcceptFromHttp() diff --git a/src/Symfony/Component/Lock/Tests/Store/PredisStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/PredisStoreTest.php index ff0f01422d..aa3984b521 100644 --- a/src/Symfony/Component/Lock/Tests/Store/PredisStoreTest.php +++ b/src/Symfony/Component/Lock/Tests/Store/PredisStoreTest.php @@ -11,7 +11,6 @@ namespace Symfony\Component\Lock\Tests\Store; - /** * @author Jérémy Derussé */ diff --git a/src/Symfony/Component/Lock/Tests/Store/RedisArrayStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/RedisArrayStoreTest.php index 564d78be82..6f50dcefa6 100644 --- a/src/Symfony/Component/Lock/Tests/Store/RedisArrayStoreTest.php +++ b/src/Symfony/Component/Lock/Tests/Store/RedisArrayStoreTest.php @@ -11,7 +11,6 @@ namespace Symfony\Component\Lock\Tests\Store; - /** * @author Jérémy Derussé * diff --git a/src/Symfony/Component/Lock/Tests/Store/RedisClusterStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/RedisClusterStoreTest.php index 32a197130b..d6d72fb58e 100644 --- a/src/Symfony/Component/Lock/Tests/Store/RedisClusterStoreTest.php +++ b/src/Symfony/Component/Lock/Tests/Store/RedisClusterStoreTest.php @@ -11,7 +11,6 @@ namespace Symfony\Component\Lock\Tests\Store; - /** * @author Jérémy Derussé * diff --git a/src/Symfony/Component/Lock/Tests/Store/RedisStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/RedisStoreTest.php index 893e42fbc8..fd35ab4f2f 100644 --- a/src/Symfony/Component/Lock/Tests/Store/RedisStoreTest.php +++ b/src/Symfony/Component/Lock/Tests/Store/RedisStoreTest.php @@ -11,7 +11,6 @@ namespace Symfony\Component\Lock\Tests\Store; - /** * @author Jérémy Derussé * diff --git a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php index 507ec97ed9..34173b4e5e 100644 --- a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php +++ b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php @@ -11,7 +11,6 @@ namespace Symfony\Component\PropertyAccess\Tests; - class PropertyAccessorCollectionTest_Car { private $axes; From bfd5d4e3624041d3d62e9fa86d9704e7bdb7dd0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?= Date: Sun, 4 Aug 2019 00:21:34 +0200 Subject: [PATCH 4/4] Fix tests on console --- .../Console/Tests/ApplicationTest.php | 1 + .../Console/Tests/Helper/TableTest.php | 26 +++++++++---------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/Symfony/Component/Console/Tests/ApplicationTest.php b/src/Symfony/Component/Console/Tests/ApplicationTest.php index 6e99c2b83d..15ecf8e821 100644 --- a/src/Symfony/Component/Console/Tests/ApplicationTest.php +++ b/src/Symfony/Component/Console/Tests/ApplicationTest.php @@ -171,6 +171,7 @@ class ApplicationTest extends TestCase }; $application = new Application(); + $application->setAutoExit(false); $application ->register('test-foo') ->setAliases(['test']) diff --git a/src/Symfony/Component/Console/Tests/Helper/TableTest.php b/src/Symfony/Component/Console/Tests/Helper/TableTest.php index 1693623c91..571cf0a6c4 100644 --- a/src/Symfony/Component/Console/Tests/Helper/TableTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/TableTest.php @@ -114,11 +114,11 @@ TABLE $books, 'compact', <<<'TABLE' - ISBN Title Author - 99921-58-10-7 Divine Comedy Dante Alighieri - 9971-5-0210-0 A Tale of Two Cities Charles Dickens - 960-425-059-0 The Lord of the Rings J. R. R. Tolkien - 80-902734-1-6 And Then There Were None Agatha Christie + ISBN Title Author + 99921-58-10-7 Divine Comedy Dante Alighieri + 9971-5-0210-0 A Tale of Two Cities Charles Dickens + 960-425-059-0 The Lord of the Rings J. R. R. Tolkien + 80-902734-1-6 And Then There Were None Agatha Christie TABLE ], @@ -127,14 +127,14 @@ TABLE $books, 'borderless', <<<'TABLE' - =============== ========================== ================== - ISBN Title Author - =============== ========================== ================== - 99921-58-10-7 Divine Comedy Dante Alighieri - 9971-5-0210-0 A Tale of Two Cities Charles Dickens - 960-425-059-0 The Lord of the Rings J. R. R. Tolkien - 80-902734-1-6 And Then There Were None Agatha Christie - =============== ========================== ================== + =============== ========================== ================== + ISBN Title Author + =============== ========================== ================== + 99921-58-10-7 Divine Comedy Dante Alighieri + 9971-5-0210-0 A Tale of Two Cities Charles Dickens + 960-425-059-0 The Lord of the Rings J. R. R. Tolkien + 80-902734-1-6 And Then There Were None Agatha Christie + =============== ========================== ================== TABLE ],