Skip to content

Commit

Permalink
Fix usage of 'escape' => false.
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Apr 25, 2018
1 parent 9aa5065 commit 74792f6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/View/Helper/HtmlHelper.php
Expand Up @@ -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)) {
Expand Down
4 changes: 4 additions & 0 deletions tests/TestCase/View/Helper/HtmlHelperTest.php
Expand Up @@ -2055,6 +2055,10 @@ public function testPara()
$result = $this->Html->para('class-name', '<text>', ['escape' => true]);
$expected = ['p' => ['class' => 'class-name'], '&lt;text&gt;', '/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);
}

/**
Expand Down

0 comments on commit 74792f6

Please sign in to comment.