Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CURLOPT_COOKIEFILE should accept the empty string #8157

Closed
jlherren opened this issue Oct 13, 2022 · 3 comments
Closed

CURLOPT_COOKIEFILE should accept the empty string #8157

jlherren opened this issue Oct 13, 2022 · 3 comments

Comments

@jlherren
Copy link

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.

@ondrejmirtes
Copy link
Member

This is the original PR: phpstan/phpstan-src#1719

This is fix for a similar problem that was done in the past: phpstan/phpstan-src#1782

Feel free to contribute yours :) Thanks.

@ondrejmirtes
Copy link
Member

Fixed by phpstan/phpstan-src#1836

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants