diff --git a/e107_handlers/e_parse_class.php b/e107_handlers/e_parse_class.php
index 1138b40e1..cf6f311fc 100644
--- a/e107_handlers/e_parse_class.php
+++ b/e107_handlers/e_parse_class.php
@@ -5376,6 +5376,7 @@ return;
$html = str_replace(' ', '__E_PARSER_CLEAN_HTML_NON_BREAKING_SPACE__', $html); // prevent replacement of with spaces.
// Workaround for https://bugs.php.net/bug.php?id=76285
// Part 1 of 2
+ $html = str_replace("\r", "", $html); // clean out windows line-breaks.
$html = str_replace("\n", "__E_PARSER_CLEAN_HTML_LINE_BREAK__", $html);
$html = str_replace("{", "__E_PARSER_CLEAN_HTML_CURLY_OPEN__", $html);
$html = str_replace("}", "__E_PARSER_CLEAN_HTML_CURLY_CLOSED__", $html);
@@ -5527,14 +5528,13 @@ return;
{
$value = preg_replace('/^
]*>/', '', $value);
$value = str_replace("
", "", $value);
- $value = str_replace('
', PHP_EOL, $value);
-
+ $value = str_replace('
', "__E_PARSER_CLEAN_HTML_LINE_BREAK__", $value);
}
elseif($node->nodeName === 'code')
{
$value = preg_replace('/^]*>/', '', $value);
$value = str_replace("
", "", $value);
- $value = str_replace("
", PHP_EOL, $value);
+ $value = str_replace("
", "__E_PARSER_CLEAN_HTML_LINE_BREAK__", $value);
}
$value = str_replace('__E_PARSER_CLEAN_HTML_CURLY_OPEN__', '{{{', $value); // temporarily change {e_XXX} to {{{e_XXX}}}
diff --git a/e107_tests/tests/unit/e_parseTest.php b/e107_tests/tests/unit/e_parseTest.php
index 74d07db25..e436e4891 100644
--- a/e107_tests/tests/unit/e_parseTest.php
+++ b/e107_tests/tests/unit/e_parseTest.php
@@ -64,6 +64,20 @@ TMP;
$expected = "";
$this->assertEquals($expected, $actual, "BBcode parsing failed on [img]");
+/*
+$src = "[html]
+$sql = e107::getDb();
+$sql->select('tablename', 'field1, field2', 'field_id = 1');
+while($row = $sql->fetch())
+{
+ echo $row['field1'];
+}
+[/html]";
+
+ $actual = $this->tp->toHTML($src,true);
+ $expected = '';
+
+ $this->assertEquals($expected, $actual, "BBcode parsing failed on ");*/
}
@@ -366,7 +380,11 @@ TMP;
'input' => "[html]function sc_my_shortcode(){\nreturn \"Something\";}
[/html]",
'expected' => "[html]function sc_my_shortcode(){\nreturn "Something";}
[/html]"
),
-
+ 27 => array(
+ 'input' =>"[html]require_once(\"class2.php\");\nrequire_once(HEADERF);\necho \"test\";<br>\nrequire_once(FOOTERF);
",
+ 'expected' =>"[html]require_once("class2.php");\nrequire_once(HEADERF);\necho "test";<br>\nrequire_once(FOOTERF);
",
+
+ ),
);
@@ -1030,16 +1048,44 @@ TMP;
public function testCleanHtml()
{
$tests = array(
- 0 => array('html' => "