From 4e0419b9cb984249b823e9484a2d63eb74fd156c Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Mon, 22 Dec 2008 13:27:25 -0500
Subject: [PATCH] #1485640: http://pear.php.net/bugs/bug.php?id=13032 #1485640: html2text: move html_entity_decode() after preg_replace()

---
 program/lib/html2text.php     |    6 +++---
 program/lib/Mail/mimePart.php |    1 -
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/program/lib/Mail/mimePart.php b/program/lib/Mail/mimePart.php
index 7427a10..b404fc5 100644
--- a/program/lib/Mail/mimePart.php
+++ b/program/lib/Mail/mimePart.php
@@ -243,7 +243,6 @@
         $encoded =& $this->_encoded;
 
         if (count($this->_subparts)) {
-            srand((double)microtime()*1000000);
             $boundary = '=_' . md5(rand() . microtime());
             $this->_headers['Content-Type'] .= ';' . MAIL_MIMEPART_CRLF . "\t" . 'boundary="' . $boundary . '"';
 
diff --git a/program/lib/html2text.php b/program/lib/html2text.php
index d298ee2..e2a5b24 100644
--- a/program/lib/html2text.php
+++ b/program/lib/html2text.php
@@ -468,13 +468,13 @@
 	// Convert <PRE>
         $this->_convert_pre($text);
 
-	// Replace known html entities
-	$text = html_entity_decode($text, ENT_COMPAT, 'UTF-8');
-
         // Run our defined search-and-replace
         $text = preg_replace($this->search, $this->replace, $text);
         $text = preg_replace_callback($this->callback_search, array('html2text', '_preg_callback'), $text);
 
+	// Replace known html entities
+	$text = html_entity_decode($text, ENT_COMPAT, 'UTF-8');
+
         // Strip any other HTML tags
         $text = strip_tags($text, $this->allowed_tags);
 

--
Gitblit v1.9.1