File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
src/Symfony/Component/Console Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ class OutputFormatter implements OutputFormatterInterface
23
23
/**
24
24
* The pattern to phrase the format.
25
25
*/
26
- const FORMAT_PATTERN = '#( \\\\?)<(/?)([a-z][a-z0-9_=;-]+)?>((?:(?! \\\\? <(?:/?[a-z]|/>)).) *)#is ' ;
26
+ const FORMAT_PATTERN = '#( \\\\?)<(/?)([a-z][a-z0-9_=;-]+)?>((?: [^< \\\\]+ | (?! <(?:/?[a-z]|/>)). | .(?<= \\\\ <) ) *)#isx ' ;
27
27
28
28
private $ decorated ;
29
29
private $ styles = array ();
Original file line number Diff line number Diff line change @@ -83,6 +83,16 @@ public function testStyleMatchingNotGreedy()
83
83
);
84
84
}
85
85
86
+ public function testStyleEscaping ()
87
+ {
88
+ $ formatter = new OutputFormatter (true );
89
+
90
+ $ this ->assertEquals (
91
+ "( \033[32mz>=2.0,<a2.3 \033[0m) " ,
92
+ $ formatter ->format ('(<info> ' .$ formatter ->escape ('z>=2.0,<a2.3 ' ).'</info>) ' )
93
+ );
94
+ }
95
+
86
96
public function testDeepNestedStyles ()
87
97
{
88
98
$ formatter = new OutputFormatter (true );
You can’t perform that action at this time.
0 commit comments