8000 bug #29619 [Console] OutputFormatter: move strtolower to createStyleF… · symfony/symfony@3d33e71 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3d33e71

Browse files
bug #29619 [Console] OutputFormatter: move strtolower to createStyleFromString (ogizanagi)
This PR was merged into the 3.4 branch. Discussion ---------- [Console] OutputFormatter: move strtolower to createStyleFromString | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | not really | New feature? | no <!-- don't forget to update src/**/CHANGELOG.md files --> | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | N/A <!-- #-prefixed issue number(s), if any --> | License | MIT | Doc PR | N/A While playing with the href feature that'll be available in 4.3, I spotted href value [is lowercased](#29620). Which I guess could be an issue on case-sensitive filesystems. This changes nothing for the current branch, but will allow when merging to upper branches to fix the behavior described above, hence keep original case. Commits ------- 8e2bd35 [Console] OutputFormatter: move strtolower to createStyleFromString
2 parents 49c21d5 + 8e2bd35 commit 3d33e71

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/Symfony/Component/Console/Formatter/OutputFormatter.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ public function format($message)
157157
if (!$open && !$tag) {
158158
// </>
159159
$this->styleStack->pop();
160-
} elseif (false === $style = $this->createStyleFromString(strtolower($tag))) {
160+
} elseif (false === $style = $this->createStyleFromString($tag)) {
161161
$output .= $this->applyCurrentStyle($text);
162162
} elseif ($open) {
163163
$this->styleStack->push($style);
@@ -203,13 +203,14 @@ private function createStyleFromString($string)
203203
$style = new OutputFormatterStyle();
204204
foreach ($matches as $match) {
205205
array_shift($match);
206+
$match[0] = strtolower($match[0]);
206207

207208
if ('fg' == $match[0]) {
208-
$style->setForeground($match[1]);
209+
$style->setForeground(strtolower($match[1]));
209210
} elseif ('bg' == $match[0]) {
210-
$style->setBackground($match[1]);
211+
$style->setBackground(strtolower($match[1]));
211212
} elseif ('options' === $match[0]) {
212-
preg_match_all('([^,;]+)', $match[1], $options);
213+
preg_match_all('([^,;]+)', strtolower($match[1]), $options);
213214
$options = array_shift($options);
214215
foreach ($options as $option) {
215216
try {

0 commit comments

Comments
 (0)
0