[Xapian-discuss] php fatal error no matching for overloaded function Enquire_set_sort_by_key

Olly Betts olly at survex.com
Thu Apr 5 11:40:02 BST 2012

On Thu, Apr 05, 2012 at 03:57:40PM +0800, Xiao-Wei (Shawn) Xu wrote:
> Sample code :
> +                       $key = new XapianMultiValueKeyMaker();
> +                       $key->add_value(271, false);
> +                       $key->add_value(473, false);
> +                       $this->enquiryObject->set_sort_by_key($keymaker);

Are you aware you created $key but set $keymaker?

> This gives me the same error
> ( ! ) Fatal error: No matching function for overloaded
> 'Enquire_set_sort_by_key' in ...
> if I change the last line to:
> +                       $this->enquiryObject->set_sort_by_key($keymaker,
> false);
> then I see segmentation fault from apache error log, no response is served.

Sadly this isn't a script which I can use to reproduce the problem
though - the code to set up $this and $keymaker is missing.

If $keymaker vs $key is a typo, then the issue might be the lifetime of 
the XapianMultiValueKeyMaker object - you need to ensure this is valid
for as long as it might be used as currently the C++ reference to it
isn't tracked, e.g. by setting:

    $this->keymaker = $key;

Otherwise I don't know, and right now I don't have time to try to
reproduce the situation.  If you can't supply a self-contained script,
please open a ticket at: http://trac.xapian.org/


More information about the Xapian-discuss mailing list