Recent Topics

Search Bug on _search.funcs.php

Started by on May 06, 2018 – Contents updated: Jun 25, 2018

May 06, 2018 15:41    


I have searched a name of a commenter.
In case I write "meggie" (lower case) I get an error message ( Warning: Division by zero in /blogs/inc/collections/_search.funcs.php on line 1015)
In case I write "Meggie" (first letter upper case) the search results work pretty.
So may be that the search has a case sensitive bug.

See fig. below.


May 07, 2018 09:29

because there is no commenter named "meggie". The bug happens only if you search a name of a person who commented a post and this person does really exist in you database (case sensitive).

May 08, 2018 17:19

So it has to be a commenter, yet both your handle and mine start with a lower case and the search here is fine. Am I missing something else??

Is it the_coll_search_form.widget.php you are using that calls the function or are you using some back office option that I don't know of?

May 08, 2018 17:58

You*re right; using the widget everything works fine; the bug shows up using the search in bricks_skin in the header.
I have to figure out, how to fix this.

the line, mentioned in the error message
Warning: Division by zero in /blogs/inc/collections/_search.funcs.php on line 1015
does not show any bug (in my eyes)
$display_params['percentage'] = round( $row['score'] * $max_percentage / $max_score );

Regards, Will

May 08, 2018 20:57

As the code looks OK it must be the $max_score as it's the only divisor.
Maybe you can you put an echo $max_score before that line and a die() command to see what the value is?

May 08, 2018 21:14

Thanks @amoun!
It now works, What was the fix (in case it was not fixed accidentally ;-): I edited and saved the Skin bricks_skin and deleted the search widget and reinstalled the widget, erased the cashes and: now search works as it is expected to work.

Regards, Will

Form is loading...

b2evolution CCMS – This forum is powered by b2evolution CMS, a complete engine for your website.