Skip to content

Commit

Permalink
Merge branch '2.7' into 2.8
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
nicolas-grekas committed Sep 1, 2015
2 parents d4441e9 + 33fac14 commit 922a534
Show file tree
Hide file tree
Showing 12 changed files with 69 additions and 18 deletions.
4 changes: 2 additions & 2 deletions appveyor.yml
Expand Up @@ -22,8 +22,8 @@ init:
install:
- IF EXIST c:\php (SET PHP=0) ELSE (mkdir c:\php)
- cd c:\php
- IF %PHP%==1 appveyor DownloadFile http://windows.php.net/downloads/releases/archives/php-5.3.9-nts-Win32-VC9-x86.zip
- IF %PHP%==1 7z x php-5.3.9-nts-Win32-VC9-x86.zip -y > 7z.log
- IF %PHP%==1 appveyor DownloadFile http://windows.php.net/downloads/releases/archives/php-5.3.11-nts-Win32-VC9-x86.zip
- IF %PHP%==1 7z x php-5.3.11-nts-Win32-VC9-x86.zip -y > 7z.log
- IF %PHP%==1 appveyor DownloadFile http://nebm.ist.utl.pt/~glopes/misc/intl_win/ICU-51.2-dlls.zip
- IF %PHP%==1 7z x ICU-51.2-dlls.zip -y > 7z.log
- IF %PHP%==1 cd ext
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/Twig/AppVariable.php
Expand Up @@ -14,8 +14,8 @@
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\SecurityContext;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/Twig/Extension/AssetExtension.php
Expand Up @@ -42,7 +42,7 @@ public function getFunctions()
return array(
new \Twig_SimpleFunction('asset', array($this, 'getAssetUrl')),
new \Twig_SimpleFunction('asset_version', array($this, 'getAssetVersion')),
new \Twig_SimpleFunction('assets_version', array($this, 'getAssetsVersion')),
new \Twig_SimpleFunction('assets_version', array($this, 'getAssetsVersion'), array('deprecated' => true, 'alternative' => 'asset_version')),
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/Twig/Extension/FormExtension.php
Expand Up @@ -61,7 +61,7 @@ public function getTokenParsers()
public function getFunctions()
{
return array(
new \Twig_SimpleFunction('form_enctype', null, array('node_class' => 'Symfony\Bridge\Twig\Node\FormEnctypeNode', 'is_safe' => array('html'))),
new \Twig_SimpleFunction('form_enctype', null, array('node_class' => 'Symfony\Bridge\Twig\Node\FormEnctypeNode', 'is_safe' => array('html'), 'deprecated' => true, 'alternative' => 'form_start')),
new \Twig_SimpleFunction('form_widget', null, array('node_class' => 'Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode', 'is_safe' => array('html'))),
new \Twig_SimpleFunction('form_errors', null, array('node_class' => 'Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode', 'is_safe' => array('html'))),
new \Twig_SimpleFunction('form_label', null, array('node_class' => 'Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode', 'is_safe' => array('html'))),
Expand Down
Expand Up @@ -120,6 +120,10 @@
{% set stack = log.context.stack|default([]) %}
{% set id = 'sf-call-stack-' ~ log_index %}

{% if log.context.errorCount is defined %}
({{ log.context.errorCount }}x)
{% endif %}

{% if stack %}
<a href="#" onclick="Sfjs.toggle('{{ id }}', document.getElementById('{{ id }}-on'), document.getElementById('{{ id }}-off')); return false;">
<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">
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Console/Descriptor/JsonDescriptor.php
Expand Up @@ -102,7 +102,7 @@ private function getInputArgumentData(InputArgument $argument)
'name' => $argument->getName(),
'is_required' => $argument->isRequired(),
'is_array' => $argument->isArray(),
'description' => preg_replace('/\s*\R\s*/', ' ', $argument->getDescription()),
'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $argument->getDescription()),
'default' => $argument->getDefault(),
);
}
Expand All @@ -120,7 +120,7 @@ private function getInputOptionData(InputOption $option)
'accept_value' => $option->acceptValue(),
'is_value_required' => $option->isValueRequired(),
'is_multiple' => $option->isArray(),
'description' => preg_replace('/\s*\R\s*/', ' ', $option->getDescription()),
'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $option->getDescription()),
'default' => $option->getDefault(),
);
}
Expand Down
Expand Up @@ -36,7 +36,7 @@ protected function describeInputArgument(InputArgument $argument, array $options
.'* Name: '.($argument->getName() ?: '<none>')."\n"
.'* Is required: '.($argument->isRequired() ? 'yes' : 'no')."\n"
.'* Is array: '.($argument->isArray() ? 'yes' : 'no')."\n"
.'* Description: '.preg_replace('/\s*\R\s*/', PHP_EOL.' ', $argument->getDescription() ?: '<none>')."\n"
.'* Description: '.preg_replace('/\s*[\r\n]\s*/', "\n ", $argument->getDescription() ?: '<none>')."\n"
.'* Default: `'.str_replace("\n", '', var_export($argument->getDefault(), true)).'`'
);
}
Expand All @@ -53,7 +53,7 @@ protected function describeInputOption(InputOption $option, array $options = arr
.'* Accept value: '.($option->acceptValue() ? 'yes' : 'no')."\n"
.'* Is value required: '.($option->isValueRequired() ? 'yes' : 'no')."\n"
.'* Is multiple: '.($option->isArray() ? 'yes' : 'no')."\n"
.'* Description: '.preg_replace('/\s*\R\s*/', PHP_EOL.' ', $option->getDescription() ?: '<none>')."\n"
.'* Description: '.preg_replace('/\s*[\r\n]\s*/', "\n ", $option->getDescription() ?: '<none>')."\n"
.'* Default: `'.str_replace("\n", '', var_export($option->getDefault(), true)).'`'
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Console/Descriptor/TextDescriptor.php
Expand Up @@ -44,7 +44,7 @@ protected function describeInputArgument(InputArgument $argument, array $options
$argument->getName(),
str_repeat(' ', $spacingWidth),
// + 17 = 2 spaces + <info> + </info> + 2 spaces
preg_replace('/\s*\R\s*/', PHP_EOL.str_repeat(' ', $totalWidth + 17), $argument->getDescription()),
preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 17), $argument->getDescription()),
$default
), $options);
}
Expand Down Expand Up @@ -81,7 +81,7 @@ protected function describeInputOption(InputOption $option, array $options = arr
$synopsis,
str_repeat(' ', $spacingWidth),
// + 17 = 2 spaces + <info> + </info> + 2 spaces
preg_replace('/\s*\R\s*/', "\n".str_repeat(' ', $totalWidth + 17), $option->getDescription()),
preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 17), $option->getDescription()),
$default,
$option->isArray() ? '<comment> (multiple values allowed)</comment>' : ''
), $options);
Expand Down
Expand Up @@ -97,15 +97,46 @@ public function getName()

private function sanitizeLogs($logs)
{
foreach ($logs as $i => $log) {
$errorContextById = array();
$sanitizedLogs = array();

foreach ($logs as $log) {
$context = $this->sanitizeContext($log['context']);
if (isset($context['type'], $context['level']) && !($context['type'] & $context['level'])) {
$context['scream'] = true;

if (isset($context['type'], $context['file'], $context['line'], $context['level'])) {
$errorId = md5("{$context['type']}/{$context['line']}/{$context['file']}\x00{$log['message']}", true);
$silenced = !($context['type'] & $context['level']);

if (isset($errorContextById[$errorId])) {
if (isset($errorContextById[$errorId]['errorCount'])) {
++$errorContextById[$errorId]['errorCount'];
} else {
$errorContextById[$errorId]['errorCount'] = 2;
}

if (!$silenced && isset($errorContextById[$errorId]['scream'])) {
unset($errorContextById[$errorId]['scream']);
$errorContextById[$errorId]['level'] = $context['level'];
}

continue;
}

$errorContextById[$errorId] = &$context;
if ($silenced) {
$context['scream'] = true;
}

$log['context'] = &$context;
unset($context);
} else {
$log['context'] = $context;
}
$logs[$i]['context'] = $context;

$sanitizedLogs[] = $log;
}

return $logs;
return $sanitizedLogs;
}

private function sanitizeContext($context)
Expand Down
Expand Up @@ -75,8 +75,18 @@ public function getCollectTestData()
),
array(
1,
array(array('message' => 'foo3', 'context' => array('type' => E_USER_WARNING, 'level' => 0), 'priority' => 100, 'priorityName' => 'DEBUG')),
array(array('message' => 'foo3', 'context' => array('type' => E_USER_WARNING, 'level' => 0, 'scream' => true), 'priority' => 100, 'priorityName' => 'DEBUG')),
array(array('message' => 'foo3', 'context' => array('type' => E_USER_WARNING, 'level' => 0, 'file' => __FILE__, 'line' => 123), 'priority' => 100, 'priorityName' => 'DEBUG')),
array(array('message' => 'foo3', 'context' => array('type' => E_USER_WARNING, 'level' => 0, 'file' => __FILE__, 'line' => 123, 'scream' => true), 'priority' => 100, 'priorityName' => 'DEBUG')),
0,
1,
),
array(
1,
array(
array('message' => 'foo3', 'context' => array('type' => E_USER_WARNING, 'level' => 0, 'file' => __FILE__, 'line' => 123), 'priority' => 100, 'priorityName' => 'DEBUG'),
array('message' => 'foo3', 'context' => array('type' => E_USER_WARNING, 'level' => -1, 'file' => __FILE__, 'line' => 123), 'priority' => 100, 'priorityName' => 'DEBUG'),
),
array(array('message' => 'foo3', 'context' => array('type' => E_USER_WARNING, 'level' => -1, 'file' => __FILE__, 'line' => 123, 'errorCount' => 2), 'priority' => 100, 'priorityName' => 'DEBUG')),
0,
1,
),
Expand Down
Expand Up @@ -209,6 +209,9 @@ public function testConstructorDenormalizeWithMissingOptionalArgument()

public function testConstructorDenormalizeWithOptionalDefaultArgument()
{
if (PHP_VERSION_ID <= 50316) {
$this->markTestSkipped('See https://bugs.php.net/62715');
}
$obj = $this->normalizer->denormalize(
array('bar' => 'test'),
__NAMESPACE__.'\GetConstructorArgsWithDefaultValueDummy', 'any');
Expand Down
Expand Up @@ -157,6 +157,9 @@ public function testConstructorDenormalizeWithMissingOptionalArgument()

public function testConstructorDenormalizeWithOptionalDefaultArgument()
{
if (PHP_VERSION_ID <= 50316) {
$this->markTestSkipped('See https://bugs.php.net/62715');
}
$obj = $this->normalizer->denormalize(
array('bar' => 'test'),
__NAMESPACE__.'\ObjectConstructorArgsWithDefaultValueDummy', 'any');
Expand Down

0 comments on commit 922a534

Please sign in to comment.