[WordPress]htmlspecialchars_decode()エラーで投稿できない

2009 年 2 月 15 日

WordPress2.7.1のプラグイン「SyntaxHighlighte」でコードを表示するために[code=’php’]~[/code]のようなHTMLをタグを入力しようとすると次のようなエラーが発生して投稿どころかプレビューすらできない。。なぜ?

Warning: htmlspecialchars_decode() expects parameter 1 to be string, NULL given in ~

情報がないか探してみたけど国内でなかったので海外調べてみたところ、どうやらWordPressのバグのようです。

下記リンク先の方法でファイルを書き換えたところ問題解決!
http://core.trac.wordpress.org/ticket/9090

There is a variable name mismatch in the WordPress version of the function htmlspecialchars_decode (introduced in PHP5.1). Parameter 1 is $str, but the validation tests $string, and thus the function will never execute, because $string is always null and fails the test.

This is a regression because it broke the AZIndex plugin (version 0.7.5) when the “ignore characters” option was set for an index. It will also break any code, plugin, or theme that uses this function when running on PHP < 5.1.

The line in error is line 104 in wp-includes/compat.php:

if ( !is_scalar( $string ) ) {

should be

if ( !is_scalar( $str ) ) {

タグ: ,

コメントをどうぞ