pecl-php Extension API version

Source: Internet
Author: User
Recently in writing a PHP extension.
There is a slight change in the internal iterator interface functions between the two versions, with the following differences:

{php-src}/Zend/zend_interface.c (in 5.3.X): ZEND_API void zend_user_it_get_current_key(zend_object_iterator *_iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC)----------------------------------------------------------------------------------{php-src}/Zend/zend_interface.c (in 5.4.X): ZEND_API void zend_user_it_get_current_key(zend_object_iterator *_iter, zval *key TSRMLS_DC)

This change is associated with the PHP version:

5.3---5.4

or associated with an extended version:

PHP Api Version:         20100412Zend Module Api No:      20100525Zend Extension Api No:   220100525----------------------------------PHP Api Version:         20090626Zend Module Api No:      20090626Zend Extension Api No:   220090626

How to adapt to different versions of the API?

Reply content:

Recently in writing a PHP extension.
There is a slight change in the internal iterator interface functions between the two versions, with the following differences:

{php-src}/Zend/zend_interface.c (in 5.3.X): ZEND_API void zend_user_it_get_current_key(zend_object_iterator *_iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC)----------------------------------------------------------------------------------{php-src}/Zend/zend_interface.c (in 5.4.X): ZEND_API void zend_user_it_get_current_key(zend_object_iterator *_iter, zval *key TSRMLS_DC)

This change is associated with the PHP version:

5.3---5.4

or associated with an extended version:

PHP Api Version:         20100412Zend Module Api No:      20100525Zend Extension Api No:   220100525----------------------------------PHP Api Version:         20090626Zend Module Api No:      20090626Zend Extension Api No:   220090626

How to adapt to different versions of the API?

At least from the source, and Zend_module_api_no, Zend_extension_api_no no relationship.
It's only php_api_version.

zend_interfaces.cThis inside of these several methods is defined by some userspace iterator interfaces.
Are you using the source code of the 5.4 Development branch? Because this function interface is changed to: Added support for Non-scalar Iterator keys in foreach.
However, this feature is only supported at 5.5, and the zend_user_it_get_current_key signature of this function in 5.4 has not changed before.

I think one way of doing this is to:

#if PHP_API_VERSION < 20120000#else#endif

But I've never stepped on it, don't blame me for a hole.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.