From 0c018318c6ec99d1a8dc72c7feb6a7047671f04e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alain=20Corbi=C3=A8re?= Date: Wed, 9 Oct 2013 15:40:38 +0200 Subject: [PATCH] MDL-41672 Fix html2text processing of multiple occurrences of the same URL --- lib/html2text.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/html2text.php b/lib/html2text.php index b78b0ae1b9b..89c9e69bf72 100644 --- a/lib/html2text.php +++ b/lib/html2text.php @@ -580,9 +580,14 @@ class html2text } if (($index = array_search($url, $this->_link_list)) === false) { + // Add the link to the list. $this->_link_list[] = $url; $index = count($this->_link_list); } + else { + // Use the index of the existing link in the list (we enumerate from 1, not from 0). + $index++; + } return $display . ' [' . ($index) . ']'; }