Skip to content

Commit

Permalink
changed HtmlHelper::tag() just return $text when empty($name)
Browse files Browse the repository at this point in the history
  • Loading branch information
openam committed May 20, 2013
1 parent 12462b2 commit 0d082b5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php
Expand Up @@ -1697,6 +1697,12 @@ public function testTag() {

$result = $this->Html->tag(false, '<em>stuff</em>');
$this->assertEquals($result, '<em>stuff</em>');

$result = $this->Html->tag(null, '<em>stuff</em>');
$this->assertEquals($result, '<em>stuff</em>');

$result = $this->Html->tag('', '<em>stuff</em>');
$this->assertEquals($result, '<em>stuff</em>');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/View/Helper/HtmlHelper.php
Expand Up @@ -896,7 +896,7 @@ public function tableCells($data, $oddTrOptions = null, $evenTrOptions = null, $
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/html.html#HtmlHelper::tag
*/
public function tag($name, $text = null, $options = array()) {
if ($name === false) {
if (empty($name)) {
return $text;
}
if (is_array($options) && isset($options['escape']) && $options['escape']) {
Expand Down

0 comments on commit 0d082b5

Please sign in to comment.