@@ -511,9 +511,9 @@ int make_http_soap_request(zval *this_ptr,
511
511
zend_string_equals (orig -> host , phpurl -> host ) &&
512
512
orig -> port == phpurl -> port ))) {
513
513
} else {
514
+ ZVAL_NULL (Z_CLIENT_HTTPSOCKET_P (this_ptr ));
514
515
php_stream_close (stream );
515
516
convert_to_null (Z_CLIENT_HTTPURL_P (this_ptr ));
516
- convert_to_null (Z_CLIENT_HTTPSOCKET_P (this_ptr ));
517
517
convert_to_null (Z_CLIENT_USE_PROXY_P (this_ptr ));
518
518
stream = NULL ;
519
519
use_proxy = 0 ;
@@ -522,9 +522,9 @@ int make_http_soap_request(zval *this_ptr,
522
522
523
523
/* Check if keep-alive connection is still opened */
524
524
if (stream != NULL && php_stream_eof (stream )) {
525
+ ZVAL_NULL (Z_CLIENT_HTTPSOCKET_P (this_ptr ));
525
526
php_stream_close (stream );
526
527
convert_to_null (Z_CLIENT_HTTPURL_P (this_ptr ));
527
- convert_to_null (Z_CLIENT_HTTPSOCKET_P (this_ptr ));
528
528
convert_to_null (Z_CLIENT_USE_PROXY_P (this_ptr ));
529
529
stream = NULL ;
530
530
use_proxy = 0 ;
@@ -533,9 +533,7 @@ int make_http_soap_request(zval *this_ptr,
533
533
if (!stream ) {
534
534
stream = http_connect (this_ptr , phpurl , use_ssl , context , & use_proxy );
535
535
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 ));
539
537
ZVAL_LONG (Z_CLIENT_USE_PROXY_P (this_ptr ), use_proxy );
540
538
} else {
541
539
php_url_free (phpurl );
@@ -555,7 +553,6 @@ int make_http_soap_request(zval *this_ptr,
555
553
zval * cookies , * login , * password ;
556
554
zend_resource * ret = zend_register_resource (phpurl , le_url );
557
555
ZVAL_RES (Z_CLIENT_HTTPURL_P (this_ptr ), ret );
558
- GC_ADDREF (ret );
559
556
560
557
if (context &&
561
558
(tmp = php_stream_context_get_option (context , "http" , "protocol_version" )) != NULL &&
@@ -683,9 +680,9 @@ int make_http_soap_request(zval *this_ptr,
683
680
684
681
if (UNEXPECTED (php_random_bytes_throw (& nonce , sizeof (nonce )) != SUCCESS )) {
685
682
ZEND_ASSERT (EG (exception ));
683
+ ZVAL_NULL (Z_CLIENT_HTTPSOCKET_P (this_ptr ));
686
684
php_stream_close (stream );
687
685
convert_to_null (Z_CLIENT_HTTPURL_P (this_ptr ));
688
- convert_to_null (Z_CLIENT_HTTPSOCKET_P (this_ptr ));
689
686
convert_to_null (Z_CLIENT_USE_PROXY_P (this_ptr ));
690
687
smart_str_free (& soap_headers_z );
691
688
smart_str_free (& soap_headers );
@@ -901,9 +898,9 @@ int make_http_soap_request(zval *this_ptr,
901
898
if (request != buf ) {
902
899
zend_string_release_ex (request , 0 );
903
900
}
901
+ ZVAL_NULL (Z_CLIENT_HTTPSOCKET_P (this_ptr ));
904
902
php_stream_close (stream );
905
903
convert_to_null (Z_CLIENT_HTTPURL_P (this_ptr ));
906
- convert_to_null (Z_CLIENT_HTTPSOCKET_P (this_ptr ));
907
904
convert_to_null (Z_CLIENT_USE_PROXY_P (this_ptr ));
908
905
add_soap_fault (this_ptr , "HTTP" , "Failed Sending HTTP SOAP request" , NULL , NULL );
909
906
smart_str_free (& soap_headers_z );
@@ -919,8 +916,8 @@ int make_http_soap_request(zval *this_ptr,
919
916
}
920
917
921
918
if (!return_value ) {
919
+ ZVAL_NULL (Z_CLIENT_HTTPSOCKET_P (this_ptr ));
922
920
php_stream_close (stream );
923
- convert_to_null (Z_CLIENT_HTTPSOCKET_P (this_ptr ));
924
921
convert_to_null (Z_CLIENT_USE_PROXY_P (this_ptr ));
925
922
smart_str_free (& soap_headers_z );
926
923
efree (http_msg );
@@ -933,8 +930,8 @@ int make_http_soap_request(zval *this_ptr,
933
930
if (request != buf ) {
934
931
zend_string_release_ex (request , 0 );
935
932
}
933
+ ZVAL_NULL (Z_CLIENT_HTTPSOCKET_P (this_ptr ));
936
934
php_stream_close (stream );
937
- convert_to_null (Z_CLIENT_HTTPSOCKET_P (this_ptr ));
938
935
convert_to_null (Z_CLIENT_USE_PROXY_P (this_ptr ));
939
936
add_soap_fault (this_ptr , "HTTP" , "Error Fetching http headers" , NULL , NULL );
940
937
smart_str_free (& soap_headers_z );
@@ -1102,9 +1099,9 @@ int make_http_soap_request(zval *this_ptr,
1102
1099
if (request != buf ) {
1103
1100
zend_string_release_ex (request , 0 );
1104
1101
}
1102
+ ZVAL_NULL (Z_CLIENT_HTTPSOCKET_P (this_ptr ));
1105
1103
php_stream_close (stream );
1106
1104
zend_string_release_ex (http_headers , 0 );
1107
- convert_to_null (Z_CLIENT_HTTPSOCKET_P (this_ptr ));
1108
1105
convert_to_null (Z_CLIENT_USE_PROXY_P (this_ptr ));
1109
1106
add_soap_fault (this_ptr , "HTTP" , "Error Fetching http body, No Content-Length, connection closed or chunked data" , NULL , NULL );
1110
1107
if (http_msg ) {
@@ -1119,8 +1116,8 @@ int make_http_soap_request(zval *this_ptr,
1119
1116
}
1120
1117
1121
1118
if (http_close ) {
1119
+ ZVAL_NULL (Z_CLIENT_HTTPSOCKET_P (this_ptr ));
1122
1120
php_stream_close (stream );
1123
- convert_to_null (Z_CLIENT_HTTPSOCKET_P (this_ptr ));
1124
1121
convert_to_null (Z_CLIENT_USE_PROXY_P (this_ptr ));
1125
1122
stream = NULL ;
1126
1123
}
0 commit comments