php-vcr
php-vcr copied to clipboard
Empty header inserted for curl requests
I'm having problems using php-vcr with the Dropbox client library. There's a few things which are just simple errors that I'll hunt down and add pull requests for. However, there's one that I don't just want to blindly edit because it's obviously deliberate.
For requests using the curl library an empty string is added to the array of headers. See here: https://github.com/php-vcr/php-vcr/blob/1.2.6/src/VCR/Util/CurlHelper.php#L62. There's no comment explaining why and it's causing some issues for code in the Dropbox client. Is there any reason for the empty string?
(And yeah, the Dropbox client library should have been coded to cope with empty strings as headers, but that's a separate problem)
As far as I remember that was done because the Guzzle implementation was expecting an empty string.
What issues did you run into with the Dropbox client? Is it this one? https://github.com/dropbox/dropbox-sdk-php
Yes, it's that client. Specifically this line: https://github.com/dropbox/dropbox-sdk-php/blob/9db8328c6c035baa0fee48291bd8bd93bcc714b0/lib/Dropbox/DropboxMetadataHeaderCatcher.php#L52. The substr_compare
call fails with the message:
substr_compare(): The start position cannot exceed initial string length
I'll probably submit a PR to them with a fix for that line, but wanted to ask you about the empty header too.
Apologies for not replying sooner, I must have missed the notification somehow.
@adri @alnorth is it safe to change the empty string? Any tests covering this?
If you give me some more information I can look into it!