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

parseCurlResponse() cannot take NULL body #126

Closed
phil-davis opened this issue Sep 12, 2019 · 2 comments
Closed

parseCurlResponse() cannot take NULL body #126

phil-davis opened this issue Sep 12, 2019 · 2 comments

Comments

@phil-davis
Copy link
Contributor

phil-davis commented Sep 12, 2019

https://drone.owncloud.com/owncloud/core/20613/25/10

PHPUnit 6.5.14 by Sebastian Bergmann and contributors.
Runtime: PHPDBG 7.1.30-1+ubuntu16.04.1+deb.sury.org+1
Configuration: /drone/src/tests/phpunit-autotest-external.xml
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE 65 / 85 ( 76%)
EEEEEEEEEEEEEEEEEEEE 85 / 85 (100%)
Time: 8.17 seconds, Memory: 34.00MB
There were 85 errors:
1) OCA\Files_External\Tests\Storage\WebdavTest::testRoot
TypeError: Argument 2 passed to Sabre\HTTP\Client::parseCurlResponse() must be of the type string, null given, called in /drone/src/lib/composer/sabre/http/lib/Client.php on line 547
/drone/src/lib/composer/sabre/http/lib/Client.php:457
/drone/src/lib/composer/sabre/http/lib/Client.php:547
/drone/src/lib/composer/sabre/http/lib/Client.php:432
/drone/src/lib/composer/sabre/http/lib/Client.php:325
/drone/src/lib/composer/sabre/http/lib/Client.php:114
/drone/src/lib/composer/sabre/dav/lib/DAV/Client.php:372
/drone/src/lib/private/Files/Storage/DAV.php:678
/drone/src/lib/private/Files/Storage/DAV.php:188
/drone/src/apps/files_external/tests/Storage/WebdavTest.php:57

It looks like https://github.com/sabre-io/http/blob/5.0.1/lib/Client.php#L532

$responseBody = substr($response, $curlInfo['header_size']) ?: null;

can cause $responseBody to be NULL and that gets passed to

return $this->parseCurlResponse($headerBlob, $responseBody, $curlHandle);

but parseCurlResponse has:

    protected function parseCurlResponse(array $headerLines, string $body, $curlHandle): array

and in this case $body is null, not a string.

This "null body" edge case seems to have been missed in the refactoring done in PR #115

@phil-davis
Copy link
Contributor Author

Probably this can be worked-around by adjusting the higher calling code to no longer use the deprecated parseCurlResult - but in theory that should not be necessary for a patch point release.

@phil-davis
Copy link
Contributor Author

Duplicate of #124

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