Skip to content

Commit 76cf0ca

Browse 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

File tree

20 files changed

+208
-145
lines changed

20 files changed

+208
-145
lines changed

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

Lines 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

Lines 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

Lines 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

Lines 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

Lines 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

Lines 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

Lines 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

Lines 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

Lines 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

Lines 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']);

0 commit comments

Comments
 (0)