Skip to content

Commit 23590eb

Browse files
Merge branch '2.7' into 2.8
* 2.7: do not depend on a fixed date in layout tests [Console] Escape default value when dumping help [Console] OS X Can't call cli_set_process_title php without superuser Polish translation improvement in Validator component [Console] Descriptors should use Helper::strlen [Config] Improve PHPdoc / IDE autocomplete [Debug] Wrap call to ->log in a try catch block [Debug] UndefinedMethodFatalErrorHandler - Handle anonymous classes [SecurityBundle] Made collection of user provider unique when injecting them to the RemberMeService
2 parents fd8750e + 770ed8d commit 23590eb

39 files changed

+629
-39
lines changed

src/Symfony/Bridge/Twig/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"require-dev": {
2323
"symfony/asset": "~2.7|~3.0.0",
2424
"symfony/finder": "~2.3|~3.0.0",
25-
"symfony/form": "~2.8.4",
25+
"symfony/form": "~2.8.16",
2626
"symfony/http-kernel": "~2.8|~3.0.0",
2727
"symfony/polyfill-intl-icu": "~1.0",
2828
"symfony/routing": "~2.2|~3.0.0",

src/Symfony/Bundle/FrameworkBundle/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"symfony/dom-crawler": "~2.0,>=2.0.5|~3.0.0",
4444
"symfony/polyfill-intl-icu": "~1.0",
4545
"symfony/security": "~2.6|~3.0.0",
46-
"symfony/form": "^2.8.4",
46+
"symfony/form": "^2.8.16",
4747
"symfony/expression-language": "~2.6|~3.0.0",
4848
"symfony/process": "~2.0,>=2.0.5|~3.0.0",
4949
"symfony/validator": "~2.5|~3.0.0",

src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/RememberMeFactory.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ public function create(ContainerBuilder $container, $id, $config, $userProvider,
9797
if (count($userProviders) === 0) {
9898
throw new \RuntimeException('You must configure at least one remember-me aware listener (such as form-login) for each firewall that has remember-me enabled.');
9999
}
100-
$rememberMeServices->replaceArgument(0, $userProviders);
100+
101+
$rememberMeServices->replaceArgument(0, array_unique($userProviders));
101102

102103
// remember-me listener
103104
$listenerId = 'security.authentication.listener.rememberme.'.$id;

src/Symfony/Component/Config/Definition/Builder/ExprBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ public function thenUnset()
198198
/**
199199
* Returns the related node.
200200
*
201-
* @return NodeDefinition
201+
* @return NodeDefinition|ArrayNodeDefinition|VariableNodeDefinition
202202
*
203203
* @throws \RuntimeException
204204
*/

src/Symfony/Component/Config/Definition/Builder/MergeBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function denyOverwrite($deny = true)
6363
/**
6464
* Returns the related node.
6565
*
66-
* @return NodeDefinition
66+
* @return NodeDefinition|ArrayNodeDefinition|VariableNodeDefinition
6767
*/
6868
public function end()
6969
{

src/Symfony/Component/Config/Definition/Builder/NodeDefinition.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public function attribute($key, $value)
107107
/**
108108
* Returns the parent node.
109109
*
110-
* @return NodeParentInterface|NodeBuilder|NodeDefinition|null The builder of the parent node
110+
* @return NodeParentInterface|NodeBuilder|NodeDefinition|ArrayNodeDefinition|VariableNodeDefinition|null The builder of the parent node
111111
*/
112112
public function end()
113113
{

src/Symfony/Component/Config/Definition/Builder/ValidationBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function __construct(NodeDefinition $node)
3636
*
3737
* @param \Closure $closure
3838
*
39-
* @return ExprBuilder|ValidationBuilder
39+
* @return ExprBuilder|$this
4040
*/
4141
public function rule(\Closure $closure = null)
4242
{

src/Symfony/Component/Console/Command/Command.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,14 @@ public function run(InputInterface $input, OutputInterface $output)
230230

231231
if (null !== $this->processTitle) {
232232
if (function_exists('cli_set_process_title')) {
233-
cli_set_process_title($this->processTitle);
233+
if (false === @cli_set_process_title($this->processTitle)) {
234+
if ('Darwin' === PHP_OS) {
235+
$output->writeln('<comment>Running "cli_get_process_title" as an unprivileged user is not supported on MacOS.</comment>');
236+
} else {
237+
$error = error_get_last();
238+
trigger_error($error['message'], E_USER_WARNING);
239+
}
240+
}
234241
} elseif (function_exists('setproctitle')) {
235242
setproctitle($this->processTitle);
236243
} elseif (OutputInterface::VERBOSITY_VERY_VERBOSE === $output->getVerbosity()) {

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\Component\Console\Application;
1515
use Symfony\Component\Console\Command\Command;
16+
use Symfony\Component\Console\Helper\Helper;
1617
use Symfony\Component\Console\Input\InputArgument;
1718
use Symfony\Component\Console\Input\InputDefinition;
1819
use Symfony\Component\Console\Input\InputOption;
@@ -94,7 +95,7 @@ protected function describeCommand(Command $command, array $options = array())
9495

9596
$this->write(
9697
$command->getName()."\n"
97-
.str_repeat('-', strlen($command->getName()))."\n\n"
98+
.str_repeat('-', Helper::strlen($command->getName()))."\n\n"
9899
.'* Description: '.($command->getDescription() ?: '<none>')."\n"
99100
.'* Usage:'."\n\n"
100101
.array_reduce(array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()), function ($carry, $usage) {
@@ -121,7 +122,7 @@ protected function describeApplication(Application $application, array $options
121122
$describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
122123
$description = new ApplicationDescription($application, $describedNamespace);
123124

124-
$this->write($application->getName()."\n".str_repeat('=', strlen($application->getName())));
125+
$this->write($application->getName()."\n".str_repeat('=', Helper::strlen($application->getName())));
125126

126127
foreach ($description->getNamespaces() as $namespace) {
127128
if (ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {

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

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
use Symfony\Component\Console\Application;
1515
use Symfony\Component\Console\Command\Command;
16+
use Symfony\Component\Console\Formatter\OutputFormatter;
17+
use Symfony\Component\Console\Helper\Helper;
1618
use Symfony\Component\Console\Input\InputArgument;
1719
use Symfony\Component\Console\Input\InputDefinition;
1820
use Symfony\Component\Console\Input\InputOption;
@@ -37,7 +39,7 @@ protected function describeInputArgument(InputArgument $argument, array $options
3739
$default = '';
3840
}
3941

40-
$totalWidth = isset($options['total_width']) ? $options['total_width'] : strlen($argument->getName());
42+
$totalWidth = isset($options['total_width']) ? $options['total_width'] : Helper::strlen($argument->getName());
4143
$spacingWidth = $totalWidth - strlen($argument->getName());
4244

4345
$this->writeText(sprintf(' <info>%s</info> %s%s%s',
@@ -75,7 +77,7 @@ protected function describeInputOption(InputOption $option, array $options = arr
7577
sprintf('--%s%s', $option->getName(), $value)
7678
);
7779

78-
$spacingWidth = $totalWidth - strlen($synopsis);
80+
$spacingWidth = $totalWidth - Helper::strlen($synopsis);
7981

8082
$this->writeText(sprintf(' <info>%s</info> %s%s%s%s',
8183
$synopsis,
@@ -94,7 +96,7 @@ protected function describeInputDefinition(InputDefinition $definition, array $o
9496
{
9597
$totalWidth = $this->calculateTotalWidthForOptions($definition->getOptions());
9698
foreach ($definition->getArguments() as $argument) {
97-
$totalWidth = max($totalWidth, strlen($argument->getName()));
99+
$totalWidth = max($totalWidth, Helper::strlen($argument->getName()));
98100
}
99101

100102
if ($definition->getArguments()) {
@@ -206,7 +208,7 @@ protected function describeApplication(Application $application, array $options
206208

207209
foreach ($namespace['commands'] as $name) {
208210
$this->writeText("\n");
209-
$spacingWidth = $width - strlen($name);
211+
$spacingWidth = $width - Helper::strlen($name);
210212
$this->writeText(sprintf(' <info>%s</info>%s%s', $name, str_repeat(' ', $spacingWidth), $description->getCommand($name)->getDescription()), $options);
211213
}
212214
}
@@ -235,6 +237,16 @@ private function writeText($content, array $options = array())
235237
*/
236238
private function formatDefaultValue($default)
237239
{
240+
if (is_string($default)) {
241+
$default = OutputFormatter::escape($default);
242+
} elseif (is_array($default)) {
243+
foreach ($default as $key => $value) {
244+
if (is_string($value)) {
245+
$default[$key] = OutputFormatter::escape($value);
246+
}
247+
}
248+
}
249+
238250
if (PHP_VERSION_ID < 50400) {
239251
return str_replace(array('\/', '\\\\'), array('/', '\\'), json_encode($default));
240252
}
@@ -252,9 +264,9 @@ private function getColumnWidth(array $commands)
252264
$widths = array();
253265

254266
foreach ($commands as $command) {
255-
$widths[] = strlen($command->getName());
267+
$widths[] = Helper::strlen($command->getName());
256268
foreach ($command->getAliases() as $alias) {
257-
$widths[] = strlen($alias);
269+
$widths[] = Helper::strlen($alias);
258270
}
259271
}
260272

@@ -271,10 +283,10 @@ private function calculateTotalWidthForOptions($options)
271283
$totalWidth = 0;
272284
foreach ($options as $option) {
273285
// "-" + shortcut + ", --" + name
274-
$nameLength = 1 + max(strlen($option->getShortcut()), 1) + 4 + strlen($option->getName());
286+
$nameLength = 1 + max(strlen($option->getShortcut()), 1) + 4 + Helper::strlen($option->getName());
275287

276288
if ($option->acceptValue()) {
277-
$valueLength = 1 + strlen($option->getName()); // = + value
289+
$valueLength = 1 + Helper::strlen($option->getName()); // = + value
278290
$valueLength += $option->isValueOptional() ? 2 : 0; // [ + ]
279291

280292
$nameLength += $valueLength;

0 commit comments

Comments
 (0)