From 87c794b22e0602dff3c70785de45c9b3933748db Mon Sep 17 00:00:00 2001 From: Eric Date: Tue, 26 Nov 2019 15:44:17 +0100 Subject: [PATCH] fix unit tests - Support Microsoft encoding of non breaking line in UTF-8 --- core/htmlsanitizer.class.inc.php | 4 +- test/core/HTMLDOMSanitizerTest.php | 62 ------------------------------ 2 files changed, 3 insertions(+), 63 deletions(-) diff --git a/core/htmlsanitizer.class.inc.php b/core/htmlsanitizer.class.inc.php index 9220a7d13..5b7693ead 100644 --- a/core/htmlsanitizer.class.inc.php +++ b/core/htmlsanitizer.class.inc.php @@ -241,6 +241,8 @@ class HTMLDOMSanitizer extends HTMLSanitizer public function __construct() { + parent::__construct(); + // Building href validation pattern from url and email validation patterns as the patterns are not used the same way in HTML content than in standard attributes value. // eg. "foo@bar.com" vs "mailto:foo@bar.com?subject=Title&body=Hello%20world" if (!array_key_exists('href', self::$aAttrsWhiteList)) @@ -273,7 +275,7 @@ class HTMLDOMSanitizer extends HTMLSanitizer // therefore we have to do the transformation upfront $sHTML = preg_replace('@(\s| )*@', '
', $sHTML); // Replace badly encoded non breaking space - $sHTML = preg_replace('~\xc2\xa0~', ' ', $sHTML); + $sHTML = preg_replace('~\xc2\xa0~', ' ', $sHTML); @$this->oDoc->loadHTML(''.$sHTML); // For loading HTML chunks where the character set is not specified diff --git a/test/core/HTMLDOMSanitizerTest.php b/test/core/HTMLDOMSanitizerTest.php index 73d4c4e79..aceff18ff 100644 --- a/test/core/HTMLDOMSanitizerTest.php +++ b/test/core/HTMLDOMSanitizerTest.php @@ -92,68 +92,6 @@ div.WordSection1 {page:WordSection1;} -->

Test mit nur Unterschrift

Kein bild

 

 

Christel Dedman

 

Financial Reporting Manager | G4S International Logistics (Germany) GmbH

 

 

Rathenaustrasse 53, 63263 Neu – Isenburg, Office Tel: +49 (0) 6102 / 4393 623 | Fax: +49 (0) 6102 / 4393 619 | Mobile: +49 (0) 172 / 5687367

Email:  christel.dedman@g4si.com  |  Web site:  www.g4si.com / www.g4s.com

Disclaimer: G4S International Logistics (G4Si) is a division of the G4S plc group of companies. This communication contains information which may be confidential, personal and/or privileged. It is for the exclusive use of the intended recipient(s).
If you are not the intended recipient(s), please note that any distribution, forwarding, copying or use of this communication or the information in it is strictly prohibited. Any personal views expressed in this e-mail are those of the individual sender and G4Si does not endorse or accept responsibility for them. Prior to taking any action based upon this e-mail message, you should seek appropriate confirmation of its authenticity.

 

-
-

Please consider the environment before printing this email.
*********************************************************************
This communication may contain information which is confidential, personal and/or privileged. It is for the exclusive use of the intended recipient(s).
If you are not the intended recipient(s), please note that any distribution, forwarding, copying or use of this communication or the information in it is strictly prohibited. If you have received it in error please contact the sender immediately by return e-mail. Please then delete the e-mail and any copies of it and do not use or disclose its contents to any person.
Any personal views expressed in this e-mail are those of the individual sender and the company does not endorse or accept responsibility for them. Prior to taking any action based upon this e-mail message, you should seek appropriate confirmation of its authenticity.
This message has been checked for viruses on behalf of the company.
*********************************************************************


-EOF - ), - array(<<< EOF -

Test mit nur Unterschrift

Kein bild

Christel Dedman

Financial Reporting Manager | G4S International Logistics (Germany) GmbH

Rathenaustrasse 53, 63263 Neu – Isenburg, Office Tel: +49 (0) 6102 / 4393 623 | Fax: +49 (0) 6102 / 4393 619 | Mobile: +49 (0) 172 / 5687367

Email: christel.dedman@g4si.com | Web site: www.g4si.com / www.g4s.com

Disclaimer: G4S International Logistics (G4Si) is a division of the G4S plc group of companies. This communication contains information which may be confidential, personal and/or privileged. It is for the exclusive use of the intended recipient(s).
If you are not the intended recipient(s), please note that any distribution, forwarding, copying or use of this communication or the information in it is strictly prohibited. Any personal views expressed in this e-mail are those of the individual sender and G4Si does not endorse or accept responsibility for them. Prior to taking any action based upon this e-mail message, you should seek appropriate confirmation of its authenticity.

-

Please consider the environment before printing this email.
*********************************************************************
This communication may contain information which is confidential, personal and/or privileged. It is for the exclusive use of the intended recipient(s).
If you are not the intended recipient(s), please note that any distribution, forwarding, copying or use of this communication or the information in it is strictly prohibited. If you have received it in error please contact the sender immediately by return e-mail. Please then delete the e-mail and any copies of it and do not use or disclose its contents to any person.
Any personal views expressed in this e-mail are those of the individual sender and the company does not endorse or accept responsibility for them. Prior to taking any action based upon this e-mail message, you should seek appropriate confirmation of its authenticity.
This message has been checked for viruses on behalf of the company.
*********************************************************************


EOF