Skip to content

Commit 73cae48

Browse files
committed
ext/curl: Use stream helper macro to retrieve stream
1 parent 72dc45c commit 73cae48

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

ext/curl/interface.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ void _php_curl_verify_handlers(php_curl *ch, bool reporterror) /* {{{ */
149149
ZEND_ASSERT(ch);
150150

151151
if (!Z_ISUNDEF(ch->handlers.std_err)) {
152-
stream = (php_stream *)zend_fetch_resource2_ex(&ch->handlers.std_err, NULL, php_file_le_stream(), php_file_le_pstream());
152+
php_stream_from_zval_no_verify(stream, &ch->handlers.std_err);
153153
if (stream == NULL) {
154154
if (reporterror) {
155155
php_error_docref(NULL, E_WARNING, "CURLOPT_STDERR resource has gone away, resetting to stderr");
@@ -161,7 +161,7 @@ void _php_curl_verify_handlers(php_curl *ch, bool reporterror) /* {{{ */
161161
}
162162
}
163163
if (ch->handlers.read && !Z_ISUNDEF(ch->handlers.read->stream)) {
164-
stream = (php_stream *)zend_fetch_resource2_ex(&ch->handlers.read->stream, NULL, php_file_le_stream(), php_file_le_pstream());
164+
php_stream_from_zval_no_verify(stream, &ch->handlers.read->stream);
165165
if (stream == NULL) {
166166
if (reporterror) {
167167
php_error_docref(NULL, E_WARNING, "CURLOPT_INFILE resource has gone away, resetting to default");
@@ -175,7 +175,7 @@ void _php_curl_verify_handlers(php_curl *ch, bool reporterror) /* {{{ */
175175
}
176176
}
177177
if (ch->handlers.write_header && !Z_ISUNDEF(ch->handlers.write_header->stream)) {
178-
stream = (php_stream *)zend_fetch_resource2_ex(&ch->handlers.write_header->stream, NULL, php_file_le_stream(), php_file_le_pstream());
178+
php_stream_from_zval_no_verify(stream, &ch->handlers.write_header->stream);
179179
if (stream == NULL) {
180180
if (reporterror) {
181181
php_error_docref(NULL, E_WARNING, "CURLOPT_WRITEHEADER resource has gone away, resetting to default");
@@ -189,7 +189,7 @@ void _php_curl_verify_handlers(php_curl *ch, bool reporterror) /* {{{ */
189189
}
190190
}
191191
if (ch->handlers.write && !Z_ISUNDEF(ch->handlers.write->stream)) {
192-
stream = (php_stream *)zend_fetch_resource2_ex(&ch->handlers.write->stream, NULL, php_file_le_stream(), php_file_le_pstream());
192+
php_stream_from_zval_no_verify(stream, &ch->handlers.write->stream);
193193
if (stream == NULL) {
194194
if (reporterror) {
195195
php_error_docref(NULL, E_WARNING, "CURLOPT_FILE resource has gone away, resetting to default");
@@ -2035,7 +2035,7 @@ static zend_result _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue
20352035
php_stream *what = NULL;
20362036

20372037
if (Z_TYPE_P(zvalue) != IS_NULL) {
2038-
what = (php_stream *)zend_fetch_resource2_ex(zvalue, "File-Handle", php_file_le_stream(), php_file_le_pstream());
2038+
php_stream_from_zval_no_verify(what, zvalue);
20392039
if (!what) {
20402040
return FAILURE;
20412041
}
@@ -2466,7 +2466,7 @@ PHP_FUNCTION(curl_exec)
24662466

24672467
if (!Z_ISUNDEF(ch->handlers.std_err)) {
24682468
php_stream *stream;
2469-
stream = (php_stream*)zend_fetch_resource2_ex(&ch->handlers.std_err, NULL, php_file_le_stream(), php_file_le_pstream());
2469+
php_stream_from_zval_no_verify(stream, &ch->handlers.std_err);
24702470
if (stream) {
24712471
php_stream_flush(stream);
24722472
}

0 commit comments

Comments
 (0)