反馈子比的一个bug-zibll综合交流社区-zibll子比主题-WordPress主题模板-zibll子比主题

反馈子比的一个bug

情况是这样,用搜索功能发送一个数组请求。

类似于这样:
https://你的域名/?s=1&type[]=post
和这样:
https://你的域名/?s=1&type=post&trem[]=4

会分别返回:

Warning: strip_tags() expects parameter 1 to be string, array given in /www/wwwroot/你的域名/wp-content/themes/zibll/inc/functions/zib-search.php on line 685
Warning: trim() expects parameter 1 to be string, array given in /www/wwwroot/你的域名/wp-content/themes/zibll/inc/functions/bbs/inc/class.init.php on line 157
Warning: strip_tags() expects parameter 1 to be string, array given in /www/wwwroot/你的域名/wp-content/themes/zibll/search.php on line 10

 

我大概找到问题所在:因为trim() 函数的参数 $string 必须是字符串。

所以我们可以这样改动这三个文件的代码:
zib-search.php:

function zib_save_search_type()
{
    $type = '';
    if (isset($_REQUEST['type'])) {
        if (is_string($_REQUEST['type'])) {
            $type = trim(strip_tags($_REQUEST['type']));
        } elseif (is_array($_REQUEST['type'])) {
        }
    }
   
    $search_types = zib_get_search_types();


    if (!$type || !isset($search_types[$type])) {
        $type = _pz('search_type_in');


        if (!isset($search_types[$type])) {
            $type = 'post';
        }
    }
   
    $GLOBALS['search_type'] = $type;
}

 

class.init.php:

$cat = !empty($_REQUEST['trem']) ? (is_string($_REQUEST['trem']) ? trim($_REQUEST['trem']) : '') : '';

 

search.php:

         

$cat = !empty($_REQUEST['trem']) ? (is_string($_REQUEST['trem']) ? trim($_REQUEST['trem']) : '') : '';

 

以上的修改方式在我的网站上可行,期待老唐有更官方的解决方法awa

请登录后发表评论

    • 老糖的头像-WordPress主题模板-zibll子比主题代理会员老糖徽章-备受瞩目-WordPress主题模板-zibll子比主题等级-LV8-WordPress主题模板-zibll子比主题超级版主0
      • Exist的头像-WordPress主题模板-zibll子比主题代理会员Exist徽章-签到达人-WordPress主题模板-zibll子比主题等级-LV5-WordPress主题模板-zibll子比主题作者0