CurlFormatter fails on large boddies
Closed this issue · 3 comments
| Q | A |
|---|---|
| Bug? | yes |
| New Feature? | no |
| Version | Master |
Actual Behavior
When posting super large bodies you will get an error because escshellargs does not allow more than X chars. https://github.com/php-http/message/blob/v1.4.1/src/Formatter/CurlCommandFormatter.php#L42
We should make sure to catch/suppress that error and write a better error message in the curl string.
I will do it)
I've also noticed the following error:
Fatal error: escapeshellarg(): Input string contains NULL bytes
I know it occurs when I upload a binary file. Im probably doing something wrong but the cUrl formatter is not the right place to complain about this. We should make sure to catch this as well.
Hi ! Still got the issue on PHP 7.3 with php-http/message 1.7.2 :
Error: escapeshellarg(): Argument exceeds the allowed length of 8192 bytes
in CurlCommandFormatter.php line 48
Maybe something like:
if (preg_match('/[\x00-\x1F\x7F]/', $data) || mb_strlen($data) > $theAllowedLength) {
$data = '[binary stream omitted]';
}
would do the trick, or wrap it in a try catch. Anyone know how to get the limit for the function?