From 74792f634b44e0a995c0f20187b7b65fe3d3ac87 Mon Sep 17 00:00:00 2001 From: ADmad Date: Wed, 25 Apr 2018 22:52:48 +0530 Subject: [PATCH] Fix usage of 'escape' => false. --- src/View/Helper/HtmlHelper.php | 2 +- tests/TestCase/View/Helper/HtmlHelperTest.php | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/View/Helper/HtmlHelper.php b/src/View/Helper/HtmlHelper.php index ee8fbbdb094..730b3040c56 100644 --- a/src/View/Helper/HtmlHelper.php +++ b/src/View/Helper/HtmlHelper.php @@ -1096,7 +1096,7 @@ public function div($class = null, $text = null, array $options = []) */ public function para($class, $text, array $options = []) { - if (isset($options['escape'])) { + if (!empty($options['escape'])) { $text = h($text); } if ($class && !empty($class)) { diff --git a/tests/TestCase/View/Helper/HtmlHelperTest.php b/tests/TestCase/View/Helper/HtmlHelperTest.php index b527d279f38..8cec4c03259 100644 --- a/tests/TestCase/View/Helper/HtmlHelperTest.php +++ b/tests/TestCase/View/Helper/HtmlHelperTest.php @@ -2055,6 +2055,10 @@ public function testPara() $result = $this->Html->para('class-name', '', ['escape' => true]); $expected = ['p' => ['class' => 'class-name'], '<text>', '/p']; $this->assertHtml($expected, $result); + + $result = $this->Html->para('class-name', 'text"', ['escape' => false]); + $expected = ['p' => ['class' => 'class-name'], 'text"', '/p']; + $this->assertHtml($expected, $result); } /**