@@ -3163,7 +3163,7 @@ sdlPtr get_sdl(zval *this_ptr, char *uri, zend_long cache_wsdl)
3163
3163
char * old_error_code = SOAP_GLOBAL (error_code );
3164
3164
size_t uri_len = 0 ;
3165
3165
php_stream_context * context = NULL ;
3166
- zval * tmp , * proxy_host , * proxy_port , orig_context , new_context ;
3166
+ zval * tmp , orig_context , new_context ;
3167
3167
smart_str headers = {0 };
3168
3168
char * key = NULL ;
3169
3169
time_t t = time (0 );
@@ -3237,49 +3237,55 @@ sdlPtr get_sdl(zval *this_ptr, char *uri, zend_long cache_wsdl)
3237
3237
}
3238
3238
}
3239
3239
3240
- if (NULL != (tmp = zend_hash_str_find (Z_OBJPROP_P (this_ptr ),
3241
- "_stream_context" , sizeof ("_stream_context" )- 1 ))) {
3242
- context = php_stream_context_from_zval (tmp , 0 );
3243
- } else {
3244
- context = php_stream_context_alloc ();
3245
- }
3240
+ if (instanceof_function (Z_OBJCE_P (this_ptr ), soap_class_entry )) {
3241
+ tmp = Z_CLIENT_STREAM_CONTEXT_P (this_ptr );
3242
+ if (Z_TYPE_P (tmp ) == IS_RESOURCE ) {
3243
+ context = php_stream_context_from_zval (tmp , 0 );
3244
+ }
3246
3245
3247
- if ((tmp = zend_hash_str_find (Z_OBJPROP_P (this_ptr ), "_user_agent" , sizeof ("_user_agent" )- 1 )) != NULL &&
3248
- Z_TYPE_P (tmp ) == IS_STRING && Z_STRLEN_P (tmp ) > 0 ) {
3249
- smart_str_appends (& headers , "User-Agent: " );
3250
- smart_str_appends (& headers , Z_STRVAL_P (tmp ));
3251
- smart_str_appends (& headers , "\r\n" );
3252
- }
3246
+ tmp = Z_CLIENT_USER_AGENT_P (this_ptr );
3247
+ ZVAL_DEREF (tmp );
3248
+ if (Z_TYPE_P (tmp ) == IS_STRING && Z_STRLEN_P (tmp ) > 0 ) {
3249
+ smart_str_appends (& headers , "User-Agent: " );
3250
+ smart_str_appends (& headers , Z_STRVAL_P (tmp ));
3251
+ smart_str_appends (& headers , "\r\n" );
3252
+ }
3253
3253
3254
- if ((proxy_host = zend_hash_str_find (Z_OBJPROP_P (this_ptr ), "_proxy_host" , sizeof ("_proxy_host" )- 1 )) != NULL &&
3255
- Z_TYPE_P (proxy_host ) == IS_STRING &&
3256
- (proxy_port = zend_hash_str_find (Z_OBJPROP_P (this_ptr ), "_proxy_port" , sizeof ("_proxy_port" )- 1 )) != NULL &&
3257
- Z_TYPE_P (proxy_port ) == IS_LONG ) {
3258
- zval str_proxy ;
3259
- smart_str proxy = {0 };
3260
- smart_str_appends (& proxy ,"tcp://" );
3261
- smart_str_appends (& proxy ,Z_STRVAL_P (proxy_host ));
3262
- smart_str_appends (& proxy ,":" );
3263
- smart_str_append_long (& proxy ,Z_LVAL_P (proxy_port ));
3264
- smart_str_0 (& proxy );
3265
- ZVAL_NEW_STR (& str_proxy , proxy .s );
3254
+ zval * proxy_host = Z_CLIENT_PROXY_HOST_P (this_ptr );
3255
+ zval * proxy_port = Z_CLIENT_PROXY_PORT_P (this_ptr );
3256
+ ZVAL_DEREF (proxy_host );
3257
+ ZVAL_DEREF (proxy_port );
3258
+ if (Z_TYPE_P (proxy_host ) == IS_STRING && Z_TYPE_P (proxy_port ) == IS_LONG ) {
3259
+ zval str_proxy ;
3260
+ smart_str proxy = {0 };
3261
+ smart_str_appends (& proxy ,"tcp://" );
3262
+ smart_str_appends (& proxy ,Z_STRVAL_P (proxy_host ));
3263
+ smart_str_appends (& proxy ,":" );
3264
+ smart_str_append_long (& proxy ,Z_LVAL_P (proxy_port ));
3265
+ smart_str_0 (& proxy );
3266
+ ZVAL_NEW_STR (& str_proxy , proxy .s );
3266
3267
3267
- if (!context ) {
3268
- context = php_stream_context_alloc ();
3269
- }
3270
- php_stream_context_set_option (context , "http" , "proxy" , & str_proxy );
3271
- zval_ptr_dtor (& str_proxy );
3268
+ if (!context ) {
3269
+ context = php_stream_context_alloc ();
3270
+ }
3271
+ php_stream_context_set_option (context , "http" , "proxy" , & str_proxy );
3272
+ zval_ptr_dtor (& str_proxy );
3272
3273
3273
- if (uri_len < sizeof ("https://" )- 1 ||
3274
- strncasecmp (uri , "https://" , sizeof ("https://" )- 1 ) != 0 ) {
3275
- ZVAL_TRUE (& str_proxy );
3276
- php_stream_context_set_option (context , "http" , "request_fulluri" , & str_proxy );
3274
+ if (uri_len < sizeof ("https://" )- 1 ||
3275
+ strncasecmp (uri , "https://" , sizeof ("https://" )- 1 ) != 0 ) {
3276
+ ZVAL_TRUE (& str_proxy );
3277
+ php_stream_context_set_option (context , "http" , "request_fulluri" , & str_proxy );
3278
+ }
3279
+
3280
+ has_proxy_authorization = proxy_authentication (this_ptr , & headers );
3277
3281
}
3278
3282
3279
- has_proxy_authorization = proxy_authentication (this_ptr , & headers );
3283
+ has_authorization = basic_authentication (this_ptr , & headers );
3280
3284
}
3281
3285
3282
- has_authorization = basic_authentication (this_ptr , & headers );
3286
+ if (!context ) {
3287
+ context = php_stream_context_alloc ();
3288
+ }
3283
3289
3284
3290
/* Use HTTP/1.1 with "Connection: close" by default */
3285
3291
if ((tmp = php_stream_context_get_option (context , "http" , "protocol_version" )) == NULL ) {
0 commit comments