Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Server does not parse huge files #28

Closed
astahovn opened this issue Aug 12, 2016 · 3 comments
Closed

Server does not parse huge files #28

astahovn opened this issue Aug 12, 2016 · 3 comments

Comments

@astahovn
Copy link

astahovn commented Aug 12, 2016

$server = new \Zend\Soap\Server(...);
...
$response = $server->handle($request = file_get_contents('php://input'));

When request is more than 10Mb, we get "Invalid XML" error. The cause in Server->setRequest() method:
789 $dom = new DOMDocument();
790 $loadStatus = $dom->loadXML($xml);

, where loadXML(..) method called without param LIBXML_PARSEHUGE.

Is it bug or feature?

@adamlundrigan
Copy link

IIRC that flag turns on protections to prevent a wide range of nastiness when reading XML documents (some info here and in the PHP bug report which resulted in LIBXML_PARSEHUGE being added). One of those protections is limiting a single node to 10MB.

We could add a boolean option to the Zend\Soap\Server class (parse_huge?) to allow toggling this flag on a case-by-case basis, eg:

$server = new \Zend\Soap\Server($wsdl, [
    'parse_huge' => true
]);

@weierophinney
Copy link
Member

The flag LIBXML_PARSEHUGE was introduced after original incarnations of this particular library, and was simply missed over time; nobody has requested it.

I agree that we should likely support it; I also agree with @adamlundrigan that it should likely be configurable (as the reason large files are not accepted by default is a protection against DoS attacks).

Adding the flag would be trivial; if somebody would like to create a pull request and link it to this issue, we'll certainly review it for inclusion.

stormwild added a commit to stormwild/zend-soap that referenced this issue Nov 30, 2016
stormwild added a commit to stormwild/zend-soap that referenced this issue Nov 30, 2016
stormwild added a commit to stormwild/zend-soap that referenced this issue Nov 30, 2016
stormwild added a commit to stormwild/zend-soap that referenced this issue Nov 30, 2016
stormwild added a commit to stormwild/zend-soap that referenced this issue Dec 2, 2016
@stormwild
Copy link
Contributor

Hi sent pull request: #36

weierophinney added a commit that referenced this issue Jan 29, 2018
Fix for Server does not parse huge files #28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants