[php-src] master: SoapClient: add new `keep_headers` option
| From: | Daniel Scherzer | Date: | Mon, 19 Oct 2026 22:35:10 +0000 |
| Subject: | [php-src] master: SoapClient: add new `keep_headers` option | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-142482@lists.php.net to get a copy of this message | ||
Author: Daniel Scherzer (DanielEScherzer)
Date: 2026-10-19T14:39:11-07:00
Commit: https://github.com/php/php-src/commit/68aa3372a15d836d7baaba93e1b15d364497f8fe
Raw diff: https://github.com/php/php-src/commit/68aa3372a15d836d7baaba93e1b15d364497f8fe.diff
SoapClient: add new
keep_headers option
Changed paths:
A ext/soap/tests/gh23686/import-keep-authorization.phpt
A ext/soap/tests/gh23686/import-keep-cookies.phpt
A ext/soap/tests/gh23686/import-keep-proxy-auth.phpt
A ext/soap/tests/gh23686/schema-keep-authorization.phpt
A ext/soap/tests/gh23686/schema-keep-cookies.phpt
A ext/soap/tests/gh23686/schema-keep-proxy-auth.phpt
M UPGRADING
M ext/soap/php_sdl.c
M ext/soap/php_sdl.h
M ext/soap/php_soap.h
M ext/soap/soap.c
M ext/soap/soap.stub.php
M ext/soap/soap_arginfo.h
M ext/soap/tests/bugs/gh21421.phpt
M ext/soap/tests/gh23686/check_headers.inc
M ext/soap/tests/gh23686/import-repeated-authorization.phpt
M ext/soap/tests/gh23686/import-repeated-cookies.phpt
M ext/soap/tests/gh23686/import-repeated-proxy-auth.phpt
M ext/soap/tests/gh23686/schema-repeated-authorization.phpt
M ext/soap/tests/gh23686/schema-repeated-cookies.phpt
M ext/soap/tests/gh23686/schema-repeated-proxy-auth.phpt
Diff:
diff --git a/UPGRADING b/UPGRADING
index d426f960abea..2d48a1da05ca 100644
--- a/UPGRADING
+++ b/UPGRADING
@@ -481,6 +481,14 @@ PHP 8.6 UPGRADE NOTES
SNMP::setStringOutputFormat() methods. (eskyuu)
RFC: https://wiki.php.net/rfc/snmp_improvements_2026#implement_more_mib_parsing_and_value_output_controls
+- SOAP:
+ . It is now possible to specify what headers a SoapClient should redact
+ when importing a WSDL from a host different from the original. The default
+ behavior is to redact the "Authorization", "Proxy-Authorization", and
+ "Cookie" headers. Use the 'keep_headers' key in the array of options passe
+ as the second argument to SoapClient::__construct() to specify which
+ headers should be kept.
+
- Standard:
. pack() and unpack() now accept the "<" and ">" endianness modifiers
on
the signed and unsigned integer format codes.
diff --git a/ext/soap/php_sdl.c b/ext/soap/php_sdl.c
index a2065cb0a815..69ab56169c40 100644
--- a/ext/soap/php_sdl.c
+++ b/ext/soap/php_sdl.c
@@ -358,6 +358,15 @@ void sdl_set_uri_credentials(sdlCtx *ctx, char *uri)
zend_string *lc_headers = zend_string_tolower(flat_headers);
// Fast path: no redaction needed
uint32_t redaction = header_needs_redaction(lc_headers);
+ if (ctx->headers_to_keep & WSDL_HEADER_KEEP_AUTHORIZATION) {
+ redaction &= ~REDACT_AUTHORIZATION;
+ }
+ if (ctx->headers_to_keep & WSDL_HEADER_KEEP_PROXY_AUTHORIZATION) {
+ redaction &= ~REDACT_PROXY_AUTH;
+ }
+ if (ctx->headers_to_keep & WSDL_HEADER_KEEP_COOKIES) {
+ redaction &= ~REDACT_COOKIE;
+ }
if (redaction == REDACT_NONE) {
zend_string_release(lc_headers);
zend_string_release(flat_headers);
@@ -863,6 +872,11 @@ static sdlPtr load_wsdl(zval *this_ptr, char *struri)
zend_hash_init(&ctx.portTypes, 0, NULL, NULL, 0);
zend_hash_init(&ctx.services, 0, NULL, NULL, 0);
+ ctx.headers_to_keep = 0;
+ if (instanceof_function(Z_OBJCE_P(this_ptr), soap_class_entry)) {
+ ctx.headers_to_keep = Z_LVAL_P(Z_CLIENT_KEEP_HEADERS_P(this_ptr));
+ }
+
zend_try {
load_wsdl_ex(this_ptr, struri, &ctx, false);
schema_pass2(&ctx);
diff --git a/ext/soap/php_sdl.h b/ext/soap/php_sdl.h
index 7249f094f165..b076285ebb60 100644
--- a/ext/soap/php_sdl.h
+++ b/ext/soap/php_sdl.h
@@ -74,6 +74,7 @@ typedef struct sdlCtx {
HashTable fixupInProgress;
php_stream_context *context;
zval old_header;
+ zend_long headers_to_keep; /* Bitmask of WSDL_HEADER_KEEP_* from php_soap.h */
} sdlCtx;
struct _sdlBinding {
diff --git a/ext/soap/php_soap.h b/ext/soap/php_soap.h
index d3c273615eb6..c067b633f488 100644
--- a/ext/soap/php_soap.h
+++ b/ext/soap/php_soap.h
@@ -151,6 +151,11 @@ struct _soapService {
#define SOAP_MAX_XML_DEPTH 2048
#define SOAP_MAX_DECODE_DEPTH (SOAP_MAX_XML_DEPTH * 2)
+/* Some headers are redacted on requests to other hosts unless requested otherwise */
+#define WSDL_HEADER_KEEP_AUTHORIZATION (1 << 0)
+#define WSDL_HEADER_KEEP_PROXY_AUTHORIZATION (1 << 1)
+#define WSDL_HEADER_KEEP_COOKIES (1 << 2)
+
ZEND_BEGIN_MODULE_GLOBALS(soap)
HashTable *typemap;
int cur_uniq_ns;
@@ -255,6 +260,7 @@ static zend_always_inline zval *php_soap_deref(zval *zv) {
#define Z_CLIENT_LAST_RESPONSE_P(zv) OBJ_PROP_NUM(Z_OBJ_P(zv), 32)
#define Z_CLIENT_LAST_REQUEST_HEADERS_P(zv) OBJ_PROP_NUM(Z_OBJ_P(zv), 33)
#define Z_CLIENT_LAST_RESPONSE_HEADERS_P(zv) OBJ_PROP_NUM(Z_OBJ_P(zv), 34)
+#define Z_CLIENT_KEEP_HEADERS_P(zv) OBJ_PROP_NUM(Z_OBJ_P(zv), 35)
typedef struct soap_url_object {
php_uri *uri;
diff --git a/ext/soap/soap.c b/ext/soap/soap.c
index 97a653955825..2dc6802310b0 100644
--- a/ext/soap/soap.c
+++ b/ext/soap/soap.c
@@ -2106,6 +2106,7 @@ PHP_METHOD(SoapClient, __construct)
sdlPtr sdl = NULL;
HashTable *typemap_ht = NULL;
zval *this_ptr = ZEND_THIS;
+ zend_long keep_headers = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S!|a", &wsdl, &options) == FAILURE)
{
RETURN_THROWS();
@@ -2303,6 +2304,26 @@ PHP_METHOD(SoapClient, __construct)
"The \"ssl_method\" option is deprecated. "
"Use \"ssl\" stream context options instead");
}
+
+ if ((tmp = zend_hash_str_find(ht, "keep_headers", sizeof("keep_headers")-1))
!= NULL
+ && Z_TYPE_P(tmp) == IS_ARRAY
+ ) {
+ ZEND_HASH_FOREACH_VAL(Z_ARR_P(tmp), zval *to_keep) {
+ if (Z_TYPE_P(to_keep) != IS_STRING) {
+ continue;
+ }
+ zend_string *header_name = Z_STR_P(to_keep);
+ if (zend_string_equals_literal_ci(header_name, "authorization")) {
+ keep_headers |= WSDL_HEADER_KEEP_AUTHORIZATION;
+ } else if (zend_string_equals_literal_ci(header_name, "proxy-authorization")) {
+ keep_headers |= WSDL_HEADER_KEEP_PROXY_AUTHORIZATION;
+ } else if (zend_string_equals_literal_ci(header_name, "cookie")) {
+ keep_headers |= WSDL_HEADER_KEEP_COOKIES;
+ }
+ } ZEND_HASH_FOREACH_END();
+ ZVAL_LONG(Z_CLIENT_KEEP_HEADERS_P(this_ptr), keep_headers);
+
+ }
} else if (!wsdl) {
php_error_docref(NULL, E_ERROR, "'location' and 'uri' options are
required in nonWSDL mode");
}
diff --git a/ext/soap/soap.stub.php b/ext/soap/soap.stub.php
index fdd4a46e109f..d614fe8d963d 100644
--- a/ext/soap/soap.stub.php
+++ b/ext/soap/soap.stub.php
@@ -572,6 +572,7 @@ class SoapClient
private ?string $__last_response = null;
private ?string $__last_request_headers = null;
private ?string $__last_response_headers = null;
+ private int $_keep_headers = 0;
public function __construct(?string $wsdl, array $options = []) {}
diff --git a/ext/soap/soap_arginfo.h b/ext/soap/soap_arginfo.h
index f6b146d779d6..5757cea7e361 100644
--- a/ext/soap/soap_arginfo.h
+++ b/ext/soap/soap_arginfo.h
@@ -1,5 +1,5 @@
/* This is a generated file, edit soap.stub.php instead.
- * Stub hash: 14c74a5d6f547837f536920d5abb741e2b6e4373 */
+ * Stub hash: c3509a1552db7edabc48d89eea67ff2e1e7d9115 */
#include "zend_attributes.h"
#include "zend_constants.h"
@@ -748,5 +748,11 @@ static zend_class_entry *register_class_SoapClient(void)
zend_declare_typed_property(class_entry, property___last_response_headers_name,
&property___last_response_headers_default_value, ZEND_ACC_PRIVATE, NULL, (zend_type)
ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL));
zend_string_release_ex(property___last_response_headers_name, true);
+ zval property__keep_headers_default_value;
+ ZVAL_LONG(&property__keep_headers_default_value, 0);
+ zend_string *property__keep_headers_name = zend_string_init("_keep_headers",
sizeof("_keep_headers") - 1, true);
+ zend_declare_typed_property(class_entry, property__keep_headers_name,
&property__keep_headers_default_value, ZEND_ACC_PRIVATE, NULL, (zend_type)
ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
+ zend_string_release_ex(property__keep_headers_name, true);
+
return class_entry;
}
diff --git a/ext/soap/tests/bugs/gh21421.phpt b/ext/soap/tests/bugs/gh21421.phpt
index 1b8bb3be716f..e20b79aed56b 100644
--- a/ext/soap/tests/bugs/gh21421.phpt
+++ b/ext/soap/tests/bugs/gh21421.phpt
@@ -15,7 +15,7 @@ $client = new SoapClient(NULL, $options);
var_dump($client);
?>
--EXPECTF--
-object(SoapClient)#%d (35) {
+object(SoapClient)#%d (36) {
["uri":"SoapClient":private]=>
string(26) "http://schemas.nothing.com"
["style":"SoapClient":private]=>
@@ -87,4 +87,6 @@ object(SoapClient)#%d (35) {
NULL
["__last_response_headers":"SoapClient":private]=>
NULL
+ ["_keep_headers":"SoapClient":private]=>
+ int(0)
}
diff --git a/ext/soap/tests/gh23686/check_headers.inc b/ext/soap/tests/gh23686/check_headers.inc
index f698d74ff97a..707d12844322 100644
--- a/ext/soap/tests/gh23686/check_headers.inc
+++ b/ext/soap/tests/gh23686/check_headers.inc
@@ -20,7 +20,12 @@ function start_server(string $code, ?string $entry_point) {
* When an <import> switches to a different server, check the headers that the
* second server recieves
*/
-function check_headers_for_import(string $logs_path, $context, bool $verbose_failure = true) {
+function check_headers_for_import(
+ string $logs_path,
+ $context,
+ array $options = [],
+ bool $verbose_failure = true,
+) {
$code = file_get_contents(__DIR__ . "/soap-respond-with-headers.inc");
$code = substr($code, strpos($code, "<?php") + strlen("<?php"));
$code = str_replace('"{LOG_FILE}"', var_export($logs_path, true), $code);
@@ -42,6 +47,7 @@ function check_headers_for_import(string $logs_path, $context, bool $verbose_fai
$client = new SoapClient("http://localhost:$wsdl_server_port", [
'soap_version' => $version,
'stream_context' => $context,
+ ...$options,
]);
} catch (SoapFault $e) {
if ($verbose_failure) {
@@ -61,7 +67,12 @@ function check_headers_for_import(string $logs_path, $context, bool $verbose_fai
* When an <import> leads to a <schema> on a different server, check the
* headers that the *third* server recieves
*/
-function check_headers_for_schema(string $logs_path, $context, bool $verbose_failure = true) {
+function check_headers_for_schema(
+ string $logs_path,
+ $context,
+ array $options = [],
+ bool $verbose_failure = true
+) {
$code = file_get_contents(__DIR__ . "/schema-respond-with-headers.inc");
$code = substr($code, strpos($code, "<?php") + strlen("<?php"));
$code = str_replace('"{LOG_FILE}"', var_export($logs_path, true), $code);
@@ -85,6 +96,7 @@ function check_headers_for_schema(string $logs_path, $context, bool $verbose_fai
$client = new SoapClient("http://localhost:$import_wsdl_server_port",
[
'soap_version' => $version,
'stream_context' => $context,
+ ...$options,
]);
} catch (SoapFault $e) {
if ($verbose_failure) {
diff --git a/ext/soap/tests/gh23686/import-keep-authorization.phpt
b/ext/soap/tests/gh23686/import-keep-authorization.phpt
new file mode 100644
index 000000000000..cc545e812931
--- /dev/null
+++ b/ext/soap/tests/gh23686/import-keep-authorization.phpt
@@ -0,0 +1,41 @@
+--TEST--
+GH-23686: Authorization header kept but others removed (<import>)
+--EXTENSIONS--
+soap
+--INI--
+soap.wsdl_cache_enabled=0
+--CLEAN--
+<?php
+unlink(__DIR__ . "/import-keep-authorization-logs.txt");
+?>
+--SKIPIF--
+<?php
+if (!file_exists(__DIR__ . "/../../../../sapi/cli/tests/php_cli_server.inc")) {
+ echo "skip sapi/cli/tests/php_cli_server.inc required but not found";
+}
+?>
+--FILE--
+<?php
+
+include __DIR__ . "/check_headers.inc";
+
+const LOGS_PATH = __DIR__ . "/import-keep-authorization-logs.txt";
+
+$context = stream_context_create([
+ 'http' => ['header' => "Authorization: Bearer
secret-token\r\nProxy-Authorization: FooBar\r\nCookie: foo=bar"],
+]);
+
+check_headers_for_import(LOGS_PATH, $context, ["keep_headers" =>
["authorization"]]);
+
+?>
+--EXPECTF--
+string(%d) "array (
+ 'Host' => 'localhost:%d',
+ 'Connection' => 'close',
+ 'Authorization' => 'Bearer secret-token',
+)"
+string(%d) "array (
+ 'Host' => 'localhost:%d',
+ 'Connection' => 'close',
+ 'Authorization' => 'Bearer secret-token',
+)"
diff --git a/ext/soap/tests/gh23686/import-keep-cookies.phpt
b/ext/soap/tests/gh23686/import-keep-cookies.phpt
new file mode 100644
index 000000000000..0732e3585bd6
--- /dev/null
+++ b/ext/soap/tests/gh23686/import-keep-cookies.phpt
@@ -0,0 +1,41 @@
+--TEST--
+GH-23686: Cookie header kept but others removed (<import>)
+--EXTENSIONS--
+soap
+--INI--
+soap.wsdl_cache_enabled=0
+--CLEAN--
+<?php
+unlink(__DIR__ . "/import-keep-cookies-logs.txt");
+?>
+--SKIPIF--
+<?php
+if (!file_exists(__DIR__ . "/../../../../sapi/cli/tests/php_cli_server.inc")) {
+ echo "skip sapi/cli/tests/php_cli_server.inc required but not found";
+}
+?>
+--FILE--
+<?php
+
+include __DIR__ . "/check_headers.inc";
+
+const LOGS_PATH = __DIR__ . "/import-keep-cookies-logs.txt";
+
+$context = stream_context_create([
+ 'http' => ['header' => "Authorization: Bearer
secret-token\r\nProxy-Authorization: FooBar\r\nCookie: foo=bar"],
+]);
+
+check_headers_for_import(LOGS_PATH, $context, ["keep_headers" =>
["cookie"]]);
+
+?>
+--EXPECTF--
+string(%d) "array (
+ 'Host' => 'localhost:%d',
+ 'Connection' => 'close',
+ 'Cookie' => 'foo=bar',
+)"
+string(%d) "array (
+ 'Host' => 'localhost:%d',
+ 'Connection' => 'close',
+ 'Cookie' => 'foo=bar',
+)"
diff --git a/ext/soap/tests/gh23686/import-keep-proxy-auth.phpt
b/ext/soap/tests/gh23686/import-keep-proxy-auth.phpt
new file mode 100644
index 000000000000..5dcf75f3502a
--- /dev/null
+++ b/ext/soap/tests/gh23686/import-keep-proxy-auth.phpt
@@ -0,0 +1,41 @@
+--TEST--
+GH-23686: Proxy-Authorization header kept but others removed
(<import>)
+--EXTENSIONS--
+soap
+--INI--
+soap.wsdl_cache_enabled=0
+--CLEAN--
+<?php
+unlink(__DIR__ . "/import-keep-proxy-authorization-logs.txt");
+?>
+--SKIPIF--
+<?php
+if (!file_exists(__DIR__ . "/../../../../sapi/cli/tests/php_cli_server.inc")) {
+ echo "skip sapi/cli/tests/php_cli_server.inc required but not found";
+}
+?>
+--FILE--
+<?php
+
+include __DIR__ . "/check_headers.inc";
+
+const LOGS_PATH = __DIR__ . "/import-keep-proxy-authorization-logs.txt";
+
+$context = stream_context_create([
+ 'http' => ['header' => "Authorization: Bearer
secret-token\r\nProxy-Authorization: FooBar\r\nCookie: foo=bar"],
+]);
+
+check_headers_for_import(LOGS_PATH, $context, ["keep_headers" =>
["proxy-authorization"]]);
+
+?>
+--EXPECTF--
+string(%d) "array (
+ 'Host' => 'localhost:%d',
+ 'Connection' => 'close',
+ 'Proxy-Authorization' => 'FooBar',
+)"
+string(%d) "array (
+ 'Host' => 'localhost:%d',
+ 'Connection' => 'close',
+ 'Proxy-Authorization' => 'FooBar',
+)"
diff --git a/ext/soap/tests/gh23686/import-repeated-authorization.phpt
b/ext/soap/tests/gh23686/import-repeated-authorization.phpt
index 7ec369b7b92b..2263e538ba96 100644
--- a/ext/soap/tests/gh23686/import-repeated-authorization.phpt
+++ b/ext/soap/tests/gh23686/import-repeated-authorization.phpt
@@ -28,7 +28,7 @@ $context = stream_context_create([
]],
]);
-check_headers_for_import(LOGS_PATH, $context, false);
+check_headers_for_import(LOGS_PATH, $context, [], false);
?>
--EXPECTF--
diff --git a/ext/soap/tests/gh23686/import-repeated-cookies.phpt
b/ext/soap/tests/gh23686/import-repeated-cookies.phpt
index b6c4f2e1d1db..4a7734547f4c 100644
--- a/ext/soap/tests/gh23686/import-repeated-cookies.phpt
+++ b/ext/soap/tests/gh23686/import-repeated-cookies.phpt
@@ -28,7 +28,7 @@ $context = stream_context_create([
]],
]);
-check_headers_for_import(LOGS_PATH, $context, false);
+check_headers_for_import(LOGS_PATH, $context, [], false);
?>
--EXPECTF--
diff --git a/ext/soap/tests/gh23686/import-repeated-proxy-auth.phpt
b/ext/soap/tests/gh23686/import-repeated-proxy-auth.phpt
index 4628fcb7fe0b..9dca3e1a0bbb 100644
--- a/ext/soap/tests/gh23686/import-repeated-proxy-auth.phpt
+++ b/ext/soap/tests/gh23686/import-repeated-proxy-auth.phpt
@@ -28,7 +28,7 @@ $context = stream_context_create([
]],
]);
-check_headers_for_import(LOGS_PATH, $context, false);
+check_headers_for_import(LOGS_PATH, $context, [], false);
?>
--EXPECTF--
diff --git a/ext/soap/tests/gh23686/schema-keep-authorization.phpt
b/ext/soap/tests/gh23686/schema-keep-authorization.phpt
new file mode 100644
index 000000000000..676e0f818849
--- /dev/null
+++ b/ext/soap/tests/gh23686/schema-keep-authorization.phpt
@@ -0,0 +1,41 @@
+--TEST--
+GH-23686: Authorization header kept but others removed (<schema>)
+--EXTENSIONS--
+soap
+--INI--
+soap.wsdl_cache_enabled=0
+--CLEAN--
+<?php
+unlink(__DIR__ . "/schema-keep-authorization-logs.txt");
+?>
+--SKIPIF--
+<?php
+if (!file_exists(__DIR__ . "/../../../../sapi/cli/tests/php_cli_server.inc")) {
+ echo "skip sapi/cli/tests/php_cli_server.inc required but not found";
+}
+?>
+--FILE--
+<?php
+
+include __DIR__ . "/check_headers.inc";
+
+const LOGS_PATH = __DIR__ . "/schema-keep-authorization-logs.txt";
+
+$context = stream_context_create([
+ 'http' => ['header' => "Authorization: Bearer
secret-token\r\nProxy-Authorization: FooBar\r\nCookie: foo=bar"],
+]);
+
+check_headers_for_schema(LOGS_PATH, $context, ["keep_headers" =>
["authorization"]]);
+
+?>
+--EXPECTF--
+string(%d) "array (
+ 'Host' => 'localhost:%d',
+ 'Connection' => 'close',
+ 'Authorization' => 'Bearer secret-token',
+)"
+string(%d) "array (
+ 'Host' => 'localhost:%d',
+ 'Connection' => 'close',
+ 'Authorization' => 'Bearer secret-token',
+)"
diff --git a/ext/soap/tests/gh23686/schema-keep-cookies.phpt
b/ext/soap/tests/gh23686/schema-keep-cookies.phpt
new file mode 100644
index 000000000000..6ba48e3fc24f
--- /dev/null
+++ b/ext/soap/tests/gh23686/schema-keep-cookies.phpt
@@ -0,0 +1,41 @@
+--TEST--
+GH-23686: Cookie header kept but others removed (<schema>)
+--EXTENSIONS--
+soap
+--INI--
+soap.wsdl_cache_enabled=0
+--CLEAN--
+<?php
+unlink(__DIR__ . "/schema-keep-cookies-logs.txt");
+?>
+--SKIPIF--
+<?php
+if (!file_exists(__DIR__ . "/../../../../sapi/cli/tests/php_cli_server.inc")) {
+ echo "skip sapi/cli/tests/php_cli_server.inc required but not found";
+}
+?>
+--FILE--
+<?php
+
+include __DIR__ . "/check_headers.inc";
+
+const LOGS_PATH = __DIR__ . "/schema-keep-cookies-logs.txt";
+
+$context = stream_context_create([
+ 'http' => ['header' => "Authorization: Bearer
secret-token\r\nProxy-Authorization: FooBar\r\nCookie: foo=bar"],
+]);
+
+check_headers_for_schema(LOGS_PATH, $context, ["keep_headers" =>
["cookie"]]);
+
+?>
+--EXPECTF--
+string(%d) "array (
+ 'Host' => 'localhost:%d',
+ 'Connection' => 'close',
+ 'Cookie' => 'foo=bar',
+)"
+string(%d) "array (
+ 'Host' => 'localhost:%d',
+ 'Connection' => 'close',
+ 'Cookie' => 'foo=bar',
+)"
diff --git a/ext/soap/tests/gh23686/schema-keep-proxy-auth.phpt
b/ext/soap/tests/gh23686/schema-keep-proxy-auth.phpt
new file mode 100644
index 000000000000..ae45bb74b217
--- /dev/null
+++ b/ext/soap/tests/gh23686/schema-keep-proxy-auth.phpt
@@ -0,0 +1,41 @@
+--TEST--
+GH-23686: Proxy-Authorization header kept but others removed
(<schema>)
+--EXTENSIONS--
+soap
+--INI--
+soap.wsdl_cache_enabled=0
+--CLEAN--
+<?php
+unlink(__DIR__ . "/schema-keep-proxy-authorization-logs.txt");
+?>
+--SKIPIF--
+<?php
+if (!file_exists(__DIR__ . "/../../../../sapi/cli/tests/php_cli_server.inc")) {
+ echo "skip sapi/cli/tests/php_cli_server.inc required but not found";
+}
+?>
+--FILE--
+<?php
+
+include __DIR__ . "/check_headers.inc";
+
+const LOGS_PATH = __DIR__ . "/schema-keep-proxy-authorization-logs.txt";
+
+$context = stream_context_create([
+ 'http' => ['header' => "Authorization: Bearer
secret-token\r\nProxy-Authorization: FooBar\r\nCookie: foo=bar"],
+]);
+
+check_headers_for_schema(LOGS_PATH, $context, ["keep_headers" =>
["proxy-authorization"]]);
+
+?>
+--EXPECTF--
+string(%d) "array (
+ 'Host' => 'localhost:%d',
+ 'Connection' => 'close',
+ 'Proxy-Authorization' => 'FooBar',
+)"
+string(%d) "array (
+ 'Host' => 'localhost:%d',
+ 'Connection' => 'close',
+ 'Proxy-Authorization' => 'FooBar',
+)"
diff --git a/ext/soap/tests/gh23686/schema-repeated-authorization.phpt
b/ext/soap/tests/gh23686/schema-repeated-authorization.phpt
index 066e1541b0b9..d23d2592d8ca 100644
--- a/ext/soap/tests/gh23686/schema-repeated-authorization.phpt
+++ b/ext/soap/tests/gh23686/schema-repeated-authorization.phpt
@@ -28,7 +28,7 @@ $context = stream_context_create([
]],
]);
-check_headers_for_schema(LOGS_PATH, $context, false);
+check_headers_for_schema(LOGS_PATH, $context, [], false);
?>
--EXPECTF--
diff --git a/ext/soap/tests/gh23686/schema-repeated-cookies.phpt
b/ext/soap/tests/gh23686/schema-repeated-cookies.phpt
index 5eaa8ef9465e..dfc01e966a62 100644
--- a/ext/soap/tests/gh23686/schema-repeated-cookies.phpt
+++ b/ext/soap/tests/gh23686/schema-repeated-cookies.phpt
@@ -28,7 +28,7 @@ $context = stream_context_create([
]],
]);
-check_headers_for_schema(LOGS_PATH, $context, false);
+check_headers_for_schema(LOGS_PATH, $context, [], false);
?>
--EXPECTF--
diff --git a/ext/soap/tests/gh23686/schema-repeated-proxy-auth.phpt
b/ext/soap/tests/gh23686/schema-repeated-proxy-auth.phpt
index e23759b03a9b..ea83b7ad9e85 100644
--- a/ext/soap/tests/gh23686/schema-repeated-proxy-auth.phpt
+++ b/ext/soap/tests/gh23686/schema-repeated-proxy-auth.phpt
@@ -28,7 +28,7 @@ $context = stream_context_create([
]],
]);
-check_headers_for_schema(LOGS_PATH, $context, false);
+check_headers_for_schema(LOGS_PATH, $context, [], false);
?>
--EXPECTF--