Escape literal "%" because of vsprintf

Fixes #81.
This commit is contained in:
Niklas Keller
2016-08-23 08:13:57 +02:00
committed by GitHub
parent 9270140b94
commit 4e19318f81
+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];