bug #13899 [Debug] deprecate protected ExceptionHandler::utf8Htmlize (nicolas-grekas)

This PR was merged into the 2.7 branch.

Discussion
----------

[Debug] deprecate protected ExceptionHandler::utf8Htmlize

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Commits
-------

132b3b1 [Debug] deprecate ExceptionHandler::utf8Htmlize
This commit is contained in:
Fabien Potencier 2015-03-12 15:33:21 +01:00
commit 0fc1e9f421
1 changed files with 3 additions and 10 deletions

View File

@ -413,19 +413,12 @@ EOF;
/**
* Returns an UTF-8 and HTML encoded string
*
* @deprecated since version 2.7, to be removed in 3.0.
*/
protected static function utf8Htmlize($str)
{
if (!preg_match('//u', $str) && function_exists('iconv')) {
set_error_handler('var_dump', 0);
$charset = ini_get('default_charset');
if ('UTF-8' === $charset || $str !== @iconv($charset, $charset, $str)) {
$charset = 'CP1252';
}
restore_error_handler();
$str = iconv($charset, 'UTF-8', $str);
}
trigger_error('The '.__METHOD__.' method is deprecated since version 2.7 and will be removed in 3.0.', E_USER_DEPRECATED);
return htmlspecialchars($str, ENT_QUOTES | (PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), 'UTF-8');
}