您的位置:首页 > 其它

啦啦啦,今天发现discuzx的一个真正意义上的BUG!!!

2011-11-03 10:53 204 查看
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的第一个参数只能接受[b]40066个字节的字符串,否则将出现“Warning: preg_match(): Compilation failed: regular expression is too large at offset 40066
in E:\www\test\test.php on line 6”,但对于一些大站来讲,这40066个字节是远远不够用的,因此我改如上。当然,一般的小站肯定是不会碰到这种问题的啦,呵呵...[/b]
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: