Fix use of mb_strpos() causing error when polyfill is used

Error message:
    Uncaught ErrorException: iconv_strpos(): Detected an illegal character in input string in
    /var/www/site/vendor/symfony/polyfill-mbstring/Mbstring.php:536
This commit is contained in:
Zach Borboa
2023-09-09 11:47:57 -07:00
parent 6cc318ff66
commit 4624486d56
2 changed files with 14 additions and 3 deletions
+14 -3
View File
@@ -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
View File