From 4e19318f8103079633526f1037c9f720b1f3f4b7 Mon Sep 17 00:00:00 2001 From: Niklas Keller Date: Tue, 23 Aug 2016 08:13:57 +0200 Subject: [PATCH] Escape literal "%" because of vsprintf Fixes #81. --- src/DocBlock/DescriptionFactory.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/DocBlock/DescriptionFactory.php b/src/DocBlock/DescriptionFactory.php index d59858b..f34d0f7 100644 --- a/src/DocBlock/DescriptionFactory.php +++ b/src/DocBlock/DescriptionFactory.php @@ -129,9 +129,10 @@ class DescriptionFactory //In order to allow "literal" inline tags, the otherwise invalid //sequence "{@}" is changed to "@", and "{}" is changed to "}". + //"%" is escaped to "%%" because of vsprintf. //See unit tests for examples. for ($i = 0; $i < $count; $i += 2) { - $tokens[$i] = str_replace(['{@}', '{}'], ['@', '}'], $tokens[$i]); + $tokens[$i] = str_replace(['{@}', '{}', '%'], ['@', '}', '%%'], $tokens[$i]); } return [implode('', $tokens), $tags];