Skip to content

Commit

Permalink
[core:func] correction for PHP < 5.3.2 (htmlspecialchars)
Browse files Browse the repository at this point in the history
PHP 5.3.2 未満の環境で、Wiki ページが正常に表示されなくなっていた問題の修正。
  • Loading branch information
nao-pon committed Oct 25, 2013
1 parent 1993610 commit c30b0cb
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion xoops_trust_path/modules/xpwiki/class/func/xpwiki_func.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
}
}

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

0 comments on commit c30b0cb

Please sign in to comment.