Skip to content

Commit 433dfd4

Browse files
committed
Merge branch '2.7' into 2.8
* 2.7: [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 5e8412b + 0ad2f2e commit 433dfd4

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
@@ -92,7 +92,7 @@ private function initializeBundles()
9292
// Re-build bundle manually to initialize DI extensions that can be extended by other bundles in their build() method
9393
// as this method is not called when the container is loaded from the cache.
9494
$container = $this->getContainerBuilder();
95-
$bundles = $this->getContainer()->get('kernel')->registerBundles();
95+
$bundles = $this->getContainer()->get('kernel')->getBundles();
9696
foreach ($bundles as $bundle) {
9797
if ($extension = $bundle->getContainerExtension()) {
9898
$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.3.9",
20+
"ext-xml": "*",
2021
"symfony/asset": "~2.7|~3.0.0",
2122
"symfony/class-loader": "~2.1|~3.0.0",
2223
"symfony/dependency-injection": "~2.8",

src/Symfony/Component/Console/Application.php

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Symfony\Component\Console\Exception\ExceptionInterface;
1717
use Symfony\Component\Console\Formatter\OutputFormatter;
1818
use Symfony\Component\Console\Helper\DebugFormatterHelper;
19+
use Symfony\Component\Console\Helper\Helper;
1920
use Symfony\Component\Console\Helper\ProcessHelper;
2021
use Symfony\Component\Console\Helper\QuestionHelper;
2122
use Symfony\Component\Console\Input\InputInterface;
@@ -656,7 +657,7 @@ public function renderException($e, $output)
656657
do {
657658
$title = sprintf(' [%s] ', get_class($e));
658659

659-
$len = $this->stringWidth($title);
660+
$len = Helper::strlen($title);
660661

661662
$width = $this->getTerminalWidth() ? $this->getTerminalWidth() - 1 : PHP_INT_MAX;
662663
// 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
@@ -667,7 +668,7 @@ public function renderException($e, $output)
667668
foreach (preg_split('/\r?\n/', $e->getMessage()) as $line) {
668669
foreach ($this->splitStringByWidth($line, $width - 4) as $line) {
669670
// pre-format lines to get the right string length
670-
$lineLength = $this->stringWidth($line) + 4;
671+
$lineLength = Helper::strlen($line) + 4;
671672
$lines[] = array($line, $lineLength);
672673

673674
$len = max($lineLength, $len);
@@ -676,7 +677,7 @@ public function renderException($e, $output)
676677

677678
$messages = array();
678679
$messages[] = $emptyLine = sprintf('<error>%s</error>', str_repeat(' ', $len));
679-
$messages[] = sprintf('<error>%s%s</error>', $title, str_repeat(' ', max(0, $len - $this->stringWidth($title))));
680+
$messages[] = sprintf('<error>%s%s</error>', $title, str_repeat(' ', max(0, $len - Helper::strlen($title))));
680681
foreach ($lines as $line) {
681682
$messages[] = sprintf('<error> %s %s</error>', OutputFormatter::escape($line[0]), str_repeat(' ', $len - $line[1]));
682683
}
@@ -1097,15 +1098,6 @@ public function setDefaultCommand($commandName)
10971098
$this->defaultCommand = $commandName;
10981099
}
10991100

1100-
private function stringWidth($string)
1101-
{
1102-
if (false === $encoding = mb_detect_encoding($string, null, true)) {
1103-
return strlen($string);
1104-
}
1105-
1106-
return mb_strwidth($string, $encoding);
1107-
}
1108-
11091101
private function splitStringByWidth($string, $width)
11101102
{
11111103
// 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
@@ -162,7 +162,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
162162
}
163163

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

0 commit comments

Comments
 (0)