Skip to content

Commit a05a3a0

Browse files
committed
Fixed bug #60887 (SoapClient ignores user_agent option and sends no User-Agent header)
1 parent e182aee commit a05a3a0

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

NEWS

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@ PHP NEWS
4141

4242
- PHP-FPM SAPI:
4343
. Fixed bug #60811 (php-fpm compilation problem). (rasmus)
44-
44+
45+
- SOAP
46+
. Fixed bug #60887 (SoapClient ignores user_agent option and sends no
47+
User-Agent header). (carloschilazo at gmail dot com)
48+
4549
- SQLite3 extension:
4650
. Add createCollation() method. (Brad Dewar)
4751

ext/soap/php_sdl.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3259,6 +3259,13 @@ sdlPtr get_sdl(zval *this_ptr, char *uri, long cache_wsdl TSRMLS_DC)
32593259
context = php_stream_context_alloc();
32603260
}
32613261

3262+
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_user_agent", sizeof("_user_agent"), (void **) &tmp) == SUCCESS &&
3263+
Z_TYPE_PP(tmp) == IS_STRING && Z_STRLEN_PP(tmp) > 0) {
3264+
smart_str_appends(&headers, "User-Agent: ");
3265+
smart_str_appends(&headers, Z_STRVAL_PP(tmp));
3266+
smart_str_appends(&headers, "\r\n");
3267+
}
3268+
32623269
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_proxy_host", sizeof("_proxy_host"), (void **) &proxy_host) == SUCCESS &&
32633270
Z_TYPE_PP(proxy_host) == IS_STRING &&
32643271
zend_hash_find(Z_OBJPROP_P(this_ptr), "_proxy_port", sizeof("_proxy_port"), (void **) &proxy_port) == SUCCESS &&

0 commit comments

Comments
 (0)