File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -65,10 +65,10 @@ class PHPUnit_Util_XML
65
65
public static function prepareString ($ string )
66
66
{
67
67
return preg_replace_callback (
68
- '( [ \\x00- \\x04 \\x0b \\x0c \\x0e- \\x1f \\x7f]) ' ,
68
+ '/ [ \\x00- \\x04 \\x0b \\x0c \\x0e- \\x1f \\x7f]/ ' ,
69
69
function ($ matches )
70
70
{
71
- return sprintf ('&#x%02x; ' , ord ($ matches [1 ]));
71
+ return sprintf ('&#x%02x; ' , ord ($ matches [0 ]));
72
72
},
73
73
htmlspecialchars (
74
74
PHPUnit_Util_String::convertToUtf8 ($ string ), ENT_COMPAT , 'UTF-8 '
Original file line number Diff line number Diff line change @@ -320,4 +320,9 @@ public function testConvertAssertRange()
320
320
321
321
$ this ->assertEquals ($ tag , $ converted );
322
322
}
323
+
324
+ public function testPrepareStringEscapesChars ()
325
+ {
326
+ $ this ->assertEquals (' ' , PHPUnit_Util_XML::prepareString ("\033" ));
327
+ }
323
328
}
You can’t perform that action at this time.
0 commit comments