psalm icon indicating copy to clipboard operation
psalm copied to clipboard

False-positive `UnusedFunctionCall` on `curl_share_setopt()`

Open vjik opened this issue 2 months ago • 2 comments

https://psalm.dev/r/d1e3f95e5d

vjik avatar Oct 30 '25 14:10 vjik

I found these snippets:

https://psalm.dev/r/d1e3f95e5d
<?php

function createCurlShareHandle(): CurlShareHandle
{
    $handle = curl_share_init();
    curl_share_setopt($handle, CURLSHOPT_SHARE, CURL_LOCK_DATA_COOKIE);
    curl_share_setopt($handle, CURLSHOPT_SHARE, CURL_LOCK_DATA_DNS);
    curl_share_setopt($handle, CURLSHOPT_SHARE, CURL_LOCK_DATA_SSL_SESSION);
    return $handle;
}
Psalm output (using commit cdceda0):

ERROR: UnusedFunctionCall - 6:5 - The call to curl_share_setopt is not used

ERROR: UnusedFunctionCall - 7:5 - The call to curl_share_setopt is not used

ERROR: UnusedFunctionCall - 8:5 - The call to curl_share_setopt is not used

psalm-github-bot[bot] avatar Oct 30 '25 14:10 psalm-github-bot[bot]

The solution is probably to add curl_share_setopt in the list of impure functions (as done already for curl_setopt)

stof avatar Nov 04 '25 14:11 stof