From bd0c206a32d6c4951c8bf02c23a1f3a1842797e6 Mon Sep 17 00:00:00 2001 From: Alessandro Lai Date: Fri, 27 Jan 2017 15:42:16 +0100 Subject: [PATCH 1/7] Add missing pieces in the upgrade guide to 3.0 --- UPGRADE-3.0.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/UPGRADE-3.0.md b/UPGRADE-3.0.md index 467c13e644..7e48c1f987 100644 --- a/UPGRADE-3.0.md +++ b/UPGRADE-3.0.md @@ -1,6 +1,35 @@ UPGRADE FROM 2.x to 3.0 ======================= +# Table of Contents + +- [ClassLoader](#classloader) +- [Config](#config) +- [Console](#console) +- [DependencyInjection](#dependencyinjection) +- [DoctrineBridge](#doctrinebridge) +- [DomCrawler](#domcrawler) +- [EventDispatcher](#eventdispatcher) +- [Form](#form) +- [FrameworkBundle](#frameworkbundle) +- [HttpFoundation](#httpfoundation) +- [HttpKernel](#httpkernel) +- [Locale](#locale) +- [Monolog Bridge](#monolog-bridge) +- [Process](#process) +- [PropertyAccess](#propertyaccess) +- [Routing](#routing) +- [Security](#security) +- [SecurityBundle](#securitybundle) +- [Serializer](#serializer) +- [Swiftmailer Bridge](#swiftmailer-bridge) +- [Translator](#translator) +- [Twig Bridge](#twig-bridge) +- [TwigBundle](#twigbundle) +- [Validator](#validator) +- [WebProfiler](#webprofiler) +- [Yaml](#yaml) + ### ClassLoader * The `UniversalClassLoader` class has been removed in favor of @@ -1131,3 +1160,10 @@ UPGRADE FROM 2.x to 3.0 * `Process::setStdin()` and `Process::getStdin()` have been removed. Use `Process::setInput()` and `Process::getInput()` that works the same way. * `Process::setInput()` and `ProcessBuilder::setInput()` do not accept non-scalar types. + +### Monolog Bridge + + * `Symfony\Bridge\Monolog\Logger::emerg()` was removed. Use `emergency()` which is PSR-3 compatible. + * `Symfony\Bridge\Monolog\Logger::crit()` was removed. Use `critical()` which is PSR-3 compatible. + * `Symfony\Bridge\Monolog\Logger::err()` was removed. Use `error()` which is PSR-3 compatible. + * `Symfony\Bridge\Monolog\Logger::warn()` was removed. Use `warning()` which is PSR-3 compatible. From 50373f3530e302f04508d4567f02cb968cad26a4 Mon Sep 17 00:00:00 2001 From: Maxime Steinhausser Date: Fri, 27 Jan 2017 19:52:37 +0100 Subject: [PATCH 2/7] [Console] Fix TableCell issues with decoration --- .../Component/Console/Helper/Table.php | 2 +- .../Console/Tests/Helper/TableTest.php | 45 +++++++++++++++---- 2 files changed, 38 insertions(+), 9 deletions(-) diff --git a/src/Symfony/Component/Console/Helper/Table.php b/src/Symfony/Component/Console/Helper/Table.php index 904c04b682..289d1a11da 100644 --- a/src/Symfony/Component/Console/Helper/Table.php +++ b/src/Symfony/Component/Console/Helper/Table.php @@ -518,7 +518,7 @@ class Table foreach ($row as $i => $cell) { if ($cell instanceof TableCell) { - $textLength = strlen($cell); + $textLength = Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell); if ($textLength > 0) { $contentColumns = str_split($cell, ceil($textLength / $cell->getColspan())); foreach ($contentColumns as $position => $content) { diff --git a/src/Symfony/Component/Console/Tests/Helper/TableTest.php b/src/Symfony/Component/Console/Tests/Helper/TableTest.php index a691405c6b..583777b3ca 100644 --- a/src/Symfony/Component/Console/Tests/Helper/TableTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/TableTest.php @@ -35,9 +35,9 @@ class TableTest extends \PHPUnit_Framework_TestCase /** * @dataProvider testRenderProvider */ - public function testRender($headers, $rows, $style, $expected) + public function testRender($headers, $rows, $style, $expected, $decorated = false) { - $table = new Table($output = $this->getOutputStream()); + $table = new Table($output = $this->getOutputStream($decorated)); $table ->setHeaders($headers) ->setRows($rows) @@ -51,9 +51,9 @@ class TableTest extends \PHPUnit_Framework_TestCase /** * @dataProvider testRenderProvider */ - public function testRenderAddRows($headers, $rows, $style, $expected) + public function testRenderAddRows($headers, $rows, $style, $expected, $decorated = false) { - $table = new Table($output = $this->getOutputStream()); + $table = new Table($output = $this->getOutputStream($decorated)); $table ->setHeaders($headers) ->addRows($rows) @@ -67,9 +67,9 @@ class TableTest extends \PHPUnit_Framework_TestCase /** * @dataProvider testRenderProvider */ - public function testRenderAddRowsOneByOne($headers, $rows, $style, $expected) + public function testRenderAddRowsOneByOne($headers, $rows, $style, $expected, $decorated = false) { - $table = new Table($output = $this->getOutputStream()); + $table = new Table($output = $this->getOutputStream($decorated)); $table ->setHeaders($headers) ->setStyle($style) @@ -485,6 +485,35 @@ TABLE TABLE ), + 'Coslpan and table cells with comment style' => array( + array( + new TableCell('Long Title', array('colspan' => 3)), + ), + array( + array( + new TableCell('9971-5-0210-0', array('colspan' => 3)), + ), + new TableSeparator(), + array( + 'Dante Alighieri', + 'J. R. R. Tolkien', + 'J. R. R', + ), + ), + 'default', + <<stream, StreamOutput::VERBOSITY_NORMAL, false); + return new StreamOutput($this->stream, StreamOutput::VERBOSITY_NORMAL, $decorated); } protected function getOutputContent(StreamOutput $output) From 2bc4d3b2c17d53a1f8db6945109811373151250c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Sat, 28 Jan 2017 17:23:55 +0100 Subject: [PATCH 3/7] [TwigBundle] Fix the name of the cache warming test class --- .../Bundle/TwigBundle/Tests/Functional/CacheWarmingTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/TwigBundle/Tests/Functional/CacheWarmingTest.php b/src/Symfony/Bundle/TwigBundle/Tests/Functional/CacheWarmingTest.php index b51e619a9d..5c4126cfe7 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/Functional/CacheWarmingTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/Functional/CacheWarmingTest.php @@ -17,7 +17,7 @@ use Symfony\Component\Filesystem\Filesystem; use Symfony\Bundle\FrameworkBundle\FrameworkBundle; use Symfony\Bundle\TwigBundle\TwigBundle; -class NewCacheWamingTest extends \PHPUnit_Framework_TestCase +class CacheWarmingTest extends \PHPUnit_Framework_TestCase { public function testCacheIsProperlyWarmedWhenTemplatingIsAvailable() { From f19788dd2ec1581beefec8c5d25a75f0e8c083c5 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 30 Jan 2017 15:00:07 +0100 Subject: [PATCH 4/7] ignore invalid cookies expires date format --- src/Symfony/Component/BrowserKit/Cookie.php | 2 -- src/Symfony/Component/BrowserKit/Tests/CookieTest.php | 7 ++++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Component/BrowserKit/Cookie.php b/src/Symfony/Component/BrowserKit/Cookie.php index 7e855bf351..42f184d532 100644 --- a/src/Symfony/Component/BrowserKit/Cookie.php +++ b/src/Symfony/Component/BrowserKit/Cookie.php @@ -213,8 +213,6 @@ class Cookie if (false !== $date = date_create($dateValue, new \DateTimeZone('GMT'))) { return $date->format('U'); } - - throw new \InvalidArgumentException(sprintf('Could not parse date "%s".', $dateValue)); } /** diff --git a/src/Symfony/Component/BrowserKit/Tests/CookieTest.php b/src/Symfony/Component/BrowserKit/Tests/CookieTest.php index 5a724333d3..4722de6d7b 100644 --- a/src/Symfony/Component/BrowserKit/Tests/CookieTest.php +++ b/src/Symfony/Component/BrowserKit/Tests/CookieTest.php @@ -88,10 +88,11 @@ class CookieTest extends \PHPUnit_Framework_TestCase Cookie::fromString('foo'); } - public function testFromStringThrowsAnExceptionIfCookieDateIsNotValid() + public function testFromStringIgnoresInvalidExpiresDate() { - $this->setExpectedException('InvalidArgumentException'); - Cookie::fromString('foo=bar; expires=Flursday July 31st 2020, 08:49:37 GMT'); + $cookie = Cookie::fromString('foo=bar; expires=Flursday July 31st 2020, 08:49:37 GMT'); + + $this->assertFalse($cookie->isExpired()); } public function testFromStringThrowsAnExceptionIfUrlIsNotValid() From 5cd7931c24ad9ad0794440c106271a5bb8d4551b Mon Sep 17 00:00:00 2001 From: Josip Kruslin Date: Sun, 29 Jan 2017 12:09:34 +0100 Subject: [PATCH 5/7] [validator] Updated croatian translation --- .../Resources/translations/validators.hr.xlf | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.hr.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.hr.xlf index a11e825cca..8c62d899fd 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.hr.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.hr.xlf @@ -278,6 +278,42 @@ This value should not be identical to {{ compared_value_type }} {{ compared_value }}. Ova vrijednost ne bi trebala biti {{ compared_value_type }} {{ compared_value }}. + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Omjer slike je prevelik ({{ ratio }}). Dozvoljeni maksimalni omjer je {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Omjer slike je premali ({{ ratio }}). Minimalni očekivani omjer je {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Slika je kvadratnog oblika ({{ width }}x{{ height }}px). Kvadratne slike nisu dozvoljene. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Slika je orijentirana horizontalno ({{ width }}x{{ height }}px). Horizontalno orijentirane slike nisu dozvoljene. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Slika je orijentirana vertikalno ({{ width }}x{{ height }}px). Vertikalno orijentirane slike nisu dozvoljene. + + + An empty file is not allowed. + Prazna datoteka nije dozvoljena. + + + The host could not be resolved. + Poslužitelj nije mogao biti razriješen. + + + This value does not match the expected {{ charset }} charset. + Znakovne oznake vrijednosti ne odgovaraju očekivanom {{ charset }} skupu. + + + This is not a valid Business Identifier Code (BIC). + Ovo nije validan poslovni identifikacijski broj (BIC). + From 0425e0549bbea67714b48218b615516253db065c Mon Sep 17 00:00:00 2001 From: Guilhem N Date: Sat, 21 Jan 2017 21:06:56 +0100 Subject: [PATCH 6/7] [FrameworkBundle] Execute the PhpDocExtractor earlier --- .../Resources/config/property_info.xml | 2 +- .../Tests/Functional/PropertyInfoTest.php | 35 +++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/Functional/PropertyInfoTest.php diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/property_info.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/property_info.xml index 33a0a661f8..8f6a7c9e31 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/property_info.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/property_info.xml @@ -15,7 +15,7 @@ - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/PropertyInfoTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/PropertyInfoTest.php new file mode 100644 index 0000000000..899de60ca0 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/PropertyInfoTest.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\FrameworkBundle\Tests\Functional; + +use Symfony\Component\PropertyInfo\Type; + +class PropertyInfoTest extends WebTestCase +{ + public function testPhpDocPriority() + { + static::bootKernel(array('test_case' => 'Serializer')); + $container = static::$kernel->getContainer(); + + $this->assertEquals(array(new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_INT))), $container->get('property_info')->getTypes(Dummy::class, 'codes')); + } +} + +class Dummy +{ + /** + * @param int[] $codes + */ + public function setCodes(array $codes) + { + } +} From ee4b3e2712c5eeb456f9697b8c9e27309c3d8b18 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 31 Jan 2017 16:58:35 +0100 Subject: [PATCH 7/7] [Console] Fix too strict test --- .../Component/Console/Tests/Helper/ProcessHelperTest.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Console/Tests/Helper/ProcessHelperTest.php b/src/Symfony/Component/Console/Tests/Helper/ProcessHelperTest.php index 1dcddf8bad..b0d7f9c2f6 100644 --- a/src/Symfony/Component/Console/Tests/Helper/ProcessHelperTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/ProcessHelperTest.php @@ -16,6 +16,7 @@ use Symfony\Component\Console\Helper\HelperSet; use Symfony\Component\Console\Output\StreamOutput; use Symfony\Component\Console\Helper\ProcessHelper; use Symfony\Component\Process\Process; +use Symfony\Component\Process\ProcessBuilder; class ProcessHelperTest extends \PHPUnit_Framework_TestCase { @@ -83,9 +84,9 @@ EOT; EOT; $errorMessage = 'An error occurred'; - if ('\\' === DIRECTORY_SEPARATOR) { - $successOutputProcessDebug = str_replace("'", '"', $successOutputProcessDebug); - } + $args = new ProcessBuilder(array('php', '-r', 'echo 42;')); + $args = $args->getProcess()->getCommandLine(); + $successOutputProcessDebug = str_replace("'php' '-r' 'echo 42;'", $args, $successOutputProcessDebug); return array( array('', 'php -r "echo 42;"', StreamOutput::VERBOSITY_VERBOSE, null),