Support » Plugins » [Plugin: Search Unleashed] problem after 2.7 upgrade

  • tubalreversal

    (@tubalreversal)


    I have just upgraded to wordpress 2.7 and am getting Warning: Missing argument 2 for mb_strlen() in /usr/home/blog/wp-content/plugins/search-unleashed/search-unleashed.php on line 698. Please advise.

Viewing 14 replies - 1 through 14 (of 14 total)
  • Editing search-unleashed.php and changing line 699 as follows temporarily works for me as I wait for the next update of the plugin.

    Find the line that goes:

    function mb_strlen ($str, $encoding)

    and replace it with:

    function mb_strlen ($str)

    I hope I am not breaking anything. But as I said, it’s a temp solution and it works for me.

    That variable checks the database to see the charset you have, ie UTF-8. Though the search may work fine for you if it disregards the setting, you possible haven’t set that option for your WordPress installation.

    Check your wp-config.php, is your charset set to utf8?

    Following line exists in my wp-config.php

    define('DB_CHARSET', 'utf8');

    If I don’t change the search-unleashed.php as I mentioned above, I cannot add or edit any posts. After the change however, I am able to post new entries and edit existing posts whose titles don’t exceed 30 characters or so… Wierd.

    My host is using PHP 4.4.7 still. I wonder if I am missing out on some important new PHP functionality.

    Thanks ‘doctorkaraca’ editing search-unleashed.php to function mb_strlen ($str) worked for me.

    We also have php version 4.4.7 and wp-admin/options-reading.php is set to UTF-8

    I may have spoken too soon i now see a similar error on the wp-admin/post.php page and have deactivated again.

    I tried
    function mb_strlen ($str, $encoding = “base64”)
    this got rid of the error on edit.php but it is still there on post.php

    =================STEP 1===================
    open the file search-unleashed.php (line 697-703 for v0.2.24),
    replace this:

    if (!function_exists ('mb_strlen'))
    {
    	function mb_strlen ($str, $encoding)
    	{
    		return strlen ($str);
    	}
    }

    with:

    if (!function_exists ('mb_strlen'))
    {
    	function mb_strlen1 ($str, $encoding)
    	{
    		return strlen ($str);
    	}
    }

    =================STEP 2===================
    then open the file models\search-unleashed.php (line 21 for v0.2.24),
    replace this:

    $this->first_match = mb_strlen ($this->text, get_option ('blog_charset'));

    with:

    if (!function_exists ('mb_strlen')){
    			$this->first_match = mb_strlen1 ($this->text, get_option ('blog_charset'));
    		}else{
    			$this->first_match = mb_strlen ($this->text, get_option ('blog_charset'));
    		}

    FOR THE STEP 1: if you want more exact, replace that with:

    if (!function_exists ('mb_strlen'))
    {
    	function mb_strlen1 ($str, $encoding) {
    		if ($encoding=='UTF-8') {
    			return preg_match_all('%(?:
    					  [\x09\x0A\x0D\x20-\x7E]           # ASCII
    					| [\xC2-\xDF][\x80-\xBF]            # non-overlong 2-byte
    					|  \xE0[\xA0-\xBF][\x80-\xBF]       # excluding overlongs
    					| [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte
    					|  \xED[\x80-\x9F][\x80-\xBF]       # excluding surrogates
    					|  \xF0[\x90-\xBF][\x80-\xBF]{2}    # planes 1-3
    					| [\xF1-\xF3][\x80-\xBF]{3}         # planes 4-15
    					|  \xF4[\x80-\x8F][\x80-\xBF]{2}    # plane 16
    					)%xs',$str,$out);
    		}else{
    			return strlen($str);
    		}
    	}
    }

    this problem is caused by the lack of mbstring module, so you can also install the mbstring module to solve the problem.

    tomchen1989 you are genius and my hero. Your instructions above works wonderfully. One minor thing,

    $this->first_match = mb_strlen ($this->text, get_option ('blog_charset'));

    is not in models\search-unleashed.php but in models\highlighter.php.

    Thanks a lot.

    oops, my mistake…:)

    Thanks guys works for me 🙂

    Love this search, but it’s causing problems with making posts. Posts save just fine, but I end up with a totally blank page with URL/wp-admin/post.php – no error message, just an empty page. Same thing when I edit a post – it changes, but I get a blank page.

    I tried the two changes suggested above by tomchen1989, it did not help.

    Nice catch tomchen1989. I used your fix interim.

    The author has since fixed this issue in version Version: 0.2.27. I was having the same problem and this version works for me.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘[Plugin: Search Unleashed] problem after 2.7 upgrade’ is closed to new replies.