Created
June 5, 2015 14:10
-
-
Save gplanchat/3fdc5176b5f6dd26160e to your computer and use it in GitHub Desktop.
PHP 5.5 patch for Magento 1.9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Mage_Core_Helper_Abstract | |
{ | |
//... | |
/** | |
* Remove html tags, but leave "<" and ">" signs | |
* | |
* @param string $html | |
* @return string | |
*/ | |
public function removeTags($html) | |
{ | |
/* | |
* [gplanchat] Updated code for PHP 5.5+ compatibility | |
* @see https://wiki.php.net/rfc/remove_preg_replace_eval_modifier | |
* {{{ | |
*/ | |
$html = preg_replace_callback('# <(?![/a-z]) | (?<=\\s)>(?![a-z]) #xi', function($matches){ | |
return htmlentities($matches[0]); | |
}, $html); | |
// }}} | |
$html = strip_tags($html); | |
return htmlspecialchars_decode($html); | |
} | |
//... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How we can use this patch?