I've just been updating a Magento site, and I see one change in the base template files is that htmlEscape has become escapeHtml throughout. Is there any difference between these two functions?

Is it, as I suspect, that Magento are gradually getting rid of htmlEscape and we should no longer use it?


The answer is found in the class where it is defined: app/code/core/Mage/Core/Block/Abstract.php

So it seems that some time after version CE they decided that htmlEscape should be renamed to escapeHtml.

#File: app/code/core/Mage/Core/Block/Abstract.php
 * @deprecated after
 * @see self::escapeHtml()
public function htmlEscape($data, $allowedTags = null)
    return $this->escapeHtml($data, $allowedTags);

 * Escape html entities
 * @param   mixed $data
 * @param   array $allowedTags
 * @return  string
public function escapeHtml($data, $allowedTags = null)
    return $this->helper('core')->escapeHtml($data, $allowedTags);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.