Nucleusの破壊的代入のバグ修正

アイテムの新規追加時にプラグインオプションが正しく保存されないというバグがあるのに今日気付いた。
2度目は正しく保存する・・・。
その心は・・・

Nucleus 3.24の日本語版PLUGIN.phpでの話し。

foreachのキーに破壊的代入を行って、バグってる。
phpの実装によって結果が異なるのだろうけれど。

その前に、このプラグインオプションの配列は酷すぎると思うよ?

// decide wether we are using the contextid of newContextid
/*
if ($newContextid !== 0) {
$contextid = $newContextid;
}
*/
if ($newContextid !== 0) {
$id = $newContextid;
} else {
$id = $contextid;
}


//trigger event PrePluginOptionsUpdate to give the plugin the
//possibility to change/validate the new value for the option
$manager->notify('PrePluginOptionsUpdate',array('context' => $o->ocontext, 'plugid' => $o->opid, 'optionname' => $o->oname, 'contextid' => $id, 'value' => &$value));
// delete the old value for the option
sql_query('DELETE FROM '.sql_table('plugin_option').' WHERE oid='.intval($oid).' AND ocontextid='.intval($id));

sql_query('INSERT INTO '.sql_table('plugin_option')." (oid, ocontextid, ovalue) VALUES (".intval($oid).",".intval($id).",'" . addslashes($value) . "')");

問題を発見するのに数時間か・・・この忙しいときに orz.

2007年02月26日:Generaladmin

Comments

コメント (0)

Add coments