From 144b3ada1b5ceaf7f55371cdfc7c85dd4364364c Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 1 Aug 2017 09:26:38 +0200 Subject: v1.0.0b2 --- 0001-Use-IS_VOID-7.1-instead-of-IS_NULL.patch | 84 -------------- 0002-Fix-type-check-for-setContentDownload.patch | 57 ---------- 0003-fix-for-PHP-7.2.patch | 138 ----------------------- REFLECTION | 33 +++++- php-pecl-request.spec | 14 +-- 5 files changed, 35 insertions(+), 291 deletions(-) delete mode 100644 0001-Use-IS_VOID-7.1-instead-of-IS_NULL.patch delete mode 100644 0002-Fix-type-check-for-setContentDownload.patch delete mode 100644 0003-fix-for-PHP-7.2.patch 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 deleted file mode 100644 index 75c511a..0000000 --- a/0001-Use-IS_VOID-7.1-instead-of-IS_NULL.patch +++ /dev/null @@ -1,84 +0,0 @@ -From d4542bf4278386020f081c6a5ba8c3acfbe2c432 Mon Sep 17 00:00:00 2001 -From: Remi Collet -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 deleted file mode 100644 index aa3c7cf..0000000 --- a/0002-Fix-type-check-for-setContentDownload.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 309da4c0c107c0c32b500db53339fe266bd8b678 Mon Sep 17 00:00:00 2001 -From: John Boehr -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 deleted file mode 100644 index 1eb1daa..0000000 --- a/0003-fix-for-PHP-7.2.patch +++ /dev/null @@ -1,138 +0,0 @@ -From acaa9671bf73c609f65f42c12c50780d490d5e08 Mon Sep 17 00:00:00 2001 -From: Remi Collet -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/REFLECTION b/REFLECTION index e8de709..6e3269a 100644 --- a/REFLECTION +++ b/REFLECTION @@ -1,4 +1,4 @@ -Extension [ extension #123 request version 1.0.0b1 ] { +Extension [ extension #181 request version 1.0.0b2 ] { - Dependencies { Dependency [ spl (Required) ] @@ -145,15 +145,16 @@ Extension [ extension #123 request version 1.0.0b1 ] { - Static methods [0] { } - - Properties [5] { + - Properties [6] { Property [ protected $version ] Property [ protected $status ] Property [ protected $headers ] Property [ protected $cookies ] Property [ protected $content ] + Property [ protected $callbacks ] } - - Methods [22] { + - Methods [26] { Method [ public method __construct ] { - Parameters [0] { @@ -282,6 +283,26 @@ Extension [ extension #123 request version 1.0.0b1 ] { } } + Method [ public method addHeaderCallback ] { + + - Parameters [1] { + Parameter #0 [ callable $callback ] + } + } + + Method [ public method setHeaderCallbacks ] { + + - Parameters [1] { + Parameter #0 [ array $callbacks ] + } + } + + Method [ public method getHeaderCallbacks ] { + + - Parameters [0] { + } + } + Method [ public method date ] { - Parameters [1] { @@ -296,6 +317,12 @@ Extension [ extension #123 request version 1.0.0b1 ] { } } + Method [ protected method runHeaderCallbacks ] { + + - Parameters [0] { + } + } + Method [ protected method sendStatus ] { - Parameters [0] { diff --git a/php-pecl-request.spec b/php-pecl-request.spec index 64740b1..4d129ed 100644 --- a/php-pecl-request.spec +++ b/php-pecl-request.spec @@ -14,21 +14,17 @@ %global pecl_name request %global with_zts 0%{!?_without_zts:%{?__ztsphp:1}} %global ini_name 40-%{pecl_name}.ini -%global prever b1 +%global prever b2 Summary: Server-side request and response objects Name: %{?sub_prefix}php-pecl-%{pecl_name} Version: 1.0.0 -Release: 0.6.%{prever}%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} +Release: 0.7.%{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 @@ -104,9 +100,6 @@ 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) @@ -243,6 +236,9 @@ REPORT_EXIT_STATUS=1 \ %changelog +* Tue Aug 1 2017 Remi Collet - 1.0.0-0.7.b2 +- update to 1.0.0b2 (beta) + * Tue Jul 18 2017 Remi Collet - 1.0.0-0.6.b1 - rebuild for PHP 7.2.0beta1 new API -- cgit