[Xapian-devel] Objects in PHP4

Olly Betts olly at survex.com
Wed Sep 15 04:20:54 BST 2004

I've been looking at the PHP4 bindings, wondering why we don't have
"proper" objects.

Digging back through mail and CVS logs, it looks like I updated the
SWIG invocation for PHP from using "-shadow" to using "-noproxy" so
that it worked with newer versions of SWIG.  But that's wrong as the
switches have opposite meanings (and what was "-shadow" is now the
default).  Oops!

If I remove -noproxy, I can write object like code and it parses ok, but
this simple example causes a segfault:

$doc = new Document();

This fits with a mail from James a while back reporting that removing
"-noproxy" caused segfaults.

Some other small examples work.  The only thing that strikes me about
the above is that a default argument comes into play.  And if I add `,1'
after `"a"' it runs ok.

Here is where the segfault happens, in the wrapper for Document::add_term:


argbase is 1, as is expected for a method on an object I think.

I can't see what's going on, and it's way past my bedtime so I'm giving
up for now.

Incidentally, I've noticed we can probably easily add a "xapian_" prefix
to all the PHP wrappers by running the glue file through sed!


More information about the Xapian-devel mailing list