調べてみると、PHPには、これらのデータを自動的にエスケープする機能があり、デフォルトで有効になっているとのこと。
次のように設定を変更。
# vi /etc/php.ini
magic_quotes_gpc = Off
解決・・・かと思いきや、今度はPostfix Adminが動かなくなってしまった。
該当箇所を調べてみると、
/srv/www/htdocs/postfixadmin/functions.inc.php
function escape_string ($string)
{
global $CONF;
if (get_magic_quotes_gpc () == 0)
{
if ($CONF['database_type'] == "mysql")
$escaped_string = mysql_real_escape_string ($string);
if ($CONF['database_type'] == "mysqli")
$escaped_string = mysqli_real_escape_string ($string);
if ($CONF['database_type'] == "pgsql")
$escaped_string = pg_escape_string ($string);
}
else
{
$escaped_string = $string;
}
return $escaped_string;
}
はは〜ん、これは恐らく、DBにコネクト前にmysql_real_escape_string()を呼び出したエラーだな、とピンと来た。自分がよくやるので。
調べてみると、このバグは既に報告されていた。
#55 (function escape_string dont work if magic_quote_gpc is deactivated) - Postfix Admin - Trac
このページに倣って、以下のようにコードを2箇所、変更。
# vi /srv/www/htdocs/postfixadmin/functions.inc.php
function escape_string ($string)
{
global $CONF;
if (get_magic_quotes_gpc () == 0)
{
$link = db_connect ();
if ($CONF['database_type'] == "mysql")
$escaped_string = mysql_real_escape_string ($string);
if ($CONF['database_type'] == "mysqli")
$escaped_string = mysqli_real_escape_string ($link, $string);
if ($CONF['database_type'] == "pgsql")
$escaped_string = pg_escape_string ($string);
}
else
{
$escaped_string = $string;
}
return $escaped_string;
}
解決。
(追記)
<pre>タグ使うと、自動改行されなくなるのか・・・知らなかった。
上記のソースの適当なところで、改行を挿入。







