Skip to content

Windows' PHP 8.5 still doesn't handle br-encoded response correctly #21599

@yoozor

Description

@yoozor

Description

This DOES NOT happen on Linux (linux+php) but on Windows for many years. When are you going to support brotli-encoded response on Windows??

The following code:

<?php
$url = 'https://ftp.mozilla.org/';

$ch = curl_init($url);
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_VERBOSE => true,
    CURLOPT_TIMEOUT => 15,
    CURLOPT_HTTPHEADER => [
        'User-Agent: Mozilla/5.0 (Android; K) Chrome/144.0',
    ],
    CURLOPT_ENCODING => 'gzip, deflate, br',
]);

$response = curl_exec($ch);

if ($response === false) {
    echo "cURL error: " . curl_error($ch);
} else {
    echo $response;
}

Resulted in this output:

....
* Request completely sent off
< HTTP/2 200 
....
< content-encoding: br
....
bool(false)

But I expected this output instead:

....
* Request completely sent off
< HTTP/2 200 
....
< content-encoding: br
....
<!DOCTYPE html>
<html>
....

PHP Version

PHP 8.5.4 (cli)

Operating System

Windows

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions