8000 Merge branch '2.8' into 3.2 · symfony/symfony@329e96c · GitHub
[go: up one dir, main page]

Skip to content

Commit 329e96c

Browse files
committed
Merge branch '2.8' into 3.2
* 2.8: [Console] Do not duplicate Helper::strlen() code [FrameworkBundle] Adding the extension XML [Form] Minor: Fix comment in ChoiceType [FrameworkBundle] AbstractConfigCommand: do not try registering bundles twice
2 parents f389fa3 + 433dfd4 commit 329e96c

File tree

4 files changed

+7
-14
lines changed

4 files changed

+7
-14
lines changed

src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ private function initializeBundles()
117117
// Re-build bundle manually to initialize DI extensions that can be extended by other bundles in their build() method
118118
// as this method is not called when the container is loaded from the cache.
119119
$container = $this->getContainerBuilder();
120-
$bundles = $this->getContainer()->get('kernel')->registerBundles();
120+
$bundles = $this->getContainer()->get('kernel')->getBundles();
121121
foreach ($bundles as $bundle) {
122122
if ($extension = $bundle->getContainerExtension()) {
123123
$container->registerExtension($extension);

src/Symfony/Bundle/FrameworkBundle/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
],
1818
"require": {
1919
"php": ">=5.5.9",
20+
"ext-xml": "*",
2021
"symfony/cache": "~3.2.2|~3.3",
2122
"symfony/class-loader": "~3.2",
2223
"symfony/dependency-injection": "~3.2.1|~3.3",

src/Symfony/Component/Console/Application.php

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Symfony\Component\Console\Exception\ExceptionInterface;
1515
use Symfony\Component\Console\Formatter\OutputFormatter;
1616
use Symfony\Component\Console\Helper\DebugFormatterHelper;
17+
use Symfony\Component\Console\Helper\Helper;
1718
use Symfony\Component\Console\Helper\ProcessHelper;
1819
use Symfony\Component\Console\Helper\QuestionHelper;
1920
use Symfony\Component\Console\Input\InputInterface;
@@ -638,7 +639,7 @@ public function renderException(\Exception $e, OutputInterface $output)
638639
$output->isVerbose() && 0 !== ($code = $e->getCode()) ? ' ('.$code.')' : ''
639640
);
640641

641-
$len = $this->stringWidth($title);
642+
$len = Helper::strlen($title);
642643

643644
$width = $this->terminal->getWidth() ? $this->terminal->getWidth() - 1 : PHP_INT_MAX;
644645
// HHVM only accepts 32 bits integer in str_split, even when PHP_INT_MAX is a 64 bit integer: https://github.com/facebook/hhvm/issues/1327
@@ -649,7 +650,7 @@ public function renderException(\Exception $e, OutputInterface $output)
649650
foreach (preg_split('/\r?\n/', $e->getMessage()) as $line) {
650651
foreach ($this->splitStringByWidth($line, $width - 4) as $line) {
651652
// pre-format lines to get the right string length
652-
$lineLength = $this->stringWidth($line) + 4;
653+
$lineLength = Helper::strlen($line) + 4;
653654
$lines[] = array($line, $lineLength);
654655

655656
$len = max($lineLength, $len);
@@ -658,7 +659,7 @@ public function renderException(\Exception $e, OutputInterface $output)
658659

659660
$messages = array();
660661
$messages[] = $emptyLine = sprintf('<error>%s</error>', str_repeat(' ', $len));
661-
$messages[] = sprintf('<error>%s%s</error>', $title, str_repeat(' ', max(0, $len - $this->stringWidth($title))));
662+
$messages[] = sprintf('<error>%s%s</error>', $title, str_repeat(' ', max(0, $len - Helper::strlen($title))));
662663
foreach ($lines as $line) {
663664
$messages[] = sprintf('<error> %s %s</error>', OutputFormatter::escape($line[0]), str_repeat(' ', $len - $line[1]));
664665
}
@@ -1038,15 +1039,6 @@ public function setDefaultCommand($commandName, $isSingleCommand = false)
10381039
return $this;
10391040
}
10401041

1041-
private function stringWidth($string)
1042-
{
1043-
if (false === $encoding = mb_detect_encoding($string, null, true)) {
1044-
return strlen($string);
1045-
}
1046-
1047-
return mb_strwidth($string, $encoding);
1048-
}
1049-
10501042
private function splitStringByWidth($string, $width)
10511043
{
10521044
// str_split is not suitable for multi-byte characters, we should use preg_split to get char array properly.

src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
158158
}
159159

160160
// To avoid issues when the submitted choices are arrays (i.e. array to string conversions),
161-
// we have to ensure that all elements of the submitted choice data are strings or null.
161+
// we have to ensure that all elements of the submitted choice data are NULL, strings or ints.
162162
$builder->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) {
163163
$data = $event->getData();
164164

0 commit comments

Comments
 (0)
0