Skip to content

CURLOPT_HTTPHEADER should not accept a dictionary #9263

@johnbillion

Description

@johnbillion

Bug report

The curl_setopt() additions in phpstan/phpstan-src#1719 are very useful, thanks (cc @staabm). Coincidentally just last week I fixed a bug where headers were being sent to curl as a dictionary instead of a list, which is incorrect.

curl_setopt($curl, CURLOPT_HTTPHEADER, $headers) should only allow a numerically indexed array as the third parameter.

Code snippet that reproduces the problem

https://phpstan.org/r/fc00207b-efa7-4d83-adc0-01d874035272

Expected output

Line 8 in the code snippet should produce an error stating that only a list is accepted.

Did PHPStan help you today? Did it make you happy in any way?

I can no longer write PHP without PHPStan.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions