From 7385175ce29d84eb43140545b7ceddbec74a7805 Mon Sep 17 00:00:00 2001 From: Rob Edwards Date: Fri, 27 Feb 2026 11:56:10 +0000 Subject: [PATCH] Use array_merge_recursive() to combine options --- src/Connector/Client.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Connector/Client.php b/src/Connector/Client.php index 7fd419c8..01b51ccc 100644 --- a/src/Connector/Client.php +++ b/src/Connector/Client.php @@ -68,8 +68,9 @@ public function getVersion(): string */ public function modifyOptions(): array { - // Combine options set globally e.g. headers with options set by individual API calls e.g. form_params. - $options = $this->options + $this->requestOptions; + // Combine options set globally e.g. headers with options set by individual API calls e.g. form_params, + // using array_merge_recursive to ensure nested arrays like headers are merged rather than overwritten. + $options = array_merge_recursive($this->requestOptions, $this->options); // This library can be standalone or as a dependency. Dependent libraries may also set their own user agent // which will make $options['headers']['User-Agent'] an array.