[Xapian-tickets] [Xapian] #520: TermIterator::get_term() can fault (core dump with php bindings on windows)
Xapian
nobody at xapian.org
Mon Dec 13 12:15:21 GMT 2010
#520: TermIterator::get_term() can fault (core dump with php bindings on windows)
-----------------------------------+----------------------------------------
Reporter: Daniel.Menard | Owner:
Type: defect | Status: new
Priority: normal | Milestone: 1.2.x
Component: Xapian-bindings (PHP) | Version: 1.2.3
Severity: minor | Keywords:
Blockedby: | Platform: All
Blocking: |
-----------------------------------+----------------------------------------
Changes (by olly):
* platform: Microsoft Windows => All
* milestone: => 1.2.x
Comment:
This behaviour is sort of expected. The semantics of C++ iterators are
that trying to dereference or advance them past the end position is
undefined behaviour, and PHP inherits this since it just puts a thin PHP
class wrapper around the C++ iterator classes.
The best fix for this would be to wrap the C++ iterator classes as PHP5
iterators, which would do away with the ugly equals() method and allow
looping over an iterator to be written as something like:
{{{
#!php
foreach ($db->allterms() as $it) {
echo $it->get_term(), ": ", $it->get_term_freq(), "\n";
}
}}}
At the time we sorted out the PHP5 wrappers, there were several approaches
from different people which emerged at about the same time. Paul Dixon's
included PHP5 iterator wrappers, and is described here:
http://blog.dixo.net/2006/04/04/xapian-php5-wrapper/
But the iterator wrappers part didn't get merged in back then.
I've just spent a while looking at adding these in, but annoyingly it's
not trivial to fit this in with how the SWIG generated wrappers work.
So I think for 1.2.4 I'll just document this issue, and this ticket can be
for implementing PHP5 iterators (trunk r15223, 1.0 branch r15224).
Marking as 1.2.x - we should be able to do this such that the existing
iterator wrappers continue to work, but we can mark these as deprecated
and remove them at some point.
--
Ticket URL: <http://trac.xapian.org/ticket/520#comment:1>
Xapian <http://xapian.org/>
Xapian
More information about the Xapian-tickets
mailing list