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 76cf0ca

Browse filesBrowse files
Merge branch '3.4' into 4.1
* 3.4: Fix CS Allow reuse of Session between requests [MonologBridge] Re-add option option to ignore empty context and extra data [Lock] remove useless code [PhpUnitBridge] fix disabling DeprecationErrorHandler using phpunit.xml file Provide debug_backtrace with proper args [DI] fix infinite loop involving self-references in decorated services forward false label option to nested types forward the invalid_message option in date types
2 parents da1175c + 0218507 commit 76cf0ca
Copy full SHA for 76cf0ca

File tree

Expand file treeCollapse file tree

20 files changed

+208
-145
lines changed
Filter options
Expand file treeCollapse file tree

20 files changed

+208
-145
lines changed

‎src/Symfony/Bridge/Monolog/Formatter/ConsoleFormatter.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Monolog/Formatter/ConsoleFormatter.php
+8-11Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public function __construct(array $options = array())
6161
'colors' => true,
6262
'multiline' => false,
6363
'level_name_format' => '%-9s',
64+
'ignore_empty_context_and_extra' => true,
6465
), $options);
6566

6667
if (class_exists(VarCloner::class)) {
@@ -101,20 +102,16 @@ public function format(array $record)
101102

102103
$levelColor = self::$levelColorMap[$record['level']];
103104

104-
if ($this->options['multiline']) {
105-
$separator = "\n";
105+
if (!$this->options['ignore_empty_context_and_extra'] || !empty($record['context'])) {
106+
$context = ($this->options['multiline'] ? "\n" : ' ').$this->dumpData($record['context']);
106107
} else {
107-
$separator = ' ';
108-
}
109-
110-
$context = $this->dumpData($record['context']);
111-
if ($context) {
112-
$context = $separator.$context;
108+
$context = '';
113109
}
114110

115-
$extra = $this->dumpData($record['extra']);
116-
if ($extra) {
117-
$extra = $separator.$extra;
111+
if (!$this->options['ignore_empty_context_and_extra'] || !empty($record['extra'])) {
112+
$extra = ($this->options['multiline'] ? "\n" : ' ').$this->dumpData($record['extra']);
113+
} else {
114+
$extra = '';
118115
}
119116

120117
$formatted = strtr($this->options['format'], array(

‎src/Symfony/Bridge/Monolog/Tests/Handler/ConsoleHandlerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Monolog/Tests/Handler/ConsoleHandlerTest.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ public function testVerbosityMapping($verbosity, $level, $isHandling, array $map
6464
$realOutput = $this->getMockBuilder('Symfony\Component\Console\Output\Output')->setMethods(array('doWrite'))->getMock();
6565
$realOutput->setVerbosity($verbosity);
6666
if ($realOutput->isDebug()) {
67-
$log = "16:21:54 $levelName [app] My info message\n[]\n[]\n";
67+
$log = "16:21:54 $levelName [app] My info message\n";
6868
} else {
69-
$log = "16:21:54 $levelName [app] My info message [] []\n";
69+
$log = "16:21:54 $levelName [app] My info message\n";
7070
}
7171
$realOutput
7272
->expects($isHandling ? $this->once() : $this->never())
@@ -149,7 +149,7 @@ public function testWritingAndFormatting()
149149
$output
150150
->expects($this->once())
151151
->method('write')
152-
->with("16:21:54 <fg=green>INFO </> <comment>[app]</> My info message\n[]\n[]\n")
152+
->with("16:21:54 <fg=green>INFO </> <comment>[app]</> My info message\n")
153153
;
154154

155155
$handler = new ConsoleHandler(null, false);

‎src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php
+6-2Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,11 @@ public static function register($mode = 0)
5454
if (false === $mode) {
5555
$mode = getenv('SYMFONY_DEPRECATIONS_HELPER');
5656
}
57-
if (DeprecationErrorHandler::MODE_WEAK !== $mode && DeprecationErrorHandler::MODE_WEAK_VENDORS !== $mode && (!isset($mode[0]) || '/' !== $mode[0])) {
57+
if (DeprecationErrorHandler::MODE_DISABLED !== $mode
58+
&& DeprecationErrorHandler::MODE_WEAK !== $mode
59+
&& DeprecationErrorHandler::MODE_WEAK_VENDORS !== $mode
60+
&& (!isset($mode[0]) || '/' !== $mode[0])
61+
) {
5862
$mode = preg_match('/^[1-9][0-9]*$/', $mode) ? (int) $mode : 0;
5963
}
6064

@@ -108,7 +112,7 @@ public static function register($mode = 0)
108112
return $ErrorHandler::handleError($type, $msg, $file, $line, $context);
109113
}
110114

111-
$trace = debug_backtrace(true);
115+
$trace = debug_backtrace();
112116
$group = 'other';
113117
$isVendor = DeprecationErrorHandler::MODE_WEAK_VENDORS === $mode && $inVendors($file);
114118

‎src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ public function testFirewalls()
159159
null,
160160
null,
161161
array(
162-
'simple_form',
163-
'anonymous',
162+
'simple_form',
163+
'anonymous',
164164
),
165165
null,
166166
),

‎src/Symfony/Component/Debug/Tests/FatalErrorHandler/UndefinedMethodFatalErrorHandlerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Debug/Tests/FatalErrorHandler/UndefinedMethodFatalErrorHandlerTest.php
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ public function provideUndefinedMethodData()
6464
),
6565
array(
6666
array(
67-
'type' => 1,
68-
'message' => 'Call to undefined method class@anonymous::test()',
69-
'file' => '/home/possum/work/symfony/test.php',
70-
'line' => 11,
67+
'type' => 1,
68+
'message' => 'Call to undefined method class@anonymous::test()',
69+
'file' => '/home/possum/work/symfony/test.php',
70+
'line' => 11,
7171
),
7272
'Attempted to call an undefined method named "test" of class "class@anonymous".',
7373
),

‎src/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ protected function processValue($value, $isRoot = false)
113113
return $value;
114114
}
115115
$this->currentDefinition = $value;
116+
} elseif ($this->currentDefinition === $value) {
117+
return $value;
116118
}
117119
$this->lazy = false;
118120

‎src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php
+16Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1476,6 +1476,22 @@ public function testErroredDefinition()
14761476

14771477
$container->get('errored_definition');
14781478
}
1479+
1480+
public function testDecoratedSelfReferenceInvolvingPrivateServices()
1481+
{
1482+
$container = new ContainerBuilder();
1483+
$container->register('foo', 'stdClass')
1484+
->setPublic(false)
1485+
->setProperty('bar', new Reference('foo'));
1486+
$container->register('baz', 'stdClass')
1487+
->setPublic(false)
1488+
->setProperty('inner', new Reference('baz.inner'))
1489+
->setDecoratedService('foo');
1490+
1491+
$container->compile();
1492+
1493+
$this->assertSame(array('service_container'), array_keys($container->getDefinitions()));
1494+
}
14791495
}
14801496

14811497
class FooClass

‎src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,8 +392,8 @@ public function testResolvedBase64EnvParameters()
392392
$container->compile(true);
393393

394394
$expected = array(
395-
'env(foo)' => 'd29ybGQ=',
396-
'hello' => 'world',
395+
'env(foo)' => 'd29ybGQ=',
396+
'hello' => 'world',
397397
);
398398
$this->assertSame($expected, $container->getParameterBag()->all());
399399
}

‎src/Symfony/Component/DomCrawler/Tests/FormTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DomCrawler/Tests/FormTest.php
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -948,12 +948,12 @@ public function testgetPhpValuesWithEmptyTextarea()
948948
{
949949
$dom = new \DOMDocument();
950950
$dom->loadHTML('
951-
<html>
952-
<form>
953-
<textarea name="example"></textarea>
954-
</form>
955-
</html>
956-
');
951+
<html>
952+
<form>
953+
<textarea name="example"></textarea>
954+
</form>
955+
</html>'
956+
);
957957

958958
$nodes = $dom->getElementsByTagName('form');
959959
$form = new Form($nodes->item(0), 'http://example.com');

‎src/Symfony/Component/Finder/Tests/Iterator/MockSplFileInfo.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Finder/Tests/Iterator/MockSplFileInfo.php
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ public function __construct($param)
2929
parent::__construct($param);
3030
} elseif (\is_array($param)) {
3131
$defaults = array(
32-
'name' => 'file.txt',
33-
'contents' => null,
34-
'mode' => null,
35-
'type' => null,
36-
'relativePath' => null,
37-
'relativePathname' => null,
32+
'name' => 'file.txt',
33+
'contents' => null,
34+
'mode' => null,
35+
'type' => null,
36+
'relativePath' => null,
37+
'relativePathname' => null,
3838
);
3939
$defaults = array_merge($defaults, $param);
4040
parent::__construct($defaults['name']);

‎src/Symfony/Component/Form/Extension/Core/Type/DateType.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Core/Type/DateType.php
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,18 @@ public function buildForm(FormBuilderInterface $builder, array $options)
7878
'error_bubbling' => true,
7979
);
8080

81+
if (isset($options['invalid_message'])) {
82+
$dayOptions['invalid_message'] = $options['invalid_message'];
83+
$monthOptions['invalid_message'] = $options['invalid_message'];
84+
$yearOptions['invalid_message'] = $options['invalid_message'];
85+
}
86+
87+
if (isset($options['invalid_message_parameters'])) {
88+
$dayOptions['invalid_message_parameters'] = $options['invalid_message_parameters'];
89+
$monthOptions['invalid_message_parameters'] = $options['invalid_message_parameters'];
90+
$yearOptions['invalid_message_parameters'] = $options['invalid_message_parameters'];
91+
}
92+
8193
$formatter = new \IntlDateFormatter(
8294
\Locale::getDefault(),
8395
$dateFormat,

‎src/Symfony/Component/Form/Extension/Core/Type/TimeType.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Core/Type/TimeType.php
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,18 @@ public function buildForm(FormBuilderInterface $builder, array $options)
7373
'error_bubbling' => true,
7474
);
7575

76+
if (isset($options['invalid_message'])) {
77+
$hourOptions['invalid_message'] = $options['invalid_message'];
78+
$minuteOptions['invalid_message'] = $options['invalid_message'];
79+
$secondOptions['invalid_message'] = $options['invalid_message'];
80+
}
81+
82+
if (isset($options['invalid_message_parameters'])) {
83+
$hourOptions['invalid_message_parameters'] = $options['invalid_message_parameters'];
84+
$minuteOptions['invalid_message_parameters'] = $options['invalid_message_parameters'];
85+
$secondOptions['invalid_message_parameters'] = $options['invalid_message_parameters'];
86+
}
87+
7688
if ('choice' === $options['widget']) {
7789
$hours = $minutes = array();
7890

‎src/Symfony/Component/HttpFoundation/Session/Session.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Session/Session.php
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,9 @@ public function getId()
209209
*/
210210
public function setId($id)
211211
{
212-
$this->storage->setId($id);
212+
if ($this->storage->getId() !== $id) {
213+
$this->storage->setId($id);
214+
}
213215
}
214216

215217
/**

‎src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php
+21Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,27 @@ public function testSetId()
7070
$this->assertEquals('0123456789abcdef', $this->session->getId());
7171
}
7272

73+
public function testSetIdAfterStart()
74+
{
75+
$this->session->start();
76+
$id = $this->session->getId();
77+
78+
$e = null;
79+
try {
80+
$this->session->setId($id);
81+
} catch (\Exception $e) {
82+
}
83+
84+
$this->assertNull($e);
85+
86+
try {
87+
$this->session->setId('different');
88+
} catch (\Exception $e) {
89+
}
90+
91+
$this->assertInstanceOf('\LogicException', $e);
92+
}
93+
7394
public function testSetName()
7495
{
7596
$this->assertEquals('MOCKSESSID', $this->session->getName());

‎src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockArraySessionStorageTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockArraySessionStorageTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ protected function setUp()
4848
$this->data = array(
4949
$this->attributes->getStorageKey() => array('foo' => 'bar'),
5050
$this->flashes->getStorageKey() => array('notice' => 'hello'),
51-
);
51+
);
5252

5353
$this->storage = new MockArraySessionStorage();
5454
$this->storage->registerBag($this->flashes);

‎src/Symfony/Component/Lock/Store/CombinedStore.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Lock/Store/CombinedStore.php
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,6 @@ public function delete(Key $key)
151151
$store->delete($key);
152152
} catch (\Exception $e) {
153153
$this->logger->notice('One store failed to delete the "{resource}" lock.', array('resource' => $key, 'store' => $store, 'exception' => $e));
154-
} catch (\Throwable $e) {
155-
$this->logger->notice('One store failed to delete the "{resource}" lock.', array('resource' => $key, 'store' => $store, 'exception' => $e));
156154
}
157155
}
158156
}

‎src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ public function testContext()
189189
public function testEncodeScalarRootAttributes()
190190
{
191191
$array = array(
192-
'#' => 'Paul',
193-
'@gender' => 'm',
192+
'#' => 'Paul',
193+
'@gender' => 'm',
194194
);
195195

196196
$expected = '<?xml version="1.0"?>'."\n".
@@ -202,8 +202,8 @@ public function testEncodeScalarRootAttributes()
202202
public function testEncodeRootAttributes()
203203
{
204204
$array = array(
205-
'firstname' => 'Paul',
206-
'@gender' => 'm',
205+
'firstname' => 'Paul',
206+
'@gender' => 'm',
207207
);
208208

209209
$expected = '<?xml version="1.0"?>'."\n".
@@ -215,7 +215,7 @@ public function testEncodeRootAttributes()
215215
public function testEncodeCdataWrapping()
216216
{
217217
$array = array(
218-
'firstname' => 'Paul <or Me>',
218+
'firstname' => 'Paul <or Me>',
219219
);
220220

221221
$expected = '<?xml version="1.0"?>'."\n".

‎src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ public function testNormalizeWithParentClass()
7575
$group->setKevin('Kevin');
7676
$group->setCoopTilleuls('coop');
7777
$this->assertEquals(
78-
array('foo' => 'foo', 'bar' => 'bar', 'kevin' => 'Kevin',
79-
'coopTilleuls' => 'coop', 'fooBar' => null, 'symfony' => null, 'baz' => 'baz', ),
78+
array('foo' => 'foo', 'bar' => 'bar', 'kevin' => 'Kevin', 'coopTilleuls' => 'coop', 'fooBar' => null, 'symfony' => null, 'baz' => 'baz'),
8079
$this->normalizer->normalize($group, 'any')
8180
);
8281
}

0 commit comments

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