[Xapian-tickets] [Xapian] #817: Add PHP 8 support
Xapian
nobody at xapian.org
Fri Jan 7 02:14:45 GMT 2022
#817: Add PHP 8 support
-----------------------------------+---------------------------
Reporter: Ryan Schmidt | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone:
Component: Xapian-bindings (PHP) | Version: 1.4.19
Severity: normal | Resolution:
Keywords: | Blocked By:
Blocking: | Operating System: All
-----------------------------------+---------------------------
Comment (by Olly Betts):
That error was new in 1.4.19, but in 1.4.18 you'd have got an obscure
compile error with PHP8 instead:
```
error: cannot initialize a parameter of type 'zend_object *' (aka
'_zend_object *') with an lvalue of type 'zval *' (aka '_zval_struct *')
```
This is because PHP's C API has changed a bit in PHP8. We need SWIG to
add support PHP8 - the current status is SWIG git master supports PHP8 but
this is not in a stable SWIG release yet.
However there have been major changes in how SWIG-generated PHP wrappers
work - instead of the generated .php script with class definitions,
classes are created from C/C++ code using PHP's C API. These changes are
definitely for the better as they fix a lot of problems with the old
approach and the new generated bindings should also be faster. However it
does mean updating our bindings is going to require more work than just
using a new SWIG version since currently we post-process the generated
wrapper script to add type declarations to function parameters and keep
references to set objects.
When https://github.com/swig/swig/issues/2027 is merged that will
automatically add type declarations for PHP8. I'm not sure what to do for
PHP7 though - the type declaration API is very different there (it had to
be reworked to allow PHP8 to support things like `int|object`). Perhaps
we just leave the PHP7 bindings as-is (and drop them in the next release
series - PHP7.4's EOL is only ~10 months away now). The awkward part is
that probably means we would need two different SWIG versions to generate
bindings for PHP7 and PHP8. Maybe we can post-process the generated C++
wrapper code to add them. Or perhaps just drop PHP7 support in the 1.4.x
release that adds PHP8 support and tell people who still want PHP7 support
to use the last 1.4.x xapian-bindings which had support.
I'm hoping we can deal with keeping references to set objects using custom
typemaps or maybe `%extend` but I've not tried yet.
Also https://github.com/swig/swig/issues/2125 really needs fixing.
So PHP8 support is coming, but it may be a while away yet I'm afraid.
--
Ticket URL: <https://trac.xapian.org/ticket/817#comment:1>
Xapian <https://xapian.org/>
Xapian
More information about the Xapian-tickets
mailing list