diff --git a/ext/curl/interface.c b/ext/curl/interface.c index 311b2f7cc8a59..072be226627f4 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -149,7 +149,7 @@ void _php_curl_verify_handlers(php_curl *ch, bool reporterror) /* {{{ */ ZEND_ASSERT(ch); if (!Z_ISUNDEF(ch->handlers.std_err)) { - stream = (php_stream *)zend_fetch_resource2_ex(&ch->handlers.std_err, NULL, php_file_le_stream(), php_file_le_pstream()); + php_stream_from_zval_no_verify(stream, &ch->handlers.std_err); if (stream == NULL) { if (reporterror) { 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) /* {{{ */ } } if (ch->handlers.read && !Z_ISUNDEF(ch->handlers.read->stream)) { - stream = (php_stream *)zend_fetch_resource2_ex(&ch->handlers.read->stream, NULL, php_file_le_stream(), php_file_le_pstream()); + php_stream_from_zval_no_verify(stream, &ch->handlers.read->stream); if (stream == NULL) { if (reporterror) { 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) /* {{{ */ } } if (ch->handlers.write_header && !Z_ISUNDEF(ch->handlers.write_header->stream)) { - stream = (php_stream *)zend_fetch_resource2_ex(&ch->handlers.write_header->stream, NULL, php_file_le_stream(), php_file_le_pstream()); + php_stream_from_zval_no_verify(stream, &ch->handlers.write_header->stream); if (stream == NULL) { if (reporterror) { 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) /* {{{ */ } } if (ch->handlers.write && !Z_ISUNDEF(ch->handlers.write->stream)) { - stream = (php_stream *)zend_fetch_resource2_ex(&ch->handlers.write->stream, NULL, php_file_le_stream(), php_file_le_pstream()); + php_stream_from_zval_no_verify(stream, &ch->handlers.write->stream); if (stream == NULL) { if (reporterror) { 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 php_stream *what = NULL; if (Z_TYPE_P(zvalue) != IS_NULL) { - what = (php_stream *)zend_fetch_resource2_ex(zvalue, "File-Handle", php_file_le_stream(), php_file_le_pstream()); + php_stream_from_zval_no_verify(what, zvalue); if (!what) { return FAILURE; } @@ -2466,7 +2466,7 @@ PHP_FUNCTION(curl_exec) if (!Z_ISUNDEF(ch->handlers.std_err)) { php_stream *stream; - stream = (php_stream*)zend_fetch_resource2_ex(&ch->handlers.std_err, NULL, php_file_le_stream(), php_file_le_pstream()); + php_stream_from_zval_no_verify(stream, &ch->handlers.std_err); if (stream) { php_stream_flush(stream); } diff --git a/main/php_streams.h b/main/php_streams.h index 80cb96951ee14..0f8ae5e8b1acf 100644 --- a/main/php_streams.h +++ b/main/php_streams.h @@ -282,8 +282,8 @@ END_EXTERN_C() return; \ } \ } while (0) -#define php_stream_from_res_no_verify(xstr, pzval) (xstr) = (php_stream*)zend_fetch_resource2((res), "stream", php_file_le_stream(), php_file_le_pstream()) -#define php_stream_from_zval_no_verify(xstr, pzval) (xstr) = (php_stream*)zend_fetch_resource2_ex((pzval), "stream", php_file_le_stream(), php_file_le_pstream()) +#define php_stream_from_res_no_verify(xstr, pzval) (xstr) = (php_stream*)zend_fetch_resource2((res), NULL, php_file_le_stream(), php_file_le_pstream()) +#define php_stream_from_zval_no_verify(xstr, pzval) (xstr) = (php_stream*)zend_fetch_resource2_ex((pzval), NULL, php_file_le_stream(), php_file_le_pstream()) BEGIN_EXTERN_C()