Skip to content

Commit 7ffa57c

Browse files
committed
Merge branch '2.7' into 2.8
* 2.7: (95 commits) [DependencyInjection] provide better error message when using deprecated configuration options [console][TableCell] get cell width without decoration. Improve the config validation in TwigBundle [VarDumper] Changed tooltip to expand-all keybinding in OS X [Bridge\PhpUnit] Fix composer installed phpunit detection [VarDumper] Fix generic casters calling order [2.7][SecurityBundle] Remove SecurityContext from Compile [WebProfilerBundle][logger] added missing deprecation message. Fix profiler CSS [Security][Acl] enforce string identifiers [FrameworkBundle] make `templating.helper.router` service available again for BC reasons [BrowserKit] Fix bug when uri starts with http. bumped Symfony version to 2.7.1 updated VERSION for 2.7.0 updated CHANGELOG for 2.7.0 bumped Symfony version to 2.6.10 updated VERSION for 2.6.9 updated CHANGELOG for 2.6.9 fixed tests bumped Symfony version to 2.3.31 ... Conflicts: src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/logger.html.twig src/Symfony/Component/HttpKernel/Kernel.php src/Symfony/Component/Translation/Loader/JsonFileLoader.php
2 parents 46edd06 + 5fc4a2d commit 7ffa57c

14 files changed

+248
-58
lines changed

Command/ConfigDumpReferenceCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ protected function configure()
3737
->setName('config:dump-reference')
3838
->setDefinition(array(
3939
new InputArgument('name', InputArgument::OPTIONAL, 'The Bundle name or the extension alias'),
40-
new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The format, either yaml or xml', 'yaml'),
40+
new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (yaml or xml)', 'yaml'),
4141
))
4242
->setDescription('Dumps the default configuration for an extension')
4343
->setHelp(<<<EOF

Command/ContainerDebugCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ protected function configure()
5050
new InputOption('tags', null, InputOption::VALUE_NONE, 'Displays tagged services for an application'),
5151
new InputOption('parameter', null, InputOption::VALUE_REQUIRED, 'Displays a specific parameter for an application'),
5252
new InputOption('parameters', null, InputOption::VALUE_NONE, 'Displays parameters for an application'),
53-
new InputOption('format', null, InputOption::VALUE_REQUIRED, 'To output description in other formats', 'txt'),
53+
new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
5454
new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw description'),
5555
))
5656
->setDescription('Displays current services for an application')

Command/EventDispatcherDebugCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
2020

2121
/**
22-
* A console command for retrieving information about event dispatcher
22+
* A console command for retrieving information about event dispatcher.
2323
*
2424
* @author Matthieu Auger <mail@matthieuauger.com>
2525
*/
@@ -34,7 +34,7 @@ protected function configure()
3434
->setName('debug:event-dispatcher')
3535
->setDefinition(array(
3636
new InputArgument('event', InputArgument::OPTIONAL, 'An event name'),
37-
new InputOption('format', null, InputOption::VALUE_REQUIRED, 'To output description in other formats', 'txt'),
37+
new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
3838
new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw description'),
3939
))
4040
->setDescription('Displays configured listeners for an application')
@@ -87,7 +87,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
8787
}
8888

8989
/**
90-
* Loads the Event Dispatcher from the container
90+
* Loads the Event Dispatcher from the container.
9191
*
9292
* @return EventDispatcherInterface
9393
*/

Command/RouterDebugCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ protected function configure()
5656
->setDefinition(array(
5757
new InputArgument('name', InputArgument::OPTIONAL, 'A route name'),
5858
new InputOption('show-controllers', null, InputOption::VALUE_NONE, 'Show assigned controllers in overview'),
59-
new InputOption('format', null, InputOption::VALUE_REQUIRED, 'To output route(s) in other formats', 'txt'),
59+
new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
6060
new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw route(s)'),
6161
))
6262
->setDescription('Displays current routes for an application')

Command/TranslationDebugCommand.php

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

1414
use Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader;
1515
use Symfony\Component\Console\Helper\Table;
16+
use Symfony\Component\Console\Style\SymfonyStyle;
1617
use Symfony\Component\Console\Input\InputInterface;
1718
use Symfony\Component\Console\Input\InputArgument;
1819
use Symfony\Component\Console\Input\InputOption;
@@ -92,8 +93,9 @@ protected function configure()
9293
*/
9394
protected function execute(InputInterface $input, OutputInterface $output)
9495
{
96+
$output = new SymfonyStyle($input, $output);
9597
if (false !== strpos($input->getFirstArgument(), ':d')) {
96-
$output->writeln('<comment>The use of "translation:debug" command is deprecated since version 2.7 and will be removed in 3.0. Use the "debug:translation" instead.</comment>');
98+
$output->caution('The use of "translation:debug" command is deprecated since version 2.7 and will be removed in 3.0. Use the "debug:translation" instead.');
9799
}
98100

99101
$locale = $input->getArgument('locale');
@@ -115,9 +117,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
115117
$rootPaths = array($input->getArgument('bundle'));
116118

117119
if (!is_dir($rootPaths[0])) {
118-
throw new \InvalidArgumentException(
119-
sprintf('<error>"%s" is neither an enabled bundle nor a directory.</error>', $rootPaths[0])
120-
);
120+
throw new \InvalidArgumentException(sprintf('"%s" is neither an enabled bundle nor a directory.</error>', $rootPaths[0]));
121121
}
122122
}
123123
} elseif ($input->getOption('all')) {
@@ -160,20 +160,15 @@ protected function execute(InputInterface $input, OutputInterface $output)
160160

161161
// Load the fallback catalogues
162162
$fallbackCatalogues = $this->loadFallbackCatalogues($locale, $translationsPath, $loader);
163-
if (class_exists('Symfony\Component\Console\Helper\Table')) {
164-
$table = new Table($output);
165-
} else {
166-
$table = $this->getHelperSet()->get('table');
167-
}
168163

169164
// Display header line
170165
$headers = array('State', 'Domain', 'Id', sprintf('Message Preview (%s)', $locale));
171166
foreach ($fallbackCatalogues as $fallbackCatalogue) {
172167
$headers[] = sprintf('Fallback Message Preview (%s)', $fallbackCatalogue->getLocale());
173168
}
174-
$table->setHeaders($headers);
175169

176170
// Iterate all message ids and determine their state
171+
$rows = array();
177172
foreach ($allMessages as $domain => $messages) {
178173
foreach (array_keys($messages) as $messageId) {
179174
$value = $currentCatalogue->get($messageId, $domain);
@@ -205,16 +200,11 @@ protected function execute(InputInterface $input, OutputInterface $output)
205200
$row[] = $this->sanitizeString($fallbackCatalogue->get($messageId, $domain));
206201
}
207202

208-
$table->addRow($row);
203+
$rows[] = $row;
209204
}
210205
}
211206

212-
if (class_exists('Symfony\Component\Console\Helper\Table')) {
213-
$table->render();
214-
} else {
215-
$table->render($output);
216-
}
217-
$output->writeln('');
207+
$output->table($headers, $rows);
218208
}
219209
}
220210

Command/TranslationUpdateCommand.php

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\Command;
1313

14+
use Symfony\Component\Console\Style\SymfonyStyle;
1415
use Symfony\Component\Translation\Catalogue\DiffOperation;
1516
use Symfony\Component\Translation\Catalogue\MergeOperation;
1617
use Symfony\Component\Console\Input\InputInterface;
@@ -67,9 +68,10 @@ protected function configure()
6768
*/
6869
protected function execute(InputInterface $input, OutputInterface $output)
6970
{
71+
$output = new SymfonyStyle($input, $output);
7072
// check presence of force or dump-message
7173
if ($input->getOption('force') !== true && $input->getOption('dump-messages') !== true) {
72-
$output->writeln('<info>You must choose one of --force or --dump-messages</info>');
74+
$output->error('You must choose one of --force or --dump-messages');
7375

7476
return 1;
7577
}
@@ -78,16 +80,15 @@ protected function execute(InputInterface $input, OutputInterface $output)
7880
$writer = $this->getContainer()->get('translation.writer');
7981
$supportedFormats = $writer->getFormats();
8082
if (!in_array($input->getOption('output-format'), $supportedFormats)) {
81-
$output->writeln('<error>Wrong output format</error>');
82-
$output->writeln('Supported formats are '.implode(', ', $supportedFormats).'.');
83+
$output->error(array('Wrong output format', 'Supported formats are '.implode(', ', $supportedFormats).'.'));
8384

8485
return 1;
8586
}
8687
$kernel = $this->getContainer()->get('kernel');
8788

8889
// Define Root Path to App folder
8990
$rootPath = $kernel->getRootDir();
90-
$currentName = "app folder";
91+
$currentName = 'app folder';
9192

9293
// Override with provided Bundle info
9394
if (null !== $input->getArgument('bundle')) {
@@ -106,20 +107,22 @@ protected function execute(InputInterface $input, OutputInterface $output)
106107
}
107108
}
108109

110+
$output->title('Symfony translation update command');
111+
109112
// get bundle directory
110113
$translationsPath = $rootPath.'/Resources/translations';
111-
$output->writeln(sprintf('Generating "<info>%s</info>" translation files for "<info>%s</info>"', $input->getArgument('locale'), $currentName));
114+
$output->text(sprintf('Generating "<info>%s</info>" translation files for "<info>%s</info>"', $input->getArgument('locale'), $currentName));
112115

113116
// load any messages from templates
114117
$extractedCatalogue = new MessageCatalogue($input->getArgument('locale'));
115-
$output->writeln('Parsing templates');
118+
$output->text('Parsing templates');
116119
$extractor = $this->getContainer()->get('translation.extractor');
117120
$extractor->setPrefix($input->getOption('prefix'));
118121
$extractor->extract($rootPath.'/Resources/views/', $extractedCatalogue);
119122

120123
// load any existing messages from the translation files
121124
$currentCatalogue = new MessageCatalogue($input->getArgument('locale'));
122-
$output->writeln('Loading translation files');
125+
$output->text('Loading translation files');
123126
$loader = $this->getContainer()->get('translation.loader');
124127
$loader->loadMessages($translationsPath, $currentCatalogue);
125128

@@ -130,26 +133,27 @@ protected function execute(InputInterface $input, OutputInterface $output)
130133

131134
// Exit if no messages found.
132135
if (!count($operation->getDomains())) {
133-
$output->writeln("\n<comment>No translation found.</comment>");
136+
$output->warning('No translation found.');
134137

135138
return;
136139
}
137140

138141
// show compiled list of messages
139142
if ($input->getOption('dump-messages') === true) {
143+
$output->newLine();
140144
foreach ($operation->getDomains() as $domain) {
141-
$output->writeln(sprintf("\nDisplaying messages for domain <info>%s</info>:\n", $domain));
145+
$output->section(sprintf('Displaying messages for domain <info>%s</info>:', $domain));
142146
$newKeys = array_keys($operation->getNewMessages($domain));
143147
$allKeys = array_keys($operation->getMessages($domain));
144-
foreach (array_diff($allKeys, $newKeys) as $id) {
145-
$output->writeln($id);
146-
}
147-
foreach ($newKeys as $id) {
148-
$output->writeln(sprintf('<fg=green>%s</>', $id));
149-
}
150-
foreach (array_keys($operation->getObsoleteMessages($domain)) as $id) {
151-
$output->writeln(sprintf('<fg=red>%s</>', $id));
152-
}
148+
$output->listing(array_merge(
149+
array_diff($allKeys, $newKeys),
150+
array_map(function ($id) {
151+
return sprintf('<fg=green>%s</>', $id);
152+
}, $newKeys),
153+
array_map(function($id) {
154+
return sprintf('<fg=red>%s</>', $id);
155+
}, array_keys($operation->getObsoleteMessages($domain)))
156+
));
153157
}
154158

155159
if ($input->getOption('output-format') == 'xlf') {
@@ -163,8 +167,11 @@ protected function execute(InputInterface $input, OutputInterface $output)
163167

164168
// save the files
165169
if ($input->getOption('force') === true) {
166-
$output->writeln('Writing files');
170+
$output->text('Writing files');
167171
$writer->writeTranslations($operation->getResult(), $input->getOption('output-format'), array('path' => $translationsPath, 'default_locale' => $this->getContainer()->getParameter('kernel.default_locale')));
168172
}
173+
174+
$output->newLine();
175+
$output->success('Success');
169176
}
170177
}

Controller/TemplateController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function templateAction($template, $maxAge = null, $sharedAge = null, $pr
4747
if ($private) {
4848
$response->setPrivate();
4949
} elseif ($private === false || (null === $private && ($maxAge || $sharedAge))) {
50-
$response->setPublic($private);
50+
$response->setPublic();
5151
}
5252

5353
return $response;

Resources/config/services.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
<argument type="service" id="service_container" />
2626
<argument type="service" id="controller_resolver" />
2727
<argument type="service" id="request_stack" />
28+
<argument>false</argument>
2829
</service>
2930

3031
<service id="request_stack" class="%request_stack.class%" />

Resources/config/templating.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<parameter key="templating.loader.chain.class">Symfony\Component\Templating\Loader\ChainLoader</parameter>
1616
<parameter key="templating.finder.class">Symfony\Bundle\FrameworkBundle\CacheWarmer\TemplateFinder</parameter>
1717
<parameter key="templating.helper.assets.class">Symfony\Bundle\FrameworkBundle\Templating\Helper\AssetsHelper</parameter>
18+
<parameter key="templating.helper.router.class">Symfony\Bundle\FrameworkBundle\Templating\Helper\RouterHelper</parameter>
1819
</parameters>
1920

2021
<services>
@@ -61,12 +62,17 @@
6162
<service id="templating.loader" alias="templating.loader.filesystem" />
6263

6364
<!--
64-
This service will be moved to templating_php.xml in version 3.0, it exists here for BC reasons.
65+
The following services will be moved to templating_php.xml in version 3.0, they exist here for BC reasons.
6566
-->
6667
<service id="templating.helper.assets" class="%templating.helper.assets.class%">
6768
<tag name="templating.helper" alias="assets" />
6869
<argument /> <!-- default package -->
6970
<argument type="collection" /> <!-- named packages -->
7071
</service>
72+
73+
<service id="templating.helper.router" class="%templating.helper.router.class%">
74+
<tag name="templating.helper" alias="router" />
75+
<argument type="service" id="router" />
76+
</service>
7177
</services>
7278
</container>

Resources/config/templating_php.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
<parameter key="templating.engine.php.class">Symfony\Bundle\FrameworkBundle\Templating\PhpEngine</parameter>
99
<parameter key="templating.helper.slots.class">Symfony\Component\Templating\Helper\SlotsHelper</parameter>
1010
<parameter key="templating.helper.actions.class">Symfony\Bundle\FrameworkBundle\Templating\Helper\ActionsHelper</parameter>
11-
<parameter key="templating.helper.router.class">Symfony\Bundle\FrameworkBundle\Templating\Helper\RouterHelper</parameter>
1211
<parameter key="templating.helper.request.class">Symfony\Bundle\FrameworkBundle\Templating\Helper\RequestHelper</parameter>
1312
<parameter key="templating.helper.session.class">Symfony\Bundle\FrameworkBundle\Templating\Helper\SessionHelper</parameter>
1413
<parameter key="templating.helper.code.class">Symfony\Bundle\FrameworkBundle\Templating\Helper\CodeHelper</parameter>
@@ -43,11 +42,6 @@
4342
<argument type="service" id="request_stack" />
4443
</service>
4544

46-
<service id="templating.helper.router" class="%templating.helper.router.class%">
47-
<tag name="templating.helper" alias="router" />
48-
<argument type="service" id="router" />
49-
</service>
50-
5145
<service id="templating.helper.actions" class="%templating.helper.actions.class%">
5246
<tag name="templating.helper" alias="actions" />
5347
<argument type="service" id="fragment.handler" />

Resources/public/css/body.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ build: 56
5252
background-color: #FFFFFF;
5353
border: 1px solid #dfdfdf;
5454
padding: 40px 50px;
55+
word-break: break-all;
5556
}
5657
.sf-reset h2 {
5758
font-size: 16px;

Templating/Helper/CodeHelper.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -154,24 +154,25 @@ public function fileExcerpt($file, $line)
154154
*/
155155
public function formatFile($file, $line, $text = null)
156156
{
157+
if (PHP_VERSION_ID >= 50400) {
158+
$flags = ENT_QUOTES | ENT_SUBSTITUTE;
159+
} else {
160+
$flags = ENT_QUOTES;
161+
}
162+
157163
if (null === $text) {
158164
$file = trim($file);
159165
$fileStr = $file;
160166
if (0 === strpos($fileStr, $this->rootDir)) {
161167
$fileStr = str_replace($this->rootDir, '', str_replace('\\', '/', $fileStr));
162-
$fileStr = sprintf('<abbr title="%s">kernel.root_dir</abbr>/%s', $this->rootDir, $fileStr);
168+
$fileStr = htmlspecialchars($fileStr, $flags, $this->charset);
169+
$fileStr = sprintf('<abbr title="%s">kernel.root_dir</abbr>/%s', htmlspecialchars($this->rootDir, $flags, $this->charset), $fileStr);
163170
}
164171

165-
$text = "$fileStr at line $line";
172+
$text = sprintf('%s at line %d', $fileStr, $line);
166173
}
167174

168175
if (false !== $link = $this->getFileLink($file, $line)) {
169-
if (PHP_VERSION_ID >= 50400) {
170-
$flags = ENT_QUOTES | ENT_SUBSTITUTE;
171-
} else {
172-
$flags = ENT_QUOTES;
173-
}
174-
175176
return sprintf('<a href="%s" title="Click to open this file" class="file_link">%s</a>', htmlspecialchars($link, $flags, $this->charset), $text);
176177
}
177178

0 commit comments

Comments
 (0)