Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 922a534

Browse files
Merge branch '2.7' into 2.8
* 2.7: Mark deprecated Twig functions as deprecated with the Twig feature [appveyor] PHP 5.3.11 for Symfony 2.7 [HttpKernel] Group deprecation notices Conflicts: appveyor.yml
2 parents d4441e9 + 33fac14 commit 922a534

File tree

12 files changed

+69
-18
lines changed

12 files changed

+69
-18
lines changed

appveyor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ init:
2222
install:
2323
- IF EXIST c:\php (SET PHP=0) ELSE (mkdir c:\php)
2424
- cd c:\php
25-
- IF %PHP%==1 appveyor DownloadFile http://windows.php.net/downloads/releases/archives/php-5.3.9-nts-Win32-VC9-x86.zip
26-
- IF %PHP%==1 7z x php-5.3.9-nts-Win32-VC9-x86.zip -y > 7z.log
25+
- IF %PHP%==1 appveyor DownloadFile http://windows.php.net/downloads/releases/archives/php-5.3.11-nts-Win32-VC9-x86.zip
26+
- IF %PHP%==1 7z x php-5.3.11-nts-Win32-VC9-x86.zip -y > 7z.log
2727
- IF %PHP%==1 appveyor DownloadFile http://nebm.ist.utl.pt/~glopes/misc/intl_win/ICU-51.2-dlls.zip
2828
- IF %PHP%==1 7z x ICU-51.2-dlls.zip -y > 7z.log
2929
- IF %PHP%==1 cd ext

src/Symfony/Bridge/Twig/AppVariable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
use Symfony\Component\HttpFoundation\Request;
1515
use Symfony\Component\HttpFoundation\RequestStack;
1616
use Symfony\Component\HttpFoundation\Session\Session;
17-
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
1817
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
18+
use Symfony\Component\Security\Core\SecurityContext;
1919
use Symfony\Component\DependencyInjection\ContainerInterface;
2020

2121
/**

src/Symfony/Bridge/Twig/Extension/AssetExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function getFunctions()
4242
return array(
4343
new \Twig_SimpleFunction('asset', array($this, 'getAssetUrl')),
4444
new \Twig_SimpleFunction('asset_version', array($this, 'getAssetVersion')),
45-
new \Twig_SimpleFunction('assets_version', array($this, 'getAssetsVersion')),
45+
new \Twig_SimpleFunction('assets_version', array($this, 'getAssetsVersion'), array('deprecated' => true, 'alternative' => 'asset_version')),
4646
);
4747
}
4848

src/Symfony/Bridge/Twig/Extension/FormExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function getTokenParsers()
6161
public function getFunctions()
6262
{
6363
return array(
64-
new \Twig_SimpleFunction('form_enctype', null, array('node_class' => 'Symfony\Bridge\Twig\Node\FormEnctypeNode', 'is_safe' => array('html'))),
64+
new \Twig_SimpleFunction('form_enctype', null, array('node_class' => 'Symfony\Bridge\Twig\Node\FormEnctypeNode', 'is_safe' => array('html'), 'deprecated' => true, 'alternative' => 'form_start')),
6565
new \Twig_SimpleFunction('form_widget', null, array('node_class' => 'Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode', 'is_safe' => array('html'))),
6666
new \Twig_SimpleFunction('form_errors', null, array('node_class' => 'Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode', 'is_safe' => array('html'))),
6767
new \Twig_SimpleFunction('form_label', null, array('node_class' => 'Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode', 'is_safe' => array('html'))),

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/logger.html.twig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@
120120
{% set stack = log.context.stack|default([]) %}
121121
{% set id = 'sf-call-stack-' ~ log_index %}
122122

123+
{% if log.context.errorCount is defined %}
124+
({{ log.context.errorCount }}x)
125+
{% endif %}
126+
123127
{% if stack %}
124128
<a href="#" onclick="Sfjs.toggle('{{ id }}', document.getElementById('{{ id }}-on'), document.getElementById('{{ id }}-off')); return false;">
125129
<img class="toggle" id="{{ id }}-off" alt="-" src="data:image/gif;base64,R0lGODlhEgASAMQSANft94TG57Hb8GS44ez1+mC24IvK6ePx+Wa44dXs92+942e54o3L6W2844/M6dnu+P/+/l614P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAABIALAAAAAASABIAQAVCoCQBTBOd6Kk4gJhGBCTPxysJb44K0qD/ER/wlxjmisZkMqBEBW5NHrMZmVKvv9hMVsO+hE0EoNAstEYGxG9heIhCADs=" style="display:none">

src/Symfony/Component/Console/Descriptor/JsonDescriptor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ private function getInputArgumentData(InputArgument $argument)
102102
'name' => $argument->getName(),
103103
'is_required' => $argument->isRequired(),
104104
'is_array' => $argument->isArray(),
105-
'description' => preg_replace('/\s*\R\s*/', ' ', $argument->getDescription()),
105+
'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $argument->getDescription()),
106106
'default' => $argument->getDefault(),
107107
);
108108
}
@@ -120,7 +120,7 @@ private function getInputOptionData(InputOption $option)
120120
'accept_value' => $option->acceptValue(),
121121
'is_value_required' => $option->isValueRequired(),
122122
'is_multiple' => $option->isArray(),
123-
'description' => preg_replace('/\s*\R\s*/', ' ', $option->getDescription()),
123+
'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $option->getDescription()),
124124
'default' => $option->getDefault(),
125125
);
126126
}

src/Symfony/Component/Console/Descriptor/MarkdownDescriptor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ protected function describeInputArgument(InputArgument $argument, array $options
3636
.'* Name: '.($argument->getName() ?: '<none>')."\n"
3737
.'* Is required: '.($argument->isRequired() ? 'yes' : 'no')."\n"
3838
.'* Is array: '.($argument->isArray() ? 'yes' : 'no')."\n"
39-
.'* Description: '.preg_replace('/\s*\R\s*/', PHP_EOL.' ', $argument->getDescription() ?: '<none>')."\n"
39+
.'* Description: '.preg_replace('/\s*[\r\n]\s*/', "\n ", $argument->getDescription() ?: '<none>')."\n"
4040
.'* Default: `'.str_replace("\n", '', var_export($argument->getDefault(), true)).'`'
4141
);
4242
}
@@ -53,7 +53,7 @@ protected function describeInputOption(InputOption $option, array $options = arr
5353
.'* Accept value: '.($option->acceptValue() ? 'yes' : 'no')."\n"
5454
.'* Is value required: '.($option->isValueRequired() ? 'yes' : 'no')."\n"
5555
.'* Is multiple: '.($option->isArray() ? 'yes' : 'no')."\n"
56-
.'* Description: '.preg_replace('/\s*\R\s*/', PHP_EOL.' ', $option->getDescription() ?: '<none>')."\n"
56+
.'* Description: '.preg_replace('/\s*[\r\n]\s*/', "\n ", $option->getDescription() ?: '<none>')."\n"
5757
.'* Default: `'.str_replace("\n", '', var_export($option->getDefault(), true)).'`'
5858
);
5959
}

src/Symfony/Component/Console/Descriptor/TextDescriptor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ protected function describeInputArgument(InputArgument $argument, array $options
4444
$argument->getName(),
4545
str_repeat(' ', $spacingWidth),
4646
// + 17 = 2 spaces + <info> + </info> + 2 spaces
47-
preg_replace('/\s*\R\s*/', PHP_EOL.str_repeat(' ', $totalWidth + 17), $argument->getDescription()),
47+
preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 17), $argument->getDescription()),
4848
$default
4949
), $options);
5050
}
@@ -81,7 +81,7 @@ protected function describeInputOption(InputOption $option, array $options = arr
8181
$synopsis,
8282
str_repeat(' ', $spacingWidth),
8383
// + 17 = 2 spaces + <info> + </info> + 2 spaces
84-
preg_replace('/\s*\R\s*/', "\n".str_repeat(' ', $totalWidth + 17), $option->getDescription()),
84+
preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 17), $option->getDescription()),
8585
$default,
8686
$option->isArray() ? '<comment> (multiple values allowed)</comment>' : ''
8787
), $options);

src/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,46 @@ public function getName()
9797

9898
private function sanitizeLogs($logs)
9999
{
100-
foreach ($logs as $i => $log) {
100+
$errorContextById = array();
101+
$sanitizedLogs = array();
102+
103+
foreach ($logs as $log) {
101104
$context = $this->sanitizeContext($log['context']);
102-
if (isset($context['type'], $context['level']) && !($context['type'] & $context['level'])) {
103-
$context['scream'] = true;
105+
106+
if (isset($context['type'], $context['file'], $context['line'], $context['level'])) {
107+
$errorId = md5("{$context['type']}/{$context['line']}/{$context['file']}\x00{$log['message']}", true);
108+
$silenced = !($context['type'] & $context['level']);
109+
110+
if (isset($errorContextById[$errorId])) {
111+
if (isset($errorContextById[$errorId]['errorCount'])) {
112+
++$errorContextById[$errorId]['errorCount'];
113+
} else {
114+
$errorContextById[$errorId]['errorCount'] = 2;
115+
}
116+
117+
if (!$silenced && isset($errorContextById[$errorId]['scream'])) {
118+
unset($errorContextById[$errorId]['scream']);
119+
$errorContextById[$errorId]['level'] = $context['level'];
120+
}
121+
122+
continue;
123+
}
124+
125+
$errorContextById[$errorId] = &$context;
126+
if ($silenced) {
127+
$context['scream'] = true;
128+
}
129+
130+
$log['context'] = &$context;
131+
unset($context);
132+
} else {
133+
$log['context'] = $context;
104134
}
105-
$logs[$i]['context'] = $context;
135+
136+
$sanitizedLogs[] = $log;
106137
}
107138

108-
return $logs;
139+
return $sanitizedLogs;
109140
}
110141

111142
private function sanitizeContext($context)

src/Symfony/Component/HttpKernel/Tests/DataCollector/LoggerDataCollectorTest.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,18 @@ public function getCollectTestData()
7575
),
7676
array(
7777
1,
78-
array(array('message' => 'foo3', 'context' => array('type' => E_USER_WARNING, 'level' => 0), 'priority' => 100, 'priorityName' => 'DEBUG')),
79-
array(array('message' => 'foo3', 'context' => array('type' => E_USER_WARNING, 'level' => 0, 'scream' => true), 'priority' => 100, 'priorityName' => 'DEBUG')),
78+
array(array('message' => 'foo3', 'context' => array('type' => E_USER_WARNING, 'level' => 0, 'file' => __FILE__, 'line' => 123), 'priority' => 100, 'priorityName' => 'DEBUG')),
79+
array(array('message' => 'foo3', 'context' => array('type' => E_USER_WARNING, 'level' => 0, 'file' => __FILE__, 'line' => 123, 'scream' => true), 'priority' => 100, 'priorityName' => 'DEBUG')),
80+
0,
81+
1,
82+
),
83+
array(
84+
1,
85+
array(
86+
array('message' => 'foo3', 'context' => array('type' => E_USER_WARNING, 'level' => 0, 'file' => __FILE__, 'line' => 123), 'priority' => 100, 'priorityName' => 'DEBUG'),
87+
array('message' => 'foo3', 'context' => array('type' => E_USER_WARNING, 'level' => -1, 'file' => __FILE__, 'line' => 123), 'priority' => 100, 'priorityName' => 'DEBUG'),
88+
),
89+
array(array('message' => 'foo3', 'context' => array('type' => E_USER_WARNING, 'level' => -1, 'file' => __FILE__, 'line' => 123, 'errorCount' => 2), 'priority' => 100, 'priorityName' => 'DEBUG')),
8090
0,
8191
1,
8292
),

src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,9 @@ public function testConstructorDenormalizeWithMissingOptionalArgument()
209209

210210
public function testConstructorDenormalizeWithOptionalDefaultArgument()
211211
{
212+
if (PHP_VERSION_ID <= 50316) {
213+
$this->markTestSkipped('See https://bugs.php.net/62715');
214+
}
212215
$obj = $this->normalizer->denormalize(
213216
array('bar' => 'test'),
214217
__NAMESPACE__.'\GetConstructorArgsWithDefaultValueDummy', 'any');

src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ public function testConstructorDenormalizeWithMissingOptionalArgument()
157157

158158
public function testConstructorDenormalizeWithOptionalDefaultArgument()
159159
{
160+
if (PHP_VERSION_ID <= 50316) {
161+
$this->markTestSkipped('See https://bugs.php.net/62715');
162+
}
160163
$obj = $this->normalizer->denormalize(
161164
array('bar' => 'test'),
162165
__NAMESPACE__.'\ObjectConstructorArgsWithDefaultValueDummy', 'any');

0 commit comments

Comments
 (0)