I'm replying to a very old thread (9 years ago) here http://grokbase.com/t/xapian/xapian-discuss/072tprmr6h/php5-query-parsing-bug So not sure if that's going to end up being more or less readable... I have this error : Fatal error: No matching function for overloaded 'new_Query' in /usr/share/php/xapian.php on line 2607 Line 2607 (and surrounding) looks like this and are in the __construct() of XapianQuery (with better indentation): """ switch (func_num_args()) { case 0: $this->_cPtr=new_Query(); break; case 1: $this->_cPtr=new_Query($copyme_or_tname__or_op__or_external_source_or_op); break; case 2: $this->_cPtr=new_Query($copyme_or_tname__or_op__or_external_source_or_op,$wqf__or_left_or_q_or_slot_or_subqs); break; case 3: $this->_cPtr=new_Query($copyme_or_tname__or_op__or_external_source_or_op,$wqf__or_left_or_q_or_slot_or_subqs,$pos__or_right_or_parameter_or_begin_or_value_or_param); break; default: $this->_cPtr=new_Query($copyme_or_tname__or_op__or_external_source_or_op,$wqf__or_left_or_q_or_slot_or_subqs,$pos__or_right_or_parameter_or_begin_or_value_or_param,$end); """ The patch suggested in the initial post is here: http://www.oligarchy.co.uk/xapian/patches/xapian-php5-query-ctor-overload-fix.patch But clearly, that's not going to do it now (it was adding a "case 1" to a single-standing "case 0", but now we've got 0, 1, 2, 3 and default). The error appear when trying to instanciate a new XapianQuery object with a query element: new XapianQuery($subquery); (from https://github.com/chamilo/chamilo-lms/blob/1.10.x/main/inc/lib/search/xapian/XapianQuery.php#L44 ) Honestly, I feel comfortable with PHP but this is one of these super-explicit messages that tend to send you in another direction than the one you should go. Assuming the message is correct, we overload an existing PHP function "new_Query()" by passing it a different number of parameters than what it expects. So 1) I can't find any php-defined new_Query(): http://php.net/manual-lookup.php?pattern=new_Query&lang=en&scope=404quickref 2) the new_Query() function in Xapian might have suddendly removed support for a case with one single parameter and not updated the binding accordingly? (that seems the most likely) That's where I start to be bad (looking at C++ code) Yannick
On Sat, Mar 26, 2016 at 07:21:23PM -0500, Yannick Warnier wrote:> I'm replying to a very old thread (9 years ago) here http://grokbase.com/t/xapian/xapian-discuss/072tprmr6h/php5-query-parsing-bugIt's a fairly safe bet that if you search for an error message and find a 9 year old message which says it's been fixed, you aren't hitting the same issue, but rather a different issue which gives the same error message.> The error appear when trying to instanciate a new XapianQuery object > with a query element: > > new XapianQuery($subquery);Their function doccomment says $extra is an array of arrays, so $subquery is an array. But the code fails to say what operator to use to combine the elements in that array, so the error you're getting seems correct to me. Their should be something like: $subqueries[] = new XapianQuery(XapianQuery::OP_AND, $subquery); Or maybe OP_OR - I'm not really sure what they are trying to do here. Presumably the developers of this software haven't tested cases where $extra is non-empty. Cheers, Olly
Le 26/03/16 21:16, Olly Betts a ?crit :> On Sat, Mar 26, 2016 at 07:21:23PM -0500, Yannick Warnier wrote: >> I'm replying to a very old thread (9 years ago) here http://grokbase.com/t/xapian/xapian-discuss/072tprmr6h/php5-query-parsing-bug > > It's a fairly safe bet that if you search for an error message and find > a 9 year old message which says it's been fixed, you aren't hitting the > same issue, but rather a different issue which gives the same error > message. > >> The error appear when trying to instanciate a new XapianQuery object >> with a query element: >> >> new XapianQuery($subquery); > > Their function doccomment says $extra is an array of arrays, so > $subquery is an array. But the code fails to say what operator to use > to combine the elements in that array, so the error you're getting seems > correct to me. > > Their should be something like: > > $subqueries[] = new XapianQuery(XapianQuery::OP_AND, $subquery); > > Or maybe OP_OR - I'm not really sure what they are trying to do here. > > Presumably the developers of this software haven't tested cases where > $extra is non-empty. > > Cheers, > Olly >Just to answer this temporarily: we've detected a series of changes required in our software and are making progress (not a top priority for us, so slowly making progress) towards a solution. Thanks for all the help! Yannick