Hello,
I'm currently looking into porting some extensions (both internal and
public) to PHP 8 while still keeping support for PHP 7 (for the public
ones) and PHP 5.6 (don't ask :-().
In many cases, I've been using the ZEND_ENGINE_3 define to handle the
PHP 5/7 difference.
Now, the Zend Engine version seems to have been increased to 4 (which
feels warranted given the zval* to zend_object* changes for object
handlers), but ZEND_ENGINE_3 is still defined whereas there's no
ZEND_ENGINE_4.
Is this something that might change or should I just use
PHP_VERSION_ID
comparisons to deal with the zval* to zend_object*
changes?
Philip
On Mon, Aug 10, 2020 at 7:57 AM Philip Hofstetter <
phofstetter@sensational.ch> wrote:
Hello,
I'm currently looking into porting some extensions (both internal and
public) to PHP 8 while still keeping support for PHP 7 (for the public
ones) and PHP 5.6 (don't ask :-().In many cases, I've been using the ZEND_ENGINE_3 define to handle the
PHP 5/7 difference.Now, the Zend Engine version seems to have been increased to 4 (which
feels warranted given the zval* to zend_object* changes for object
handlers), but ZEND_ENGINE_3 is still defined whereas there's no
ZEND_ENGINE_4.Is this something that might change or should I just use
PHP_VERSION_ID
comparisons to deal with the zval* to zend_object*
changes?Philip
I would recommend using PHP_VERSION_ID.
I have no idea why we have the ZEND_ENGINE_3 constant, but it seems like a
pretty bad idea. Now that we are at ZE 4, should we drop that constant --
and break all the code using it? Chances are that code guarded by
ZEND_ENGINE_3 is also needed on all versions of ZE going forward, not just
ZE 3 in particular. I think we should just leave teh ZEND_ENGINE_3 define
around, but make sure not to introduce a new one of that kind.
Regards,
Nikita
On Mon, Aug 10, 2020 at 7:57 AM Philip Hofstetter <
phofstetter@sensational.ch> wrote:In many cases, I've been using the ZEND_ENGINE_3 define to handle the
PHP 5/7 difference.Now, the Zend Engine version seems to have been increased to 4
I would recommend using PHP_VERSION_ID.
I have no idea why we have the ZEND_ENGINE_3 constant, but it seems like a
pretty bad idea. Now that we are at ZE 4, should we drop that constant --
and break all the code using it? Chances are that code guarded by
ZEND_ENGINE_3 is also needed on all versions of ZE going forward, not just
ZE 3 in particular. I think we should just leave teh ZEND_ENGINE_3 define
around, but make sure not to introduce a new one of that kind.
I agree that ZEND_ENGINE_n was always a weird constant, and IIRC we had the
7.x series export both ZEND_ENGINE_2 and ZEND_ENGINE_3. Not sure. (and the
fact I'm not sure is also telling).
This is probably much more expressive: #if PHP_VERSION_ID
>= 80000
If one really wants "Zend" versioning, you similarly could do: #if
ZEND_EXTENSION_API_NO >= 400000000
How many version indicators do we need?