Pecl-PHP extension API version

Source: Internet
Author: User
I am writing a PHP extension recently. it is found that the internal iterator interface functions of the two versions have some changes, the differences are as follows: {code ...} this change is associated with the PHP version: {code ...} still associated with extended version: {code ...} how can I adapt to different versions of Apis? I am writing a PHP extension recently.
It is found that the internal iterator interface functions of the two versions have some changes, the differences are as follows:

{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

Associated with the 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 can I adapt to different versions of Apis?

Reply content:

I am writing a PHP extension recently.
It is found that the internal iterator interface functions of the two versions have some changes, the differences are as follows:

{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

Associated with the 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 can I adapt to different versions of Apis?

At least from the source code, it does not matter with ZEND_MODULE_API_NO and ZEND_EXTENSION_API_NO.
It can only be PHP_API_VERSION.

zend_interfaces.cIn this example, some userspace iterator interfaces are defined.
Are you using the source code of the 5.4 Development Branch? This function interface is modified to: Added support for non-scalar Iterator keys in foreach.
However, this feature is supported only when it is 5.5.zend_user_it_get_current_keyThe signature of this function remains unchanged.

In my opinion, one way is:

#if PHP_API_VERSION < 20120000#else#endif

But I never step on it.

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.