Merge pull request #82 from kelunik/issue-81

Escape literal "%" because of vsprintf
This commit is contained in:
Mike van Riel
2016-09-30 09:11:50 +02:00
committed by GitHub
+2 -1
View File
@@ -129,9 +129,10 @@ class DescriptionFactory
//In order to allow "literal" inline tags, the otherwise invalid //In order to allow "literal" inline tags, the otherwise invalid
//sequence "{@}" is changed to "@", and "{}" is changed to "}". //sequence "{@}" is changed to "@", and "{}" is changed to "}".
//"%" is escaped to "%%" because of vsprintf.
//See unit tests for examples. //See unit tests for examples.
for ($i = 0; $i < $count; $i += 2) { for ($i = 0; $i < $count; $i += 2) {
$tokens[$i] = str_replace(['{@}', '{}'], ['@', '}'], $tokens[$i]); $tokens[$i] = str_replace(['{@}', '{}', '%'], ['@', '}', '%%'], $tokens[$i]);
} }
return [implode('', $tokens), $tags]; return [implode('', $tokens), $tags];