Skip to content
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

Unable to influence \SoapFault::$code from Zend\Soap\Server::fault() #19

Closed
weierophinney opened this issue Dec 31, 2019 · 2 comments
Closed

Comments

@weierophinney
Copy link
Member

In Zend\Soap\Server::fault (https://github.com/zendframework/zf2/blob/master/library/Zend/Soap/Server.php#L1067) there is the functionality to transform an exception which is preregisterd with Zend\Soap\Server using the method registerFaultException.

Following the logic at line 1072, and $fault is an exception $code becomes the exception error code. The base class exception from PHP libraries defines \Exception::$code as an integer, which is tested in the constructor, and protected with final methods. This has the effect that \Exception::getCode() always returns an integer value.

On line 1086 this value is tested against an array of string values, therefor never making a match, causing the $code variable always being set to 'Receiver' on line 1087.

Original: zendframework/zendframework#6770


Originally posted by @DannyvdSluijs at zendframework/zend-soap#22

@weierophinney
Copy link
Member Author

You can work around this issue by setting the code in your exceptions construct after initializing the parent exception:

public function __construct($message = "", $code = 'Sender', Throwable $previous = null) { parent::__construct($message, 500, $previous); $this->code = $code; }


Originally posted by @JaisDK at zendframework/zend-soap#22 (comment)

@weierophinney
Copy link
Member Author

This package is considered feature-complete, and is now in security-only maintenance mode, following a decision by the Technical Steering Committee.
If you have a security issue, please follow our security reporting guidelines.
If you wish to take on the role of maintainer, please nominate yourself

If you need an actively developed SOAP client, we recommend phpro/soap-client.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant