From 6736ba9a047710c03a58197183fba4c4a3db94bd Mon Sep 17 00:00:00 2001 From: Gareth Evans Date: Mon, 20 Apr 2015 16:24:11 +0100 Subject: [PATCH] Fix check against $matches Fixes inline reference links with int 0 as reference The link [link][0] where [0] is set at the bottom of the md file current breaks and it's truthy value is false. --- Parsedown.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Parsedown.php b/Parsedown.php index 9bdae22..87c10a6 100755 --- a/Parsedown.php +++ b/Parsedown.php @@ -1212,7 +1212,7 @@ class Parsedown { if (preg_match('/^\s*\[(.*?)\]/', $remainder, $matches)) { - $definition = $matches[1] ? $matches[1] : $Element['text']; + $definition = strlen($matches[1]) ? $matches[1] : $Element['text']; $definition = strtolower($definition); $extent += strlen($matches[0]);