[Xapian-discuss] Segmentation fault using XapianDateValueRangeProcessor with php-bindings

Olly Betts olly at survex.com
Wed Sep 26 23:34:34 BST 2007


On Wed, Sep 26, 2007 at 02:32:24PM -0300, Sebastian wrote:
> $objParser->add_valuerangeprocessor( new XapianDateValueRangeProcessor(1) );

Rewrite this as:

  $vrp = new XapianDateValueRangeProcessor(1);
  $objParser->add_valuerangeprocessor( $vrp );

> The enquirer scripts hits a 'Segmentation fault' when issuing
> $objParser->parse_query(), with <query> 'example 20010101..20070101'.
> It runs OK any query with other words or phrases except a range...
> When I remove $objParser->add_valuerangeprocessor( ... ) it goes
> flawless.

The issue is with the object lifetime.  With your original code, the
PHP XapianDateValueRangeProcessor object is garbage collected after the
call to add_valuerangeprocessor, and the underlying C++ object deleted.

It's arguably a bug in the bindings, but I'd like to address it in the
C++ API because it's annoying there too.  We need to come up with a
different reference counting approach though, as the one we use for
most Xapian classes doesn't allow them to be subclassed by the user.

Cheers,
    Olly



More information about the Xapian-discuss mailing list