Skip to content
This repository has been archived by the owner on Sep 29, 2023. It is now read-only.

Commit

Permalink
Fixed CURLINFO_HEADER_SIZE miscalculations if Proxy Enabled
Browse files Browse the repository at this point in the history
- Fixes #258
  • Loading branch information
Jay Patel committed Mar 1, 2015
1 parent 7f51b58 commit 207c2c2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/PayPal/Core/PayPalHttpConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ public function execute($data)

// Get Request and Response Headers
$requestHeaders = curl_getinfo($ch, CURLINFO_HEADER_OUT);
$responseHeaderSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
//Using alternative solution to CURLINFO_HEADER_SIZE as it throws invalid number when called using PROXY.
$responseHeaderSize = strlen($result) - curl_getinfo($ch, CURLINFO_SIZE_DOWNLOAD);

This comment has been minimized.

Copy link
@Vallefor

Vallefor Mar 30, 2016

OMG.
strlen returns wrong value If there are cyrillic (for example in address) in paypal response. Please use mb_strlen instead.

$responseHeaders = substr($result, 0, $responseHeaderSize);
$result = substr($result, $responseHeaderSize);

Expand Down

0 comments on commit 207c2c2

Please sign in to comment.