[Xapian-devel] More weirdness with PHP bindings

Charlie Hull charlie at juggler.net
Tue Apr 3 15:22:14 BST 2007


Hi all,

There's been a odd bug reported to us by Daniel Menard while working on 
the PHP bindings:

"I then tried to run the dotest target...All tests passed, except the 
one about get_matching_terms (smoketest.php line 94).
I added this line before the exit:
for ($i=0; $i<strlen($terms); $i++) echo $c=ord($terms[$i]), ' ', 
($c>31?$terms[$i]:''), "\n";
and it appears that the first letter of each term is replaced with a 
null char.I tried to run the same test in a debian box, and the test 
pass, so perhaps this is a windows-related problem (more on this below).

...[he then manages to get Xapian working in a real situation]...

I was surprised it works so well because my script also uses 
get_matching_terms, but it doesn't reproduce the bug above.
In fact, I don't use a "join(get_matching_terms())" as smoketest do, but 
iterate with get_matching_terms_begin and get_matching_terms_end.
Just by curiosity, I added the following lines in smoketest.php :
        $hit=$mset->get_hit(0);
        $it=$enq->get_matching_terms_begin($hit);
        while (! $it->equals($enq->get_matching_terms_end($hit)))
        {
            echo $it->get_term(), ' ';
            $it->next();
        }
and with that code, we get the correct terms. So the bug only concerns 
the way get_matching_terms is wrapped (and only appears under 
windows)... strange.
"

Anyway, I thought it might be worth raising in case anyone with a better 
knowledge of PHP might have a brainwave!


Cheers

Charlie



More information about the Xapian-devel mailing list