Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
test(sdk-php): keep argument capture on while the trace test reads it
Yudhi Armyndharis71d2e94f2e60
diff --git a/sdk/php/tests/ClientTest.php b/sdk/php/tests/ClientTest.phpindex ecbf6d10e..34c92d3a7 100644--- a/sdk/php/tests/ClientTest.php+++ b/sdk/php/tests/ClientTest.php@@ -104,6 +104,9 @@ class ClientTest extends TestCasepublic function testARefusedDefaultHeaderLeavesTheKeyOutOfItsTrace(): void{$key = 'owa_k1_0123456789abcdefghij';+ // A production php.ini drops the arguments from every trace, which would pass this vacuously: the+ // setting is read when the exception is created, so it is switched off around the call.+ $previous = ini_set('zend.exception_ignore_args', '0');try {new \OpenWA\Client(['baseUrl' => 'https://wa.example.com', 'apiKey' => $key, 'defaultHeaders' => ['X-Proxy' => "tok\n"]]);$this->fail('Expected an exception for an illegal header value');@@ -113,6 +116,10 @@ class ClientTest extends TestCaseif (PHP_VERSION_ID >= 80200) {$this->assertStringNotContainsString('tok', (string) json_encode($e->getTrace()));}+ // The trace has to carry arguments, or the assertions above prove nothing.+ $this->assertStringContainsString('checkDefaultHeaders(', $e->getTraceAsString());+ } finally {+ ini_set('zend.exception_ignore_args', $previous === false ? '0' : $previous);}}