@@ -511,9 +511,9 @@ int make_http_soap_request(zval *this_ptr,
511511 zend_string_equals (orig -> host , phpurl -> host ) &&
512512 orig -> port == phpurl -> port ))) {
513513 } else {
514+ ZVAL_NULL (Z_CLIENT_HTTPSOCKET_P (this_ptr ));
514515 php_stream_close (stream );
515516 convert_to_null (Z_CLIENT_HTTPURL_P (this_ptr ));
516- convert_to_null (Z_CLIENT_HTTPSOCKET_P (this_ptr ));
517517 convert_to_null (Z_CLIENT_USE_PROXY_P (this_ptr ));
518518 stream = NULL ;
519519 use_proxy = 0 ;
@@ -522,9 +522,9 @@ int make_http_soap_request(zval *this_ptr,
522522
523523 /* Check if keep-alive connection is still opened */
524524 if (stream != NULL && php_stream_eof (stream )) {
525+ ZVAL_NULL (Z_CLIENT_HTTPSOCKET_P (this_ptr ));
525526 php_stream_close (stream );
526527 convert_to_null (Z_CLIENT_HTTPURL_P (this_ptr ));
527- convert_to_null (Z_CLIENT_HTTPSOCKET_P (this_ptr ));
528528 convert_to_null (Z_CLIENT_USE_PROXY_P (this_ptr ));
529529 stream = NULL ;
530530 use_proxy = 0 ;
@@ -533,9 +533,7 @@ int make_http_soap_request(zval *this_ptr,
533533 if (!stream ) {
534534 stream = http_connect (this_ptr , phpurl , use_ssl , context , & use_proxy );
535535 if (stream ) {
536- php_stream_auto_cleanup (stream );
537- ZVAL_RES (Z_CLIENT_HTTPSOCKET_P (this_ptr ), stream -> res );
538- GC_ADDREF (stream -> res );
536+ php_stream_to_zval (stream , Z_CLIENT_HTTPSOCKET_P (this_ptr ));
539537 ZVAL_LONG (Z_CLIENT_USE_PROXY_P (this_ptr ), use_proxy );
540538 } else {
541539 php_url_free (phpurl );
@@ -555,7 +553,6 @@ int make_http_soap_request(zval *this_ptr,
555553 zval * cookies , * login , * password ;
556554 zend_resource * ret = zend_register_resource (phpurl , le_url );
557555 ZVAL_RES (Z_CLIENT_HTTPURL_P (this_ptr ), ret );
558- GC_ADDREF (ret );
559556
560557 if (context &&
561558 (tmp = php_stream_context_get_option (context , "http" , "protocol_version" )) != NULL &&
@@ -683,9 +680,9 @@ int make_http_soap_request(zval *this_ptr,
683680
684681 if (UNEXPECTED (php_random_bytes_throw (& nonce , sizeof (nonce )) != SUCCESS )) {
685682 ZEND_ASSERT (EG (exception ));
683+ ZVAL_NULL (Z_CLIENT_HTTPSOCKET_P (this_ptr ));
686684 php_stream_close (stream );
687685 convert_to_null (Z_CLIENT_HTTPURL_P (this_ptr ));
688- convert_to_null (Z_CLIENT_HTTPSOCKET_P (this_ptr ));
689686 convert_to_null (Z_CLIENT_USE_PROXY_P (this_ptr ));
690687 smart_str_free (& soap_headers_z );
691688 smart_str_free (& soap_headers );
@@ -901,9 +898,9 @@ int make_http_soap_request(zval *this_ptr,
901898 if (request != buf ) {
902899 zend_string_release_ex (request , 0 );
903900 }
901+ ZVAL_NULL (Z_CLIENT_HTTPSOCKET_P (this_ptr ));
904902 php_stream_close (stream );
905903 convert_to_null (Z_CLIENT_HTTPURL_P (this_ptr ));
906- convert_to_null (Z_CLIENT_HTTPSOCKET_P (this_ptr ));
907904 convert_to_null (Z_CLIENT_USE_PROXY_P (this_ptr ));
908905 add_soap_fault (this_ptr , "HTTP" , "Failed Sending HTTP SOAP request" , NULL , NULL );
909906 smart_str_free (& soap_headers_z );
@@ -919,8 +916,8 @@ int make_http_soap_request(zval *this_ptr,
919916 }
920917
921918 if (!return_value ) {
919+ ZVAL_NULL (Z_CLIENT_HTTPSOCKET_P (this_ptr ));
922920 php_stream_close (stream );
923- convert_to_null (Z_CLIENT_HTTPSOCKET_P (this_ptr ));
924921 convert_to_null (Z_CLIENT_USE_PROXY_P (this_ptr ));
925922 smart_str_free (& soap_headers_z );
926923 efree (http_msg );
@@ -933,8 +930,8 @@ int make_http_soap_request(zval *this_ptr,
933930 if (request != buf ) {
934931 zend_string_release_ex (request , 0 );
935932 }
933+ ZVAL_NULL (Z_CLIENT_HTTPSOCKET_P (this_ptr ));
936934 php_stream_close (stream );
937- convert_to_null (Z_CLIENT_HTTPSOCKET_P (this_ptr ));
938935 convert_to_null (Z_CLIENT_USE_PROXY_P (this_ptr ));
939936 add_soap_fault (this_ptr , "HTTP" , "Error Fetching http headers" , NULL , NULL );
940937 smart_str_free (& soap_headers_z );
@@ -1102,9 +1099,9 @@ int make_http_soap_request(zval *this_ptr,
11021099 if (request != buf ) {
11031100 zend_string_release_ex (request , 0 );
11041101 }
1102+ ZVAL_NULL (Z_CLIENT_HTTPSOCKET_P (this_ptr ));
11051103 php_stream_close (stream );
11061104 zend_string_release_ex (http_headers , 0 );
1107- convert_to_null (Z_CLIENT_HTTPSOCKET_P (this_ptr ));
11081105 convert_to_null (Z_CLIENT_USE_PROXY_P (this_ptr ));
11091106 add_soap_fault (this_ptr , "HTTP" , "Error Fetching http body, No Content-Length, connection closed or chunked data" , NULL , NULL );
11101107 if (http_msg ) {
@@ -1119,8 +1116,8 @@ int make_http_soap_request(zval *this_ptr,
11191116 }
11201117
11211118 if (http_close ) {
1119+ ZVAL_NULL (Z_CLIENT_HTTPSOCKET_P (this_ptr ));
11221120 php_stream_close (stream );
1123- convert_to_null (Z_CLIENT_HTTPSOCKET_P (this_ptr ));
11241121 convert_to_null (Z_CLIENT_USE_PROXY_P (this_ptr ));
11251122 stream = NULL ;
11261123 }
0 commit comments