[Xapian-discuss] Why is a "DocNotFoundError" when deleting a document a Fatal error in php?

James Aylett james-xapian at tartarus.org
Fri Oct 28 09:37:08 BST 2005


On Fri, Oct 28, 2005 at 09:54:44AM +0200, Arjen van der Meijden wrote:

> It turns out that also working around the issue using something like 
> this won't work:
> 
> $doc = Database_get_document($database, $docId);
> if($doc != null)
> {
> 	WritableDatabase_delete_document($database, $docId);
> 	WritableDatabase_flush($database);
> }
> 
> The get_document appearantly also yields a fatal error. In php it is 
> common return false or null in a "it doesn't exist" case.

Common-ish - PHP is full of extensions that do strange things. I agree
that it shouldn't be fatal, but rather a warning (so it can be @-ed
out of existence in PHP's weird world). I note that
DocNotFoundException isn't mentioned in the bindings, however - we're
getting default behaviour, so it may be something that needs playing
with in SWIG. (Or is there a SWIG non-fatal equivalent of
SWIG_exception?)

I can't see why PHP5 shouldn't get this right, though. I'd expect
SWIG_exception to throw a PHP5 exception, although perhaps that needs
work in SWIG to do the right thing.

J

-- 
/--------------------------------------------------------------------------\
  James Aylett                                                  xapian.org
  james at tartarus.org                               uncertaintydivision.org



More information about the Xapian-discuss mailing list