Skip to content
Permalink
Browse files

[core:func] correction for PHP < 5.3.2 (htmlspecialchars)

PHP 5.3.2 未満の環境で、Wiki ページが正常に表示されなくなっていた問題の修正。
  • Loading branch information
nao-pon committed Oct 25, 2013
1 parent 1993610 commit c30b0cbdd3de65efc4ee596e580b779101bcdf72
Showing with 13 additions and 1 deletion.
  1. +13 −1 xoops_trust_path/modules/xpwiki/class/func/xpwiki_func.php
@@ -1486,6 +1486,10 @@ function unhtmlspecialchars ($str, $quote_style = ENT_COMPAT) {

// htmlspecialchars compat to PHP <= 5.3
function htmlspecialchars ($str, $flags = ENT_COMPAT, $encoding = null, $double_encode = true) {
static $php523 = null;
if (is_null($php523)) {
$php523 = version_compare(PHP_VERSION, '5.2.3', '>=');
}
if (is_null($encoding)) {
$encoding = $this->cont['CONTENT_CHARSET'];
switch ($encoding) {
@@ -1495,7 +1499,15 @@ function htmlspecialchars ($str, $flags = ENT_COMPAT, $encoding = null, $double_
break;
}
}
return htmlspecialchars($str, $flags, $encoding, $double_encode);
if ($php523) {
return htmlspecialchars($str, $flags, $encoding, $double_encode);
} else {
$ret = htmlspecialchars($str, $flags, $encoding);
if (! $double_encode) {
$ret = str_replace('&amp;amp;', '&amp;', $ret);
}
return $ret;
}
}

// ページ頭文字読みの配列を取得

0 comments on commit c30b0cb

Please sign in to comment.
You can’t perform that action at this time.