1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
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");
}
|