Skip to content

CURLOPT_COOKIEFILE should accept the empty string #8157

@jlherren

Description

@jlherren

Bug report

The curl option CURLOPT_COOKIEFILE is allowed to be empty, but PHPStan complains that non-empty-string must be supplied. The documentation says:

CURLOPT_COOKIEFILE: The name of the file containing the cookie data. The cookie file can be in Netscape format, or just plain HTTP-style headers dumped into a file. If the name is an empty string, no cookies are loaded, but cookie handling is still enabled.

Code snippet that reproduces the problem

function example(): void {
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_COOKIEFILE, '');
}

https://phpstan.org/r/65119d59-c9ef-43ff-9ecd-93860ce82f51

Expected output

No errors.

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