From e461d36ec45e449ea52eb91ce9e3814c76a92cf0 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sun, 28 Apr 2019 11:46:42 +0200 Subject: [PATCH 1/8] [FramworkBundle] mark any env vars found in the ide setting as used --- .../FrameworkBundle/DependencyInjection/FrameworkExtension.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index ee5dc86df2..4e792ded2e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -212,6 +212,8 @@ class FrameworkExtension extends Extension 'phpstorm' => 'phpstorm://open?file=%%f&line=%%l', ]; $ide = $config['ide']; + // mark any env vars found in the ide setting as used + $container->resolveEnvPlaceholders($ide); $container->setParameter('templating.helper.code.file_link_format', str_replace('%', '%%', ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format')) ?: (isset($links[$ide]) ? $links[$ide] : $ide)); } From d4337fc8a281572b15729ac4702c1ddb8a3497ae Mon Sep 17 00:00:00 2001 From: MrNicodemuz Date: Mon, 29 Apr 2019 10:05:10 +0800 Subject: [PATCH 2/8] Fix Thai translation in validators.th.xlf MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The translated message is wrongly prefixed with a "T" character. The correct translation should read as "ค่านี้ถูกใช้งานไปแล้ว". --- .../Validator/Resources/translations/validators.th.xlf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.th.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.th.xlf index d5b57031b9..63ce95ab1b 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.th.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.th.xlf @@ -152,7 +152,7 @@ This value is already used. - Tค่านี้ถูกใช้งานไปแล้ว + ค่านี้ถูกใช้งานไปแล้ว The size of the image could not be detected. From e6e98363b0bdc4754897476774f10c9351920edf Mon Sep 17 00:00:00 2001 From: "Issei.M" Date: Mon, 29 Apr 2019 17:17:01 +0900 Subject: [PATCH 3/8] [Validator] Translate messages into Japanese --- .../Resources/translations/validators.ja.xlf | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.ja.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.ja.xlf index 207d4ba7ae..5a391a2e66 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.ja.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.ja.xlf @@ -330,6 +330,38 @@ This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. このSWIFTコードはIBANコード({{ iban }})に関連付けられていません。 + + This value should be valid JSON. + JSONでなければなりません。 + + + This collection should contain only unique elements. + 要素は重複してはなりません。 + + + This value should be positive. + 正の数でなければなりません。 + + + This value should be either positive or zero. + 正の数、または0でなければなりません。 + + + This value should be negative. + 負の数でなければなりません。 + + + This value should be either negative or zero. + 負の数、または0でなければなりません。 + + + This value is not a valid timezone. + 有効なタイムゾーンではありません。 + + + This password has been leaked in a data breach, it must not be used. Please use another password. + このパスワードは漏洩している為使用できません。 + From 0945f27e81ace7753ca66953eabebef4363a5985 Mon Sep 17 00:00:00 2001 From: Ruud Kamphuis Date: Sun, 28 Apr 2019 12:45:56 +0200 Subject: [PATCH 4/8] Made `debug:container` and `debug:autowiring` ignore starting backslash in service id --- .../Bundle/FrameworkBundle/Command/ContainerDebugCommand.php | 2 ++ .../Tests/Functional/ContainerDebugCommandTest.php | 1 + 2 files changed, 3 insertions(+) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php index 9b5193d63b..9debddcad7 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php @@ -220,6 +220,8 @@ EOF private function findProperServiceName(InputInterface $input, SymfonyStyle $io, ContainerBuilder $builder, string $name, bool $showHidden) { + $name = ltrim($name, '\\'); + if ($builder->has($name) || !$input->isInteractive()) { return $name; } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ContainerDebugCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ContainerDebugCommandTest.php index ee13386a4b..61ffa68aed 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ContainerDebugCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ContainerDebugCommandTest.php @@ -85,6 +85,7 @@ class ContainerDebugCommandTest extends WebTestCase return [ [BackslashClass::class], ['FixturesBackslashClass'], + ['\\'.BackslashClass::class], ]; } } From 648832823f6d0c993357f5a3b52636a5b3f4b499 Mon Sep 17 00:00:00 2001 From: Ondrej Exner Date: Tue, 30 Apr 2019 09:27:22 +0200 Subject: [PATCH 5/8] fix ConsoleFormatter - call to a member function format() on string --- .../Monolog/Formatter/ConsoleFormatter.php | 4 +- .../Tests/Formatter/ConsoleFormatterTest.php | 66 +++++++++++++++++++ 2 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 src/Symfony/Bridge/Monolog/Tests/Formatter/ConsoleFormatterTest.php diff --git a/src/Symfony/Bridge/Monolog/Formatter/ConsoleFormatter.php b/src/Symfony/Bridge/Monolog/Formatter/ConsoleFormatter.php index 14f44069eb..0cf1e8bd29 100644 --- a/src/Symfony/Bridge/Monolog/Formatter/ConsoleFormatter.php +++ b/src/Symfony/Bridge/Monolog/Formatter/ConsoleFormatter.php @@ -133,7 +133,9 @@ class ConsoleFormatter implements FormatterInterface } $formatted = strtr($this->options['format'], [ - '%datetime%' => $record['datetime']->format($this->options['date_format']), + '%datetime%' => $record['datetime'] instanceof \DateTimeInterface + ? $record['datetime']->format($this->options['date_format']) + : $record['datetime'], '%start_tag%' => sprintf('<%s>', $levelColor), '%level_name%' => sprintf('%-9s', $record['level_name']), '%end_tag%' => '', diff --git a/src/Symfony/Bridge/Monolog/Tests/Formatter/ConsoleFormatterTest.php b/src/Symfony/Bridge/Monolog/Tests/Formatter/ConsoleFormatterTest.php new file mode 100644 index 0000000000..c09597e916 --- /dev/null +++ b/src/Symfony/Bridge/Monolog/Tests/Formatter/ConsoleFormatterTest.php @@ -0,0 +1,66 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Monolog\Tests\Formatter; + +use Monolog\Logger; +use PHPUnit\Framework\TestCase; +use Symfony\Bridge\Monolog\Formatter\ConsoleFormatter; + +class ConsoleFormatterTest extends TestCase +{ + /** + * @dataProvider providerFormatTests + */ + public function testFormat(array $record, $expectedMessage) + { + $formatter = new ConsoleFormatter(); + self::assertSame($expectedMessage, $formatter->format($record)); + } + + /** + * @return array + */ + public function providerFormatTests() + { + $currentDateTime = new \DateTime(); + + return [ + 'record with DateTime object in datetime field' => [ + 'record' => [ + 'message' => 'test', + 'context' => [], + 'level' => Logger::WARNING, + 'level_name' => Logger::getLevelName(Logger::WARNING), + 'channel' => 'test', + 'datetime' => $currentDateTime, + 'extra' => [], + ], + 'expectedMessage' => sprintf( + "%s WARNING [test] test\n", + $currentDateTime->format(ConsoleFormatter::SIMPLE_DATE) + ), + ], + 'record with string in datetime field' => [ + 'record' => [ + 'message' => 'test', + 'context' => [], + 'level' => Logger::WARNING, + 'level_name' => Logger::getLevelName(Logger::WARNING), + 'channel' => 'test', + 'datetime' => '2019-01-01T00:42:00+00:00', + 'extra' => [], + ], + 'expectedMessage' => "2019-01-01T00:42:00+00:00 WARNING [test] test\n", + ], + ]; + } +} From 730df0860c85d186a19aafb02c7791c644ab94cd Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 30 Apr 2019 14:16:44 +0200 Subject: [PATCH 6/8] relax assertions in tests --- .../Twig/Tests/Extension/AbstractBootstrap3LayoutTest.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/AbstractBootstrap3LayoutTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/AbstractBootstrap3LayoutTest.php index e50076da73..183cd820c3 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/AbstractBootstrap3LayoutTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Extension/AbstractBootstrap3LayoutTest.php @@ -2376,11 +2376,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest [@name="name"] [@class="my&class form-control"] [not(@required)] - [./optgroup - [@label="Europe"] - [./option[@value="Europe/Vienna"][@selected="selected"][.="Vienna"]] - ] - [count(./optgroup)>10] + [.//option[@value="Europe/Vienna"][@selected="selected"]] [count(.//option)>200] ' ); @@ -2397,7 +2393,6 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest '/select [@class="my&class form-control"] [./option[@value=""][not(@selected)][not(@disabled)][.="[trans]Select&Timezone[/trans]"]] - [count(./optgroup)>10] [count(.//option)>201] ' ); From 312a456e044b41eb22cbb49a1733609a33c97b98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Tue, 30 Apr 2019 16:24:14 +0200 Subject: [PATCH 7/8] [Workflow] Fixed dumping when many transition with same name exist --- .../Workflow/Dumper/GraphvizDumper.php | 25 +++-- .../Tests/Dumper/GraphvizDumperTest.php | 104 +++++++++--------- 2 files changed, 68 insertions(+), 61 deletions(-) diff --git a/src/Symfony/Component/Workflow/Dumper/GraphvizDumper.php b/src/Symfony/Component/Workflow/Dumper/GraphvizDumper.php index 88a6888ad9..6f98350aa3 100644 --- a/src/Symfony/Component/Workflow/Dumper/GraphvizDumper.php +++ b/src/Symfony/Component/Workflow/Dumper/GraphvizDumper.php @@ -120,8 +120,8 @@ class GraphvizDumper implements DumperInterface { $code = ''; - foreach ($transitions as $place) { - $code .= sprintf(" transition_%s [label=\"%s\", shape=box%s];\n", $this->dotize($place['name']), $place['name'], $this->addAttributes($place['attributes'])); + foreach ($transitions as $i => $place) { + $code .= sprintf(" transition_%d [label=\"%s\", shape=box%s];\n", $this->dotize($i), $place['name'], $this->addAttributes($place['attributes'])); } return $code; @@ -134,12 +134,13 @@ class GraphvizDumper implements DumperInterface { $dotEdges = []; - foreach ($definition->getTransitions() as $transition) { + foreach ($definition->getTransitions() as $i => $transition) { foreach ($transition->getFroms() as $from) { $dotEdges[] = [ 'from' => $from, 'to' => $transition->getName(), 'direction' => 'from', + 'transition_number' => $i, ]; } foreach ($transition->getTos() as $to) { @@ -147,6 +148,7 @@ class GraphvizDumper implements DumperInterface 'from' => $transition->getName(), 'to' => $to, 'direction' => 'to', + 'transition_number' => $i, ]; } } @@ -162,12 +164,17 @@ class GraphvizDumper implements DumperInterface $code = ''; foreach ($edges as $edge) { - $code .= sprintf(" %s_%s -> %s_%s [style=\"solid\"];\n", - 'from' === $edge['direction'] ? 'place' : 'transition', - $this->dotize($edge['from']), - 'from' === $edge['direction'] ? 'transition' : 'place', - $this->dotize($edge['to']) - ); + if ('from' === $edge['direction']) { + $code .= sprintf(" place_%s -> transition_%d [style=\"solid\"];\n", + $this->dotize($edge['from']), + $this->dotize($edge['transition_number']) + ); + } else { + $code .= sprintf(" transition_%d -> place_%s [style=\"solid\"];\n", + $this->dotize($edge['transition_number']), + $this->dotize($edge['to']) + ); + } } return $code; diff --git a/src/Symfony/Component/Workflow/Tests/Dumper/GraphvizDumperTest.php b/src/Symfony/Component/Workflow/Tests/Dumper/GraphvizDumperTest.php index a5d9087ff5..116f800077 100644 --- a/src/Symfony/Component/Workflow/Tests/Dumper/GraphvizDumperTest.php +++ b/src/Symfony/Component/Workflow/Tests/Dumper/GraphvizDumperTest.php @@ -73,26 +73,26 @@ class GraphvizDumperTest extends TestCase place_e [label="e", shape=circle]; place_f [label="f", shape=circle]; place_g [label="g", shape=circle]; - transition_t1 [label="t1", shape=box, shape="box", regular="1"]; - transition_t2 [label="t2", shape=box, shape="box", regular="1"]; - transition_t3 [label="t3", shape=box, shape="box", regular="1"]; - transition_t4 [label="t4", shape=box, shape="box", regular="1"]; - transition_t5 [label="t5", shape=box, shape="box", regular="1"]; - transition_t6 [label="t6", shape=box, shape="box", regular="1"]; - place_a -> transition_t1 [style="solid"]; - transition_t1 -> place_b [style="solid"]; - transition_t1 -> place_c [style="solid"]; - place_b -> transition_t2 [style="solid"]; - place_c -> transition_t2 [style="solid"]; - transition_t2 -> place_d [style="solid"]; - place_d -> transition_t3 [style="solid"]; - transition_t3 -> place_e [style="solid"]; - place_d -> transition_t4 [style="solid"]; - transition_t4 -> place_f [style="solid"]; - place_e -> transition_t5 [style="solid"]; - transition_t5 -> place_g [style="solid"]; - place_f -> transition_t6 [style="solid"]; - transition_t6 -> place_g [style="solid"]; + transition_0 [label="t1", shape=box, shape="box", regular="1"]; + transition_1 [label="t2", shape=box, shape="box", regular="1"]; + transition_2 [label="t3", shape=box, shape="box", regular="1"]; + transition_3 [label="t4", shape=box, shape="box", regular="1"]; + transition_4 [label="t5", shape=box, shape="box", regular="1"]; + transition_5 [label="t6", shape=box, shape="box", regular="1"]; + place_a -> transition_0 [style="solid"]; + transition_0 -> place_b [style="solid"]; + transition_0 -> place_c [style="solid"]; + place_b -> transition_1 [style="solid"]; + place_c -> transition_1 [style="solid"]; + transition_1 -> place_d [style="solid"]; + place_d -> transition_2 [style="solid"]; + transition_2 -> place_e [style="solid"]; + place_d -> transition_3 [style="solid"]; + transition_3 -> place_f [style="solid"]; + place_e -> transition_4 [style="solid"]; + transition_4 -> place_g [style="solid"]; + place_f -> transition_5 [style="solid"]; + transition_5 -> place_g [style="solid"]; } '; } @@ -107,12 +107,12 @@ class GraphvizDumperTest extends TestCase place_a [label="a", shape=circle, style="filled"]; place_b [label="b", shape=circle]; place_c [label="c", shape=circle, color="#FF0000", shape="doublecircle"]; - transition_t1 [label="t1", shape=box, shape="box", regular="1"]; - transition_t2 [label="t2", shape=box, shape="box", regular="1"]; - place_a -> transition_t1 [style="solid"]; - transition_t1 -> place_b [style="solid"]; - place_b -> transition_t2 [style="solid"]; - transition_t2 -> place_c [style="solid"]; + transition_0 [label="t1", shape=box, shape="box", regular="1"]; + transition_1 [label="t2", shape=box, shape="box", regular="1"]; + place_a -> transition_0 [style="solid"]; + transition_0 -> place_b [style="solid"]; + place_b -> transition_1 [style="solid"]; + transition_1 -> place_c [style="solid"]; } '; } @@ -131,26 +131,26 @@ class GraphvizDumperTest extends TestCase place_e [label="e", shape=circle]; place_f [label="f", shape=circle]; place_g [label="g", shape=circle]; - transition_t1 [label="t1", shape=box, shape="box", regular="1"]; - transition_t2 [label="t2", shape=box, shape="box", regular="1"]; - transition_t3 [label="t3", shape=box, shape="box", regular="1"]; - transition_t4 [label="t4", shape=box, shape="box", regular="1"]; - transition_t5 [label="t5", shape=box, shape="box", regular="1"]; - transition_t6 [label="t6", shape=box, shape="box", regular="1"]; - place_a -> transition_t1 [style="solid"]; - transition_t1 -> place_b [style="solid"]; - transition_t1 -> place_c [style="solid"]; - place_b -> transition_t2 [style="solid"]; - place_c -> transition_t2 [style="solid"]; - transition_t2 -> place_d [style="solid"]; - place_d -> transition_t3 [style="solid"]; - transition_t3 -> place_e [style="solid"]; - place_d -> transition_t4 [style="solid"]; - transition_t4 -> place_f [style="solid"]; - place_e -> transition_t5 [style="solid"]; - transition_t5 -> place_g [style="solid"]; - place_f -> transition_t6 [style="solid"]; - transition_t6 -> place_g [style="solid"]; + transition_0 [label="t1", shape=box, shape="box", regular="1"]; + transition_1 [label="t2", shape=box, shape="box", regular="1"]; + transition_2 [label="t3", shape=box, shape="box", regular="1"]; + transition_3 [label="t4", shape=box, shape="box", regular="1"]; + transition_4 [label="t5", shape=box, shape="box", regular="1"]; + transition_5 [label="t6", shape=box, shape="box", regular="1"]; + place_a -> transition_0 [style="solid"]; + transition_0 -> place_b [style="solid"]; + transition_0 -> place_c [style="solid"]; + place_b -> transition_1 [style="solid"]; + place_c -> transition_1 [style="solid"]; + transition_1 -> place_d [style="solid"]; + place_d -> transition_2 [style="solid"]; + transition_2 -> place_e [style="solid"]; + place_d -> transition_3 [style="solid"]; + transition_3 -> place_f [style="solid"]; + place_e -> transition_4 [style="solid"]; + transition_4 -> place_g [style="solid"]; + place_f -> transition_5 [style="solid"]; + transition_5 -> place_g [style="solid"]; } '; } @@ -165,12 +165,12 @@ class GraphvizDumperTest extends TestCase place_a [label="a", shape=circle, style="filled"]; place_b [label="b", shape=circle]; place_c [label="c", shape=circle]; - transition_t1 [label="t1", shape=box, shape="box", regular="1"]; - transition_t2 [label="t2", shape=box, shape="box", regular="1"]; - place_a -> transition_t1 [style="solid"]; - transition_t1 -> place_b [style="solid"]; - place_b -> transition_t2 [style="solid"]; - transition_t2 -> place_c [style="solid"]; + transition_0 [label="t1", shape=box, shape="box", regular="1"]; + transition_1 [label="t2", shape=box, shape="box", regular="1"]; + place_a -> transition_0 [style="solid"]; + transition_0 -> place_b [style="solid"]; + place_b -> transition_1 [style="solid"]; + transition_1 -> place_c [style="solid"]; } '; } From 417733191511d32c5169ac90a1e4da964667809c Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 1 May 2019 10:04:33 +0200 Subject: [PATCH 8/8] Revert "bug #30620 [FrameworkBundle][HttpFoundation] make session service resettable (dmaicher)" This reverts commit 029fb2e7e36b7cdf29e27d4bfa54dd11adc5d457, reversing changes made to 9dad29d61c5605b589493efe34012fdb1218b92b. --- .../FrameworkBundle/Resources/config/session.xml | 1 - src/Symfony/Bundle/FrameworkBundle/composer.json | 2 +- .../Component/HttpFoundation/Session/Session.php | 4 +--- .../HttpFoundation/Tests/Session/SessionTest.php | 10 ---------- 4 files changed, 2 insertions(+), 15 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/session.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/session.xml index c87f688c78..8b68d9e846 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/session.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/session.xml @@ -15,7 +15,6 @@ - diff --git a/src/Symfony/Bundle/FrameworkBundle/composer.json b/src/Symfony/Bundle/FrameworkBundle/composer.json index e5449ff32e..78d7ae1e56 100644 --- a/src/Symfony/Bundle/FrameworkBundle/composer.json +++ b/src/Symfony/Bundle/FrameworkBundle/composer.json @@ -23,7 +23,7 @@ "symfony/dependency-injection": "^3.4.24|^4.2.5", "symfony/config": "~3.4|~4.0", "symfony/event-dispatcher": "~3.4|~4.0", - "symfony/http-foundation": "^3.4.24|^4.2.5", + "symfony/http-foundation": "^3.3.11|~4.0", "symfony/http-kernel": "~3.4|~4.0", "symfony/polyfill-mbstring": "~1.0", "symfony/filesystem": "~2.8|~3.0|~4.0", diff --git a/src/Symfony/Component/HttpFoundation/Session/Session.php b/src/Symfony/Component/HttpFoundation/Session/Session.php index 62ce948b68..867ceba97f 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Session.php +++ b/src/Symfony/Component/HttpFoundation/Session/Session.php @@ -193,9 +193,7 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable */ public function save() { - if ($this->isStarted()) { - $this->storage->save(); - } + $this->storage->save(); } /** diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php index e75b3321b0..afa00fc7c3 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php @@ -260,14 +260,4 @@ class SessionTest extends TestCase $flash->get('hello'); $this->assertTrue($this->session->isEmpty()); } - - public function testSaveIfNotStarted() - { - $storage = $this->getMockBuilder('Symfony\Component\HttpFoundation\Session\Storage\SessionStorageInterface')->getMock(); - $session = new Session($storage); - - $storage->expects($this->once())->method('isStarted')->willReturn(false); - $storage->expects($this->never())->method('save'); - $session->save(); - } }