From 006ba3da482d8470af366cb40aa3d4a59639fa8c Mon Sep 17 00:00:00 2001 From: NickSdot Date: Tue, 4 Aug 2026 13:03:16 +0000 Subject: [PATCH] ext/soap: applied fixers to improve test robustness --- ext/soap/tests/bugs/bug31755.phpt | 4 +- ext/soap/tests/bugs/bug42151.phpt | 4 +- ext/soap/tests/bugs/bug42692.phpt | 2 +- ext/soap/tests/bugs/bug55639.phpt | 4 +- ext/soap/tests/bugs/bug71610.phpt | 4 +- ext/soap/tests/bugs/bug73037.phpt | 1 - ext/soap/tests/bugs/bug80672.phpt | 4 +- ext/soap/tests/bugs/gh16237.phpt | 4 +- ext/soap/tests/bugs/gh16256.phpt | 8 ++-- ext/soap/tests/bugs/gh16429.phpt | 4 +- ext/soap/tests/bugs/gh22167.phpt | 42 +++++++++---------- .../bugs/protocol_relative_redirect.phpt | 2 +- ext/soap/tests/bugs/relative_redirect.phpt | 2 +- .../tests/bugs/relative_redirect_path.phpt | 2 +- ext/soap/tests/fault_warning.phpt | 16 +++---- ext/soap/tests/gh15711.phpt | 4 +- ext/soap/tests/gh16318.phpt | 6 +-- 17 files changed, 56 insertions(+), 57 deletions(-) diff --git a/ext/soap/tests/bugs/bug31755.phpt b/ext/soap/tests/bugs/bug31755.phpt index c4b2c622b6af..2cd623888b55 100644 --- a/ext/soap/tests/bugs/bug31755.phpt +++ b/ext/soap/tests/bugs/bug31755.phpt @@ -17,7 +17,7 @@ $client = new MySoapClient(null, array( try { new SOAPHeader('', 'foo', 'bar'); } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } $header = new SOAPHeader('namespace', 'foo', 'bar'); @@ -26,6 +26,6 @@ $response= $client->__soapCall('function', array(), null, $header); print $client->__getLastRequest(); ?> --EXPECT-- -SoapHeader::__construct(): Argument #1 ($namespace) must not be empty +ValueError: SoapHeader::__construct(): Argument #1 ($namespace) must not be empty bar diff --git a/ext/soap/tests/bugs/bug42151.phpt b/ext/soap/tests/bugs/bug42151.phpt index 2f9c1830ad39..ef8f744b1374 100644 --- a/ext/soap/tests/bugs/bug42151.phpt +++ b/ext/soap/tests/bugs/bug42151.phpt @@ -21,12 +21,12 @@ try { $bar = new bar(); $foo = new foo(); } catch (Exception $e){ - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "ok\n"; ?> --EXPECTF-- -SOAP-ERROR: Parsing WSDL: Couldn't load from 'httpx://' : failed to load %s +SoapFault: SOAP-ERROR: Parsing WSDL: Couldn't load from 'httpx://' : failed to load %s ok I don't get executed either. diff --git a/ext/soap/tests/bugs/bug42692.phpt b/ext/soap/tests/bugs/bug42692.phpt index fe4840d9268d..78126325ad5c 100644 --- a/ext/soap/tests/bugs/bug42692.phpt +++ b/ext/soap/tests/bugs/bug42692.phpt @@ -33,7 +33,7 @@ try { $result = $client->checkAuth(1,"two"); echo "Auth for 1 is $result\n"; } catch (Exception $e) { - echo $e->getMessage(); + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } ?> --EXPECT-- diff --git a/ext/soap/tests/bugs/bug55639.phpt b/ext/soap/tests/bugs/bug55639.phpt index 16d7f7a37719..834389361982 100644 --- a/ext/soap/tests/bugs/bug55639.phpt +++ b/ext/soap/tests/bugs/bug55639.phpt @@ -44,7 +44,7 @@ $client = new soapclient(NULL, [ try { $client->__soapCall("foo", []); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } $headers = $client->__getLastRequestHeaders(); @@ -52,7 +52,7 @@ var_dump($headers); ?> --EXPECTF-- -Unauthorized +SoapFault: Unauthorized string(%d) "POST / HTTP/1.1 Host: %s Connection: Keep-Alive diff --git a/ext/soap/tests/bugs/bug71610.phpt b/ext/soap/tests/bugs/bug71610.phpt index f7f674fa0593..34709c5b0693 100644 --- a/ext/soap/tests/bugs/bug71610.phpt +++ b/ext/soap/tests/bugs/bug71610.phpt @@ -21,8 +21,8 @@ $exploit = unserialize($ser); try { $exploit->blahblah(); } catch(SoapFault $e) { - echo $e->getMessage()."\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -looks like we got no XML document +SoapFault: looks like we got no XML document diff --git a/ext/soap/tests/bugs/bug73037.phpt b/ext/soap/tests/bugs/bug73037.phpt index 7a5b99776772..6d94fca04e0f 100644 --- a/ext/soap/tests/bugs/bug73037.phpt +++ b/ext/soap/tests/bugs/bug73037.phpt @@ -175,4 +175,3 @@ Iteration 6 Function 'CATALOG' doesn't exist Function 'CATALOG' doesn't exist - diff --git a/ext/soap/tests/bugs/bug80672.phpt b/ext/soap/tests/bugs/bug80672.phpt index 2abc40e39134..d5f54ef6b804 100644 --- a/ext/soap/tests/bugs/bug80672.phpt +++ b/ext/soap/tests/bugs/bug80672.phpt @@ -8,8 +8,8 @@ try { $client = new SoapClient(__DIR__ . "/bug80672.xml"); $query = $soap->query(array('sXML' => 'something')); } catch(SoapFault $e) { - print $e->getMessage(); + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } ?> --EXPECT-- -SOAP-ERROR: Parsing WSDL: Unexpected WSDL element <> +SoapFault: SOAP-ERROR: Parsing WSDL: Unexpected WSDL element <> diff --git a/ext/soap/tests/bugs/gh16237.phpt b/ext/soap/tests/bugs/gh16237.phpt index 468f2794399e..c86e9c14039d 100644 --- a/ext/soap/tests/bugs/gh16237.phpt +++ b/ext/soap/tests/bugs/gh16237.phpt @@ -9,9 +9,9 @@ $server = new SoapServer(null, ['uri'=>"http://testuri.org"]); try { clone $server; } catch (Error $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Trying to clone an uncloneable object of class SoapServer +Error: Trying to clone an uncloneable object of class SoapServer diff --git a/ext/soap/tests/bugs/gh16256.phpt b/ext/soap/tests/bugs/gh16256.phpt index a6d5f3fbbf3c..cefc05c4dd01 100644 --- a/ext/soap/tests/bugs/gh16256.phpt +++ b/ext/soap/tests/bugs/gh16256.phpt @@ -11,14 +11,14 @@ $wsdl = __DIR__."/ext/soap/tests/bug41004.wsdl"; try { new SoapClient($wsdl, ["classmap" => $classmap]); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { new SoapServer($wsdl, ["classmap" => $classmap]); } catch (Throwable $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -SoapClient::__construct(): Argument #2 ($options) "classmap" option must be an associative array -SoapServer::__construct(): Argument #2 ($options) "classmap" option must be an associative array +ValueError: SoapClient::__construct(): Argument #2 ($options) "classmap" option must be an associative array +ValueError: SoapServer::__construct(): Argument #2 ($options) "classmap" option must be an associative array diff --git a/ext/soap/tests/bugs/gh16429.phpt b/ext/soap/tests/bugs/gh16429.phpt index 24d517f96b96..b7073a05b23d 100644 --- a/ext/soap/tests/bugs/gh16429.phpt +++ b/ext/soap/tests/bugs/gh16429.phpt @@ -14,9 +14,9 @@ $client = new SoapClient(__DIR__."/../interop/Round2/GroupB/round2_groupB.wsdl", try { $client->echo2DStringArray($fusion); } catch (Exception $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- string(10) "xxxxxxxxxx" -Cannot traverse an already closed generator +Exception: Cannot traverse an already closed generator diff --git a/ext/soap/tests/bugs/gh22167.phpt b/ext/soap/tests/bugs/gh22167.phpt index f24bfb0eac32..9a6518d2ad73 100644 --- a/ext/soap/tests/bugs/gh22167.phpt +++ b/ext/soap/tests/bugs/gh22167.phpt @@ -98,31 +98,31 @@ foreach ($cases as $name => $schema) { new SoapClient($file, ["cache_wsdl" => WSDL_CACHE_NONE]); echo "$name: parsed\n"; } catch (SoapFault $e) { - echo "$name: {$e->getMessage()}\n"; + echo "$name: ", $e::class, ': ', $e->getMessage(), "\n"; } finally { unlink($file); } } ?> --EXPECT-- -minOccurs: SOAP-ERROR: Parsing Schema: minOccurs value is out of range -maxOccurs: SOAP-ERROR: Parsing Schema: maxOccurs value is out of range -negative minOccurs: SOAP-ERROR: Parsing Schema: minOccurs value is out of range -negative maxOccurs: SOAP-ERROR: Parsing Schema: maxOccurs value is out of range -minExclusive: SOAP-ERROR: Parsing Schema: minExclusive value is out of range -minInclusive: SOAP-ERROR: Parsing Schema: minInclusive value is out of range -maxExclusive: SOAP-ERROR: Parsing Schema: maxExclusive value is out of range -maxInclusive: SOAP-ERROR: Parsing Schema: maxInclusive value is out of range -totalDigits: SOAP-ERROR: Parsing Schema: totalDigits value is out of range -fractionDigits: SOAP-ERROR: Parsing Schema: fractionDigits value is out of range -length: SOAP-ERROR: Parsing Schema: length value is out of range -minLength: SOAP-ERROR: Parsing Schema: minLength value is out of range -maxLength: SOAP-ERROR: Parsing Schema: maxLength value is out of range -leading whitespace numeric-string: SOAP-ERROR: Parsing Schema: maxOccurs value is out of range -leading plus numeric-string: SOAP-ERROR: Parsing Schema: maxOccurs value is out of range -leading zero numeric-string: SOAP-ERROR: Parsing Schema: maxOccurs value is out of range -leading numeric-string with trailing data: SOAP-ERROR: Parsing Schema: maxOccurs value is out of range -negative out-of-range numeric-string: SOAP-ERROR: Parsing Schema: maxOccurs value is out of range -decimal numeric-string: SOAP-ERROR: Parsing Schema: maxOccurs value is out of range -exponent numeric-string: SOAP-ERROR: Parsing Schema: maxOccurs value is out of range +minOccurs: SoapFault: SOAP-ERROR: Parsing Schema: minOccurs value is out of range +maxOccurs: SoapFault: SOAP-ERROR: Parsing Schema: maxOccurs value is out of range +negative minOccurs: SoapFault: SOAP-ERROR: Parsing Schema: minOccurs value is out of range +negative maxOccurs: SoapFault: SOAP-ERROR: Parsing Schema: maxOccurs value is out of range +minExclusive: SoapFault: SOAP-ERROR: Parsing Schema: minExclusive value is out of range +minInclusive: SoapFault: SOAP-ERROR: Parsing Schema: minInclusive value is out of range +maxExclusive: SoapFault: SOAP-ERROR: Parsing Schema: maxExclusive value is out of range +maxInclusive: SoapFault: SOAP-ERROR: Parsing Schema: maxInclusive value is out of range +totalDigits: SoapFault: SOAP-ERROR: Parsing Schema: totalDigits value is out of range +fractionDigits: SoapFault: SOAP-ERROR: Parsing Schema: fractionDigits value is out of range +length: SoapFault: SOAP-ERROR: Parsing Schema: length value is out of range +minLength: SoapFault: SOAP-ERROR: Parsing Schema: minLength value is out of range +maxLength: SoapFault: SOAP-ERROR: Parsing Schema: maxLength value is out of range +leading whitespace numeric-string: SoapFault: SOAP-ERROR: Parsing Schema: maxOccurs value is out of range +leading plus numeric-string: SoapFault: SOAP-ERROR: Parsing Schema: maxOccurs value is out of range +leading zero numeric-string: SoapFault: SOAP-ERROR: Parsing Schema: maxOccurs value is out of range +leading numeric-string with trailing data: SoapFault: SOAP-ERROR: Parsing Schema: maxOccurs value is out of range +negative out-of-range numeric-string: SoapFault: SOAP-ERROR: Parsing Schema: maxOccurs value is out of range +decimal numeric-string: SoapFault: SOAP-ERROR: Parsing Schema: maxOccurs value is out of range +exponent numeric-string: SoapFault: SOAP-ERROR: Parsing Schema: maxOccurs value is out of range fractional numeric-string within int range: parsed diff --git a/ext/soap/tests/bugs/protocol_relative_redirect.phpt b/ext/soap/tests/bugs/protocol_relative_redirect.phpt index e8f30ca66872..e9c30f0ab290 100644 --- a/ext/soap/tests/bugs/protocol_relative_redirect.phpt +++ b/ext/soap/tests/bugs/protocol_relative_redirect.phpt @@ -42,7 +42,7 @@ try { $client->__soapCall("foo", []); echo "redirect followed\n"; } catch (SoapFault $e) { - echo "SoapFault: " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- diff --git a/ext/soap/tests/bugs/relative_redirect.phpt b/ext/soap/tests/bugs/relative_redirect.phpt index 774e7cbd98d7..ebdcd97e5d49 100644 --- a/ext/soap/tests/bugs/relative_redirect.phpt +++ b/ext/soap/tests/bugs/relative_redirect.phpt @@ -42,7 +42,7 @@ try { $client->__soapCall("foo", []); echo "redirect followed\n"; } catch (SoapFault $e) { - echo "SoapFault: " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- diff --git a/ext/soap/tests/bugs/relative_redirect_path.phpt b/ext/soap/tests/bugs/relative_redirect_path.phpt index 09d4c857cc92..2e18c12b926f 100644 --- a/ext/soap/tests/bugs/relative_redirect_path.phpt +++ b/ext/soap/tests/bugs/relative_redirect_path.phpt @@ -42,7 +42,7 @@ try { $client->__soapCall("foo", []); echo "redirect followed\n"; } catch (SoapFault $e) { - echo "SoapFault: " . $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- diff --git a/ext/soap/tests/fault_warning.phpt b/ext/soap/tests/fault_warning.phpt index 2a9d99fb5dbd..d8c2921a8ef8 100644 --- a/ext/soap/tests/fault_warning.phpt +++ b/ext/soap/tests/fault_warning.phpt @@ -8,13 +8,13 @@ soap try { new SoapFault("", "message"); // Can't be an empty string } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { new SoapFault(new stdClass(), "message"); // Can't be a non-string (except for null) } catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } $fault = new SoapFault("Sender", "message"); @@ -25,13 +25,13 @@ echo get_class($fault) . "\n"; try { new SoapFault(["more"], "message"); // two elements in array required } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { new SoapFault(["m", "more", "superfluous"], "message"); // two required } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } $fault = new SoapFault(["more-ns", "Sender"], "message"); // two given @@ -39,10 +39,10 @@ echo get_class($fault); ?> --EXPECT-- -SoapFault::__construct(): Argument #1 ($code) is not a valid fault code -SoapFault::__construct(): Argument #1 ($code) must be of type array|string|null, stdClass given +ValueError: SoapFault::__construct(): Argument #1 ($code) is not a valid fault code +TypeError: SoapFault::__construct(): Argument #1 ($code) must be of type array|string|null, stdClass given SoapFault SoapFault -SoapFault::__construct(): Argument #1 ($code) is not a valid fault code -SoapFault::__construct(): Argument #1 ($code) is not a valid fault code +ValueError: SoapFault::__construct(): Argument #1 ($code) is not a valid fault code +ValueError: SoapFault::__construct(): Argument #1 ($code) is not a valid fault code SoapFault diff --git a/ext/soap/tests/gh15711.phpt b/ext/soap/tests/gh15711.phpt index 17ff051698fd..d3c04d319ab1 100644 --- a/ext/soap/tests/gh15711.phpt +++ b/ext/soap/tests/gh15711.phpt @@ -64,7 +64,7 @@ $book->short = NonBackedEnum::First; try { $client->dotest($book); } catch (ValueError $e) { - echo "ValueError: ", $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } echo "--- Test with mismatched enum backing type ---\n"; @@ -74,7 +74,7 @@ $book->short = StringBackedEnum::First; try { $client->dotest($book); } catch (ValueError $e) { - echo "ValueError: ", $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> diff --git a/ext/soap/tests/gh16318.phpt b/ext/soap/tests/gh16318.phpt index 0c38b6fc8de3..ce0490d95927 100644 --- a/ext/soap/tests/gh16318.phpt +++ b/ext/soap/tests/gh16318.phpt @@ -26,11 +26,11 @@ foreach ([$test1, $test2] as $test) { try { $client->__soapCall("echoStructArray", array($test), array("soapaction"=>"http://soapinterop.org/","uri"=>"http://soapinterop.org/")); } catch (ValueError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } } ?> --EXPECT-- -Recursive array cannot be encoded -Recursive array cannot be encoded +ValueError: Recursive array cannot be encoded +ValueError: Recursive array cannot be encoded