bug位置function_core.php第2114行的ipbanned函數,估計是涉及到discuzx的所有版本啦:
function ipbanned($onlineip) {
global $_G;
if($_G['setting']['ipaccess'] && !ipaccess($onlineip, $_G['setting']['ipaccess'])) {
return TRUE;
}
loadcache('ipbanned');
if(empty($_G['cache']['ipbanned'])) {
return FALSE;
} else {
if($_G['cache']['ipbanned']['expiration'] < TIMESTAMP) {
require_once libfile('function/cache');
updatecache('ipbanned');
}
//modify by zhangwenbo at 2011-11-03 10:37
$onlineip = str_replace('.', '\\.', $onlineip);
if(strpos($_G['cache']['ipbanned']['regexp'], $onlineip) === false) {
return false;
}
return true;
//return preg_match("/^(".$_G['cache']['ipbanned']['regexp'].")$/", $onlineip);
}
}
錯誤原因:preg_match的第一個參數只能接受40066個字節的字符串,否則將出現“Warning: preg_match(): Compilation failed: regular expression is too large at offset 40066 in E:\www\test\test.php on line 6”,但對於一些大站來講,這40066個字節是遠遠不夠用的,因此我改如上。當然,一般的小站肯定是不會碰到這種問題的啦,呵呵...