summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2018-06-26 16:42:03 +0200
committerRemi Collet <remi@remirepo.net>2018-06-26 16:42:03 +0200
commit0919614fac290555955505c12344177087b505d2 (patch)
tree91dd209f30bd9d78bca257df3bf054b40f39583c
parent144b3ada1b5ceaf7f55371cdfc7c85dd4364364c (diff)
add patch for PHP 7.3 from https://github.com/pmjones/ext-request/pull/12
-rw-r--r--12.patch200
-rw-r--r--php-pecl-request.spec17
2 files changed, 212 insertions, 5 deletions
diff --git a/12.patch b/12.patch
new file mode 100644
index 0000000..137d367
--- /dev/null
+++ b/12.patch
@@ -0,0 +1,200 @@
+From 44f0132c6c1e3be2005f69403847983babf02357 Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Tue, 26 Jun 2018 16:19:39 +0200
+Subject: [PATCH 1/3] fix for PHP 7.3
+
+---
+ serverrequest.c | 20 +++++++++++++-------
+ 1 file changed, 13 insertions(+), 7 deletions(-)
+
+diff --git a/serverrequest.c b/serverrequest.c
+index 38ae8cb..ecf4f2c 100644
+--- a/serverrequest.c
++++ b/serverrequest.c
+@@ -645,6 +645,12 @@ static inline void server_request_set_forwarded(zval *object, zval *server)
+ }
+ }
+
++#if PHP_VERSION_ID < 70300
++#define URL_STR(a) (a)
++#else
++#define URL_STR(a) ZSTR_VAL(a)
++#endif
++
+ static inline void server_request_set_url(zval *object, zval *server)
+ {
+ zend_string *tmp;
+@@ -666,12 +672,12 @@ static inline void server_request_set_url(zval *object, zval *server)
+ // Form array
+ array_init_size(&arr, 8);
+ if( url->scheme ) {
+- add_assoc_string(&arr, "scheme", url->scheme);
++ add_assoc_string(&arr, "scheme", ZSTR_VAL(url->scheme));
+ } else {
+ add_assoc_null(&arr, "scheme");
+ }
+ if( url->host ) {
+- add_assoc_string(&arr, "host", url->host);
++ add_assoc_string(&arr, "host", ZSTR_VAL(url->host));
+ } else {
+ add_assoc_null(&arr, "host");
+ }
+@@ -681,27 +687,27 @@ static inline void server_request_set_url(zval *object, zval *server)
+ add_assoc_null(&arr, "port");
+ }
+ if( url->user ) {
+- add_assoc_string(&arr, "user", url->user);
++ add_assoc_string(&arr, "user", ZSTR_VAL(url->user));
+ } else {
+ add_assoc_null(&arr, "user");
+ }
+ if( url->pass ) {
+- add_assoc_string(&arr, "pass", url->pass);
++ add_assoc_string(&arr, "pass", ZSTR_VAL(url->pass));
+ } else {
+ add_assoc_null(&arr, "pass");
+ }
+ if( url->path ) {
+- add_assoc_string(&arr, "path", url->path);
++ add_assoc_string(&arr, "path", ZSTR_VAL(url->path));
+ } else {
+ add_assoc_null(&arr, "path");
+ }
+ if( url->query ) {
+- add_assoc_string(&arr, "query", url->query);
++ add_assoc_string(&arr, "query", ZSTR_VAL(url->query));
+ } else {
+ add_assoc_null(&arr, "query");
+ }
+ if( url->fragment ) {
+- add_assoc_string(&arr, "fragment", url->fragment);
++ add_assoc_string(&arr, "fragment", ZSTR_VAL(url->fragment));
+ } else {
+ add_assoc_null(&arr, "fragment");
+ }
+
+From 57cd28a80f971c8e21344c537c574a5f0e15d1b6 Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Tue, 26 Jun 2018 16:25:41 +0200
+Subject: [PATCH 2/3] fix -Wformat warnings
+
+---
+ serverrequest.c | 8 ++++----
+ serverresponse.c | 2 +-
+ 2 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/serverrequest.c b/serverrequest.c
+index ecf4f2c..d0f4f2f 100644
+--- a/serverrequest.c
++++ b/serverrequest.c
+@@ -418,7 +418,7 @@ static int server_request_is_immutable(zval *value)
+ static void server_request_assert_immutable(zval *value, const char *desc, size_t desc_len)
+ {
+ if( !server_request_is_immutable(value) ) {
+- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "All $%.*s values must be null, scalar, or array.", desc_len, desc);
++ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "All $%.*s values must be null, scalar, or array.", (int)desc_len, desc);
+ }
+ }
+ /* }}} */
+@@ -435,7 +435,7 @@ static inline void server_request_throw_readonly_exception(zval *object, zval *m
+ {
+ zend_string *ce_name = Z_OBJCE_P(object)->name;
+ zend_string *member_str = zval_get_string(member);
+- zend_throw_exception_ex(spl_ce_RuntimeException, 0, "%.*s::$%.*s is read-only.", ZSTR_LEN(ce_name), ZSTR_VAL(ce_name), ZSTR_LEN(member_str), ZSTR_VAL(member_str));
++ zend_throw_exception_ex(spl_ce_RuntimeException, 0, "%.*s::$%.*s is read-only.", (int)ZSTR_LEN(ce_name), ZSTR_VAL(ce_name), (int)ZSTR_LEN(member_str), ZSTR_VAL(member_str));
+ zend_string_release(member_str);
+ }
+ /* }}} */
+@@ -519,7 +519,7 @@ static zval *server_request_object_read_property(zval *object, zval *member, int
+ if( !Z_OBJCE_P(object)->__get && !std_object_handlers.has_property(object, member, 2, cache_slot) ) {
+ zend_string *ce_name = Z_OBJCE_P(object)->name;
+ zend_string *member_str = zval_get_string(member);
+- zend_throw_exception_ex(spl_ce_RuntimeException, 0, "%.*s::$%.*s does not exist.", ZSTR_LEN(ce_name), ZSTR_VAL(ce_name), ZSTR_LEN(member_str), ZSTR_VAL(member_str));
++ zend_throw_exception_ex(spl_ce_RuntimeException, 0, "%.*s::$%.*s does not exist.", (int)ZSTR_LEN(ce_name), ZSTR_VAL(ce_name), (int)ZSTR_LEN(member_str), ZSTR_VAL(member_str));
+ zend_string_release(member_str);
+ return rv;
+ }
+@@ -855,7 +855,7 @@ PHP_METHOD(ServerRequest, __construct)
+ init = zend_read_property(ServerRequest_ce_ptr, _this_zval, ZEND_STRL("_initialized"), 0, &rv);
+ if( zend_is_true(init) ) {
+ zend_string *ce_name = Z_OBJCE_P(_this_zval)->name;
+- zend_throw_exception_ex(spl_ce_RuntimeException, 0, "%.*s::__construct() called after construction.", ZSTR_LEN(ce_name), ZSTR_VAL(ce_name));
++ zend_throw_exception_ex(spl_ce_RuntimeException, 0, "%.*s::__construct() called after construction.", (int)ZSTR_LEN(ce_name), ZSTR_VAL(ce_name));
+ return;
+ }
+ zend_update_property_bool(ServerRequest_ce_ptr, _this_zval, ZEND_STRL("_initialized"), 1);
+diff --git a/serverresponse.c b/serverresponse.c
+index d332382..e2b3f04 100644
+--- a/serverresponse.c
++++ b/serverresponse.c
+@@ -585,7 +585,7 @@ static inline void throw_json_exception()
+
+ convert_to_string(&json_errmsg);
+ zend_throw_exception_ex(spl_ce_RuntimeException, zval_get_long(&json_errno),
+- "JSON encoding failed: %.*s", Z_STRLEN(json_errmsg), Z_STRVAL(json_errmsg));
++ "JSON encoding failed: %.*s", (int)Z_STRLEN(json_errmsg), Z_STRVAL(json_errmsg));
+
+ zval_ptr_dtor(&func_name);
+ zval_ptr_dtor(&json_errmsg);
+
+From f2f8a7b6e9085feaa726716895d955afdbc14a5b Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Tue, 26 Jun 2018 16:36:49 +0200
+Subject: [PATCH 3/3] typo
+
+---
+ serverrequest.c | 14 +++++++-------
+ 1 file changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/serverrequest.c b/serverrequest.c
+index d0f4f2f..c494112 100644
+--- a/serverrequest.c
++++ b/serverrequest.c
+@@ -672,12 +672,12 @@ static inline void server_request_set_url(zval *object, zval *server)
+ // Form array
+ array_init_size(&arr, 8);
+ if( url->scheme ) {
+- add_assoc_string(&arr, "scheme", ZSTR_VAL(url->scheme));
++ add_assoc_string(&arr, "scheme", URL_STR(url->scheme));
+ } else {
+ add_assoc_null(&arr, "scheme");
+ }
+ if( url->host ) {
+- add_assoc_string(&arr, "host", ZSTR_VAL(url->host));
++ add_assoc_string(&arr, "host", URL_STR(url->host));
+ } else {
+ add_assoc_null(&arr, "host");
+ }
+@@ -687,27 +687,27 @@ static inline void server_request_set_url(zval *object, zval *server)
+ add_assoc_null(&arr, "port");
+ }
+ if( url->user ) {
+- add_assoc_string(&arr, "user", ZSTR_VAL(url->user));
++ add_assoc_string(&arr, "user", URL_STR(url->user));
+ } else {
+ add_assoc_null(&arr, "user");
+ }
+ if( url->pass ) {
+- add_assoc_string(&arr, "pass", ZSTR_VAL(url->pass));
++ add_assoc_string(&arr, "pass", URL_STR(url->pass));
+ } else {
+ add_assoc_null(&arr, "pass");
+ }
+ if( url->path ) {
+- add_assoc_string(&arr, "path", ZSTR_VAL(url->path));
++ add_assoc_string(&arr, "path", URL_STR(url->path));
+ } else {
+ add_assoc_null(&arr, "path");
+ }
+ if( url->query ) {
+- add_assoc_string(&arr, "query", ZSTR_VAL(url->query));
++ add_assoc_string(&arr, "query", URL_STR(url->query));
+ } else {
+ add_assoc_null(&arr, "query");
+ }
+ if( url->fragment ) {
+- add_assoc_string(&arr, "fragment", ZSTR_VAL(url->fragment));
++ add_assoc_string(&arr, "fragment", URL_STR(url->fragment));
+ } else {
+ add_assoc_null(&arr, "fragment");
+ }
diff --git a/php-pecl-request.spec b/php-pecl-request.spec
index 4d129ed..90b5ba8 100644
--- a/php-pecl-request.spec
+++ b/php-pecl-request.spec
@@ -1,6 +1,6 @@
# remirepo spec file for php-pecl-request
#
-# Copyright (c) 2016-2017 Remi Collet
+# Copyright (c) 2016-2018 Remi Collet
# License: CC-BY-SA
# http://creativecommons.org/licenses/by-sa/4.0/
#
@@ -19,12 +19,14 @@
Summary: Server-side request and response objects
Name: %{?sub_prefix}php-pecl-%{pecl_name}
Version: 1.0.0
-Release: 0.7.%{prever}%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}
+Release: 0.8.%{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: https://patch-diff.githubusercontent.com/raw/pmjones/ext-request/pull/12.patch
+
+BuildRequires: %{?dtsprefix}gcc
BuildRequires: %{?scl_prefix}php-devel > 7
BuildRequires: %{?scl_prefix}php-pear
@@ -32,7 +34,7 @@ Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api}
Requires: %{?scl_prefix}php(api) = %{php_core_api}
Requires: %{?scl_prefix}php-spl%{?_isa}
Requires: %{?scl_prefix}php-date%{?_isa}
-%if 0%{?fedora} > 21
+%if 0%{?fedora} > 21 || 0%{?rhel} >= 8
Recommends: %{?scl_prefix}php-json%{?_isa}
%else
Requires: %{?scl_prefix}php-json%{?_isa}
@@ -100,6 +102,7 @@ sed -e 's/role="test"/role="src"/' \
-i package.xml
cd NTS
+%patch0 -p1 -b .pr12
# Sanity check, really often broken
extver=$(sed -n '/define PHP_REQUEST_VERSION/{s/.* "//;s/".*$//;p}' php_request.h)
@@ -169,7 +172,7 @@ do install -Dpm 644 $i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i
done
-%if 0%{?fedora} < 24
+%if 0%{?fedora} < 24 && 0%{?rhel} < 8
# when pear installed alone, after us
%triggerin -- %{?scl_prefix}php-pear
if [ -x %{__pecl} ] ; then
@@ -236,6 +239,10 @@ REPORT_EXIT_STATUS=1 \
%changelog
+* Tue Jun 26 2018 Remi Collet <remi@remirepo.net> - 1.0.0-0.8.b2
+- add patch for PHP 7.3 from
+ https://github.com/pmjones/ext-request/pull/12
+
* Tue Aug 1 2017 Remi Collet <remi@remirepo.net> - 1.0.0-0.7.b2
- update to 1.0.0b2 (beta)