Skip to content

Only call curl_close() in PHP < 8#583

Merged
rowan-m merged 3 commits intogoogle:masterfrom
jamieburchell:fix-curl-close-php8
Mar 19, 2026
Merged

Only call curl_close() in PHP < 8#583
rowan-m merged 3 commits intogoogle:masterfrom
jamieburchell:fix-curl-close-php8

Conversation

@jamieburchell
Copy link
Copy Markdown
Contributor

curl_close() has had no effect since PHP 8 and is deprecated in PHP 8.5. This fix ensures that it is only called in PHP < 8.

@google-cla
Copy link
Copy Markdown

google-cla bot commented Oct 23, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@aurimasrimkusnfq
Copy link
Copy Markdown

Any update on this?

@jamieburchell
Copy link
Copy Markdown
Contributor Author

jamieburchell commented Mar 5, 2026

@williamdes I have just spotted that the PHP requirement for this package is >=8, therefore the function could be emptied completely.

@williamdes
Copy link
Copy Markdown
Contributor

@williamdes I have just spotted that the PHP requirement for this package is >=8, therefore the function could be emptied completely.

Perfect, drop the lines please

@jamieburchell
Copy link
Copy Markdown
Contributor Author

@williamdes Done

Comment thread src/ReCaptcha/RequestMethod/Curl.php Outdated
Copy link
Copy Markdown
Contributor

@williamdes williamdes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@williamdes
Copy link
Copy Markdown
Contributor

Hi @rowan-m

What do you think about this one and #587 ?

@rowan-m rowan-m self-requested a review March 18, 2026 11:28
Copy link
Copy Markdown
Contributor

@rowan-m rowan-m left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to leave the function there, you can remove it and the call to it.

Comment thread src/ReCaptcha/RequestMethod/Curl.php Outdated
* @param resource $ch
* @deprecated This is not needed since PHP 8 and does nothing now
*/
public function close($ch)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it's deprecated, please remove the entire function and the call to it in CurlPost.php.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New major version for the next release then?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes made.

@rowan-m
Copy link
Copy Markdown
Contributor

rowan-m commented Mar 18, 2026 via email

@jamieburchell
Copy link
Copy Markdown
Contributor Author

jamieburchell commented Mar 18, 2026

Nice. I resolved the conflicts, but it's going to need composer run lint-fix and possibly pulling things in from master. I'm on my phone, but can look at this tomorrow. Feel free to jump in sooner if you like though. .

I don't know what's going on with the whitespace/linting. I just removed the lines and my IDE doesn't show whitespace changes. Either way, I can't dedicate any more time to this issue.

Comment on lines +75 to +76
->method('exec')
->willReturn('RESPONSEBODY');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
->method('exec')
->willReturn('RESPONSEBODY');
->method('exec')
->willReturn('RESPONSEBODY');

Comment on lines +101 to +102
->method('exec')
->willReturn('RESPONSEBODY');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
->method('exec')
->willReturn('RESPONSEBODY');
->method('exec')
->willReturn('RESPONSEBODY');

Comment on lines +124 to +125
->method('exec')
->willReturn(false);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
->method('exec')
->willReturn(false);
->method('exec')
->willReturn(false);

@williamdes
Copy link
Copy Markdown
Contributor

I posted my guesses about what could be wrong for the linting.
@rowan-m maybe fix this on your side please

@rowan-m rowan-m merged commit 7ef9881 into google:master Mar 19, 2026
2 checks passed
@jamieburchell jamieburchell deleted the fix-curl-close-php8 branch March 19, 2026 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants