mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-08-26 10:29:21 +00:00
Merge pull request #813 from zachborboa/master
Fix use of mb_strpos() causing error when polyfill is used
This commit is contained in:
+14
-3
@@ -1937,16 +1937,27 @@ class Curl extends BaseCurl
|
||||
// Ensure that the server says the response is compressed with
|
||||
// gzip and the response has not already been decoded. Use
|
||||
// is_string() to ensure that $response is a string being passed
|
||||
// to mb_strpos() and gzdecode().
|
||||
// to mb_strpos() and gzdecode(). Use extension_loaded() to
|
||||
// ensure that mb_strpos() uses the mbstring extension and not a
|
||||
// polyfill.
|
||||
isset($response_headers['Content-Encoding']) &&
|
||||
$response_headers['Content-Encoding'] === 'gzip' &&
|
||||
is_string($response) &&
|
||||
mb_strpos($response, "\x1f" . "\x8b" . "\x08", 0, 'US-ASCII') === 0
|
||||
(
|
||||
(
|
||||
extension_loaded('mbstring') &&
|
||||
mb_strpos($response, "\x1f" . "\x8b" . "\x08", 0, 'US-ASCII') === 0
|
||||
) ||
|
||||
!extension_loaded('mbstring')
|
||||
)
|
||||
) || (
|
||||
// Or ensure that the response looks like it is compressed with
|
||||
// gzip. Use is_string() to ensure that $response is a string
|
||||
// being passed to mb_strpos() and gzdecode().
|
||||
// being passed to mb_strpos() and gzdecode(). Use
|
||||
// extension_loaded() to ensure that mb_strpos() uses the
|
||||
// mbstring extension and not a polyfill.
|
||||
is_string($response) &&
|
||||
extension_loaded('mbstring') &&
|
||||
mb_strpos($response, "\x1f" . "\x8b" . "\x08", 0, 'US-ASCII') === 0
|
||||
)
|
||||
) {
|
||||
|
||||
Executable → Regular
Reference in New Issue
Block a user