-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Implement request #47317: SoapServer::__getLastResponse() #15792
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
--TEST-- | ||
Request #47317 (SoapServer::__getLastResponse) | ||
--EXTENSIONS-- | ||
soap | ||
--INI-- | ||
soap.wsdl_cache_enabled=0 | ||
--FILE-- | ||
<?php | ||
function f() { | ||
} | ||
|
||
class LocalSoapClient extends SoapClient { | ||
public $server; | ||
|
||
function __construct($wsdl, $options) { | ||
parent::__construct($wsdl, $options); | ||
$this->server = new SoapServer($wsdl, $options); | ||
$this->server->addFunction("f"); | ||
} | ||
|
||
function __doRequest($request, $location, $action, $version, $one_way = 0): string { | ||
ob_start(); | ||
$this->server->handle($request); | ||
$response = ob_get_contents(); | ||
ob_end_clean(); | ||
return $response; | ||
} | ||
} | ||
|
||
$client = new LocalSoapClient(__DIR__."/../classmap003.wsdl", ["trace" => false]); | ||
$client->f(); | ||
var_dump($client->__getLastResponse()); | ||
var_dump($client->server->__getLastResponse()); | ||
var_dump($client->__getLastResponse() === $client->server->__getLastResponse()); | ||
|
||
echo "---\n"; | ||
|
||
$client = new LocalSoapClient(__DIR__."/../classmap003.wsdl", ["trace" => true]); | ||
var_dump($client->__getLastResponse()); | ||
var_dump($client->server->__getLastResponse()); | ||
var_dump($client->__getLastResponse() === $client->server->__getLastResponse()); | ||
|
||
echo "---\n"; | ||
|
||
$client->f(); | ||
echo $client->__getLastResponse(), "\n"; | ||
echo $client->server->__getLastResponse(), "\n"; | ||
var_dump($client->__getLastResponse() === $client->server->__getLastResponse()); | ||
?> | ||
--EXPECT-- | ||
NULL | ||
NULL | ||
bool(true) | ||
--- | ||
NULL | ||
NULL | ||
bool(true) | ||
--- | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:ab" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:fResponse><fReturn xsi:nil="true" xsi:type="ns1:A"/></ns1:fResponse></SOAP-ENV:Body></SOAP-ENV:Envelope> | ||
|
||
<?xml version="1.0" encoding="UTF-8"?> | ||
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:ab" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:fResponse><fReturn xsi:nil="true" xsi:type="ns1:A"/></ns1:fResponse></SOAP-ENV:Body></SOAP-ENV:Envelope> | ||
|
||
bool(true) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: you do not want to treat as string literals eventually ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand the question.
In any case, this check was copied over from SoapClient so that the behaviour is consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant considering "trace" => "true" but if this is consistent then it s fine :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see. Some people may be tempted to do this, and the annoying thing is that passing wrong types in the options array does not cause an exception, the option just gets ignored in that case... however, instead of allowing "true" I rather start throwing exceptions on wrong options.