diff options
-rw-r--r-- | .gitignore | 7 | ||||
-rw-r--r-- | 0001-Use-IS_VOID-7.1-instead-of-IS_NULL.patch | 84 | ||||
-rw-r--r-- | 0002-Fix-type-check-for-setContentDownload.patch | 57 | ||||
-rw-r--r-- | 0003-fix-for-PHP-7.2.patch | 138 | ||||
-rw-r--r-- | php-pecl-request.spec | 22 |
5 files changed, 307 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1ab5c4f --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +package-*.xml +*.tgz +*.tar.gz +*.tar.xz +*.tar.xz.asc +*.src.rpm +*/*rpm diff --git a/0001-Use-IS_VOID-7.1-instead-of-IS_NULL.patch b/0001-Use-IS_VOID-7.1-instead-of-IS_NULL.patch new file mode 100644 index 0000000..75c511a --- /dev/null +++ b/0001-Use-IS_VOID-7.1-instead-of-IS_NULL.patch @@ -0,0 +1,84 @@ +From d4542bf4278386020f081c6a5ba8c3acfbe2c432 Mon Sep 17 00:00:00 2001 +From: Remi Collet <remi@remirepo.net> +Date: Thu, 15 Jun 2017 08:36:02 +0200 +Subject: [PATCH 1/3] Use IS_VOID (7.1+) instead of IS_NULL + +--- + serverresponse.c | 20 ++++++++++---------- + 1 file changed, 10 insertions(+), 10 deletions(-) + +diff --git a/serverresponse.c b/serverresponse.c +index 5e013a5..2e912f7 100644 +--- a/serverresponse.c ++++ b/serverresponse.c +@@ -34,14 +34,14 @@ ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(AI(getVersion), 0, 0, IS_STRING, NULL, 0) + ZEND_END_ARG_INFO() + +-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(AI(setVersion), 0, 1, IS_NULL, NULL, 0) ++ZEND_BEGIN_ARG_INFO_EX(AI(setVersion), 0, 0, 1) + ZEND_ARG_TYPE_INFO(0, version, IS_STRING, 0) + ZEND_END_ARG_INFO() + +-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(AI(getStatus), 0, 0, IS_LONG, NULL, 0) ++ZEND_BEGIN_ARG_INFO_EX(AI(getStatus), 0, 0, 0) + ZEND_END_ARG_INFO() + +-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(AI(setStatus), 0, 1, IS_NULL, NULL, 0) ++ZEND_BEGIN_ARG_INFO_EX(AI(setStatus), 0, 0, 1) + ZEND_ARG_TYPE_INFO(0, status, IS_LONG, 0) + ZEND_END_ARG_INFO() + +@@ -51,7 +51,7 @@ ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(AI(getHeaders), 0, 0, IS_ARRAY, NULL, 0) + ZEND_END_ARG_INFO() + +-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(AI(addSetHeader), 0, 2, IS_NULL, NULL, 0) ++ZEND_BEGIN_ARG_INFO_EX(AI(addSetHeader), 0, 0, 2) + ZEND_ARG_TYPE_INFO(0, label, IS_STRING, 0) + ZEND_ARG_INFO(0, value) + ZEND_END_ARG_INFO() +@@ -59,7 +59,7 @@ ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(AI(getCookies), 0, 0, IS_ARRAY, NULL, 0) + ZEND_END_ARG_INFO() + +-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(AI(setCookie), 0, 1, IS_NULL, NULL, 0) ++ZEND_BEGIN_ARG_INFO_EX(AI(setCookie), 0, 0, 1) + ZEND_ARG_INFO(0, name) + ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, expires, IS_LONG, 0) +@@ -72,18 +72,18 @@ ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO_EX(AI(getContent), 0, 0, 0) + ZEND_END_ARG_INFO() + +-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(AI(setContent), 0, 1, IS_NULL, NULL, 0) ++ZEND_BEGIN_ARG_INFO_EX(AI(setContent), 0, 0, 1) + ZEND_ARG_INFO(0, content) + ZEND_END_ARG_INFO() + +-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(AI(setContentJson), 0, 1, IS_NULL, NULL, 0) ++ZEND_BEGIN_ARG_INFO_EX(AI(setContentJson), 0, 0, 1) + ZEND_ARG_INFO(0, content) + ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, depth, IS_LONG, 0) + ZEND_END_ARG_INFO() + +-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(AI(setContentDownload), 0, 1, IS_NULL, NULL, 0) +- ZEND_ARG_TYPE_INFO(0, fh, IS_RESOURCE, 0) ++ZEND_BEGIN_ARG_INFO_EX(AI(setContentDownload), 0, 0, 2) ++ ZEND_ARG_INFO(0, fh) + ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, disposition, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, params, IS_ARRAY, 0) +@@ -93,7 +93,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(AI(date), 0, 1, IS_STRING, NULL, 0) + ZEND_ARG_INFO(0, date) + ZEND_END_ARG_INFO() + +-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(AI(send), 0, 0, IS_NULL, NULL, 0) ++ZEND_BEGIN_ARG_INFO_EX(AI(send), 0, 0, 0) + ZEND_END_ARG_INFO() + /* }}} Argument Info */ + +-- +2.9.4 + diff --git a/0002-Fix-type-check-for-setContentDownload.patch b/0002-Fix-type-check-for-setContentDownload.patch new file mode 100644 index 0000000..aa3c7cf --- /dev/null +++ b/0002-Fix-type-check-for-setContentDownload.patch @@ -0,0 +1,57 @@ +From 309da4c0c107c0c32b500db53339fe266bd8b678 Mon Sep 17 00:00:00 2001 +From: John Boehr <jbboehr@gmail.com> +Date: Thu, 15 Jun 2017 11:25:52 -0700 +Subject: [PATCH 2/3] Fix type check for setContentDownload + +* Change exception thrown to InvalidArgumentException +--- + serverresponse.c | 8 +++++++- + tests/response/setContentDownload_notResource.phpt | 6 +----- + userland/src/ServerResponse.php | 2 +- + 3 files changed, 9 insertions(+), 7 deletions(-) + +diff --git a/serverresponse.c b/serverresponse.c +index 2e912f7..02853e1 100644 +--- a/serverresponse.c ++++ b/serverresponse.c +@@ -648,13 +648,19 @@ PHP_METHOD(ServerResponse, setContentDownload) + smart_str buf2 = {0}; + + ZEND_PARSE_PARAMETERS_START(2, 4) +- Z_PARAM_RESOURCE(zstream) ++ Z_PARAM_ZVAL(zstream) + Z_PARAM_STR(name) + Z_PARAM_OPTIONAL + Z_PARAM_STR(disposition) + Z_PARAM_ARRAY(params) + ZEND_PARSE_PARAMETERS_END(); + ++ // Check type of resource parameter ++ if( Z_TYPE_P(zstream) != IS_RESOURCE ) { ++ zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Argument 1 passed to ServerResponse::setContentDownload() must be of the type resource, string given"); ++ return; ++ } ++ + // Initialize params + if( !params || Z_TYPE_P(params) != IS_ARRAY ) { + params = &_params; +diff --git a/tests/response/setContentDownload_notResource.phpt b/tests/response/setContentDownload_notResource.phpt +index 1e9cb45..0688334 100644 +--- a/tests/response/setContentDownload_notResource.phpt ++++ b/tests/response/setContentDownload_notResource.phpt +@@ -14,11 +14,7 @@ json + $response = new ServerResponse(); + try { + $response->setContentDownload('not-a-resource', 'disposition'); +-} catch( TypeError $e ) { +- // php 7 (extension) +- var_dump($e->getMessage()); +-} catch( RuntimeException $e ) { +- // php 5 (userland) ++} catch( InvalidArgumentException $e ) { + var_dump($e->getMessage()); + } + --EXPECT-- +-- +2.9.4 + diff --git a/0003-fix-for-PHP-7.2.patch b/0003-fix-for-PHP-7.2.patch new file mode 100644 index 0000000..1eb1daa --- /dev/null +++ b/0003-fix-for-PHP-7.2.patch @@ -0,0 +1,138 @@ +From acaa9671bf73c609f65f42c12c50780d490d5e08 Mon Sep 17 00:00:00 2001 +From: Remi Collet <remi@remirepo.net> +Date: Mon, 26 Jun 2017 16:50:24 +0200 +Subject: [PATCH 3/3] fix for PHP 7.2 + +--- + php_request.h | 15 +++++++++++++++ + serverrequest.c | 18 +++++++++--------- + serverresponse.c | 10 +++++----- + 3 files changed, 29 insertions(+), 14 deletions(-) + +diff --git a/php_request.h b/php_request.h +index 3c3174e..0e39425 100644 +--- a/php_request.h ++++ b/php_request.h +@@ -8,6 +8,21 @@ + extern zend_module_entry request_module_entry; + #define phpext_request_ptr &request_module_entry + ++#if PHP_VERSION_ID >= 70200 ++ ++#define REQUEST_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX ++#define REQUEST_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX ++ ++#else ++ ++#define REQUEST_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(name, return_reference, required_num_args, type, allow_null) \ ++ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(name, return_reference, required_num_args, type, NULL, allow_null) ++ ++#define REQUEST_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(name, return_reference, required_num_args, classname, allow_null) \ ++ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(name, return_reference, required_num_args, IS_OBJECT, classname, allow_null) ++ ++#endif ++ + #endif /* PHP_REQUEST_H */ + + /* +diff --git a/serverrequest.c b/serverrequest.c +index 730c895..c6b549b 100644 +--- a/serverrequest.c ++++ b/serverrequest.c +@@ -55,40 +55,40 @@ ZEND_BEGIN_ARG_INFO_EX(ServerRequest_construct_args, 0, 0, 0) + ZEND_ARG_TYPE_INFO(0, globals, IS_ARRAY, 1) + ZEND_END_ARG_INFO() + +-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(ServerRequest_parseAccept_args, IS_ARRAY, NULL, 1) ++REQUEST_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ServerRequest_parseAccept_args, 0, 1, IS_ARRAY, 1) + ZEND_ARG_TYPE_INFO(0, header, IS_STRING, 0) + ZEND_END_ARG_INFO() + +-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(ServerRequest_parseContentType_args, IS_ARRAY, NULL, 1) ++REQUEST_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ServerRequest_parseContentType_args, 0, 1, IS_ARRAY, 1) + ZEND_ARG_TYPE_INFO(0, header, IS_STRING, 0) + ZEND_END_ARG_INFO() + +-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(ServerRequest_parseDigestAuth_args, IS_ARRAY, NULL, 1) ++REQUEST_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ServerRequest_parseDigestAuth_args, 0, 1, IS_ARRAY, 1) + ZEND_ARG_TYPE_INFO(0, header, IS_STRING, 0) + ZEND_END_ARG_INFO() + +-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(ServerRequest_withInput_args, IS_OBJECT, "ServerRequest", 0) ++REQUEST_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(ServerRequest_withInput_args, 0, 1, "ServerRequest", 0) + ZEND_ARG_INFO(0, input) + ZEND_END_ARG_INFO() + +-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(ServerRequest_withParam_args, IS_OBJECT, "ServerRequest", 0) ++REQUEST_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(ServerRequest_withParam_args, 0, 2, "ServerRequest", 0) + ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0) + ZEND_ARG_INFO(0, val) + ZEND_END_ARG_INFO() + +-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(ServerRequest_withParams_args, IS_OBJECT, "ServerRequest", 0) ++REQUEST_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(ServerRequest_withParams_args, 0, 1, "ServerRequest", 0) + ZEND_ARG_ARRAY_INFO(0, params, 0) + ZEND_END_ARG_INFO() + +-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(ServerRequest_withoutParam_args, IS_OBJECT, "ServerRequest", 0) ++REQUEST_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(ServerRequest_withoutParam_args, 0, 1, "ServerRequest", 0) + ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0) + ZEND_END_ARG_INFO() + +-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(ServerRequest_withoutParams_args, IS_OBJECT, "ServerRequest", 0) ++REQUEST_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(ServerRequest_withoutParams_args, 0, 1, "ServerRequest", 0) + ZEND_ARG_ARRAY_INFO(0, keys, 1) + ZEND_END_ARG_INFO() + +-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(ServerRequest_withUrl_args, IS_OBJECT, "ServerRequest", 0) ++REQUEST_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(ServerRequest_withUrl_args, 0, 1, "ServerRequest", 0) + ZEND_ARG_ARRAY_INFO(0, url, 0) + ZEND_END_ARG_INFO() + /* }}} Argument Info */ +diff --git a/serverresponse.c b/serverresponse.c +index 02853e1..72b5e59 100644 +--- a/serverresponse.c ++++ b/serverresponse.c +@@ -31,7 +31,7 @@ zend_class_entry * ServerResponse_ce_ptr; + ZEND_BEGIN_ARG_INFO_EX(AI(__construct), 0, 0, 0) + ZEND_END_ARG_INFO() + +-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(AI(getVersion), 0, 0, IS_STRING, NULL, 0) ++REQUEST_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(AI(getVersion), 0, 0, IS_STRING, 0) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(AI(setVersion), 0, 0, 1) +@@ -45,10 +45,10 @@ ZEND_BEGIN_ARG_INFO_EX(AI(setStatus), 0, 0, 1) + ZEND_ARG_TYPE_INFO(0, status, IS_LONG, 0) + ZEND_END_ARG_INFO() + +-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(AI(getHeader), 0, 0, IS_STRING, NULL, 1) ++REQUEST_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(AI(getHeader), 0, 0, IS_STRING, 1) + ZEND_END_ARG_INFO() + +-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(AI(getHeaders), 0, 0, IS_ARRAY, NULL, 0) ++REQUEST_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(AI(getHeaders), 0, 0, IS_ARRAY, 0) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(AI(addSetHeader), 0, 0, 2) +@@ -56,7 +56,7 @@ ZEND_BEGIN_ARG_INFO_EX(AI(addSetHeader), 0, 0, 2) + ZEND_ARG_INFO(0, value) + ZEND_END_ARG_INFO() + +-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(AI(getCookies), 0, 0, IS_ARRAY, NULL, 0) ++REQUEST_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(AI(getCookies), 0, 0, IS_ARRAY, 0) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(AI(setCookie), 0, 0, 1) +@@ -89,7 +89,7 @@ ZEND_BEGIN_ARG_INFO_EX(AI(setContentDownload), 0, 0, 2) + ZEND_ARG_TYPE_INFO(0, params, IS_ARRAY, 0) + ZEND_END_ARG_INFO() + +-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(AI(date), 0, 1, IS_STRING, NULL, 0) ++REQUEST_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(AI(date), 0, 1, IS_STRING, 0) + ZEND_ARG_INFO(0, date) + ZEND_END_ARG_INFO() + +-- +2.9.4 + diff --git a/php-pecl-request.spec b/php-pecl-request.spec index 4c58814..475f197 100644 --- a/php-pecl-request.spec +++ b/php-pecl-request.spec @@ -19,12 +19,16 @@ Summary: Server-side request and response objects Name: %{?sub_prefix}php-pecl-%{pecl_name} Version: 1.0.0 -Release: 0.4.%{prever}%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} +Release: 0.5.%{prever}%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} License: PHP Group: Development/Languages URL: http://pecl.php.net/package/%{pecl_name} Source0: http://pecl.php.net/get/%{pecl_name}-%{version}%{?prever}.tgz +Patch0: 0001-Use-IS_VOID-7.1-instead-of-IS_NULL.patch +Patch1: 0002-Fix-type-check-for-setContentDownload.patch +Patch2: 0003-fix-for-PHP-7.2.patch + BuildRequires: %{?scl_prefix}php-devel > 7 BuildRequires: %{?scl_prefix}php-pear @@ -56,6 +60,10 @@ Obsoletes: php70w-pecl-%{pecl_name} <= %{version} Obsoletes: php71u-pecl-%{pecl_name} <= %{version} Obsoletes: php71w-pecl-%{pecl_name} <= %{version} %endif +%if "%{php_version}" > "7.2" +Obsoletes: php72u-pecl-%{pecl_name} <= %{version} +Obsoletes: php72w-pecl-%{pecl_name} <= %{version} +%endif %endif %if 0%{?fedora} < 20 && 0%{?rhel} < 7 @@ -96,6 +104,10 @@ sed -e 's/role="test"/role="src"/' \ -i package.xml cd NTS +%patch0 -p1 -b .void +%patch1 -p1 -b .upstream +%patch2 -p1 -b .php72 + # Sanity check, really often broken extver=$(sed -n '/define PHP_REQUEST_VERSION/{s/.* "//;s/".*$//;p}' php_request.h) if test "x${extver}" != "x%{version}%{?prever}"; then @@ -117,6 +129,8 @@ EOF %build +%{?dtsenable} + cd NTS %{_bindir}/phpize %configure \ @@ -139,6 +153,8 @@ make %{?_smp_mflags} %install +%{?dtsenable} + make -C NTS install INSTALL_ROOT=%{buildroot} # install config file @@ -227,6 +243,10 @@ REPORT_EXIT_STATUS=1 \ %changelog +* Mon Jun 26 2017 Remi Collet <remi@fedoraproject.org> - 1.0.0-0.5.b1 +- add patch for reflection with 7.1 +- add patch for reflection with 7.2 + * Mon Dec 19 2016 Remi Collet <remi@fedoraproject.org> - 1.0.0-0.4.b1 - update to 1.0.0b1 (beta) |