From 2fb744b532cee2589a8c810461c1e95f794e9057 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 26 Jun 2017 16:02:04 +0200 Subject: add patch for 7.2 --- 106.patch | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ php-pecl-yar.spec | 9 +++++++- 2 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 106.patch diff --git a/106.patch b/106.patch new file mode 100644 index 0000000..135575f --- /dev/null +++ b/106.patch @@ -0,0 +1,64 @@ +From 0562724d7f18d8332e7e11c65db65766102cba05 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Mon, 26 Jun 2017 15:33:29 +0200 +Subject: [PATCH] fix for 7.2 + +--- + yar_server.c | 20 ++++++++++++++++---- + 1 file changed, 16 insertions(+), 4 deletions(-) + +diff --git a/yar_server.c b/yar_server.c +index 6c01d81..e301030 100644 +--- a/yar_server.c ++++ b/yar_server.c +@@ -43,10 +43,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_service___construct, 0, 0, 1) + ZEND_ARG_INFO(0, protocol) + ZEND_END_ARG_INFO() + +-ZEND_BEGIN_ARG_INFO_EX(arginfo_service_set_packager, 0, 0, 1) +- ZEND_ARG_INFO(0, protocol) +-ZEND_END_ARG_INFO() +- + ZEND_BEGIN_ARG_INFO_EX(arginfo_service_void, 0, 0, 1) + ZEND_END_ARG_INFO() + /* }}} */ +@@ -147,6 +143,14 @@ static char * php_yar_get_function_declaration(zend_function *fptr) /* {{{ */ { + + required = fptr->common.required_num_args; + for (i = 0; i < fptr->common.num_args;) { ++#if PHP_VERSION_ID >= 70200 ++ if (ZEND_TYPE_IS_CLASS(arg_info->type)) { ++ const char *class_name; ++ uint32_t class_name_len; ++ zend_string *class_str = ZEND_TYPE_NAME(arg_info->type); ++ class_name = ZSTR_VAL(class_str); ++ class_name_len = ZSTR_LEN(class_str); ++#else + if (arg_info->class_name) { + const char *class_name; + uint32_t class_name_len; +@@ -157,6 +161,7 @@ static char * php_yar_get_function_declaration(zend_function *fptr) /* {{{ */ { + class_name = ZSTR_VAL(arg_info->class_name); + class_name_len = ZSTR_LEN(arg_info->class_name); + } ++#endif + if (strncasecmp(class_name, "self", sizeof("self")) && fptr->common.scope ) { + class_name = ZSTR_VAL(fptr->common.scope->name); + class_name_len = ZSTR_LEN(fptr->common.scope->name); +@@ -168,9 +173,16 @@ static char * php_yar_get_function_declaration(zend_function *fptr) /* {{{ */ { + memcpy(offset, class_name, class_name_len); + offset += class_name_len; + *(offset++) = ' '; ++ ++#if PHP_VERSION_ID >= 70200 ++ } else if (ZEND_TYPE_IS_CODE(arg_info->type)) { ++ uint32_t type_name_len; ++ char *type_name = zend_get_type_by_const(ZEND_TYPE_CODE(arg_info->type)); ++#else + } else if (arg_info->type_hint) { + uint32_t type_name_len; + char *type_name = zend_get_type_by_const(arg_info->type_hint); ++#endif + type_name_len = strlen(type_name); + REALLOC_BUF_IF_EXCEED(buf, offset, length, type_name_len); + memcpy(offset, type_name, type_name_len); diff --git a/php-pecl-yar.spec b/php-pecl-yar.spec index b202b97..bfc4561 100644 --- a/php-pecl-yar.spec +++ b/php-pecl-yar.spec @@ -34,13 +34,15 @@ Version: 2.0.2 Release: 0.11.%{gh_date}git%{gh_short}%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{pecl_name}-%{version}-%{gh_short}.tar.gz %else -Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} Source0: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz %endif License: PHP Group: Development/Languages URL: http://pecl.php.net/package/%{pecl_name} +Patch0: 106.patch + BuildRequires: curl-devel BuildRequires: %{?scl_prefix}php-devel > 7 BuildRequires: %{?scl_prefix}php-pear @@ -116,6 +118,7 @@ sed -e 's/role="test"/role="src"/' \ -i package2.xml cd NTS +%patch0 -p1 -b .pr106 # Sanity check, really often broken extver=$(sed -n '/#define PHP_YAR_VERSION/{s/.* "//;s/".*$//;p}' php_yar.h) @@ -275,6 +278,10 @@ export YAR_API_PORT=8964 %changelog +* Mon Jun 26 2017 Remi Collet - 2.0.2-2 +- add upstream patch for PHP 7.2 from + https://github.com/laruence/yar/pull/106 + * Wed Mar 15 2017 Remi Collet - 2.0.2-1 - Update to 2.0.2 -- cgit