Skip to content

Refactor Curl execution and error handling - #16

Merged
kristho91 merged 1 commit into
inMobile:masterfrom
dahn15:patch-1
Oct 7, 2026
Merged

kristho91 merged 1 commit into
inMobile:masterfrom
dahn15:patch-1

Conversation

@dahn15

@dahn15 dahn15 commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

curl_close() has had no effect since PHP 8.0 and is deprecated as of PHP 8.5, which triggers an E_DEPRECATED notice on every request. The call is now only made on PHP < 8.0, so PHP 7.4 support is preserved.

Also changed the curl_exec() check to === false, since an empty response body (e.g. 204 No Content) previously threw a CurlException with error code 0.

curl_close() has had no effect since PHP 8.0 and is deprecated as of PHP 8.5,
which triggers an E_DEPRECATED notice on every request. The call is now only
made on PHP < 8.0, so PHP 7.4 support is preserved.

Also changed the curl_exec() check to `=== false`, since an empty response
body (e.g. 204 No Content) previously threw a CurlException with error code 0.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

The empty-response fix needs regression coverage.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
What changed in this PR

Refines cURL response handling across supported PHP versions.

Changes:

  • Accepts successful empty response bodies.
  • Avoids deprecated curl_close() calls on PHP 8+.
File Description
src/​CurlClient.php Updates execution checks and version-specific cleanup.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/CurlClient.php Resolved
@kristho91
kristho91 merged commit 724f07d into inMobile:master Oct 7, 2026
7 checks passed
@kristho91

Copy link
Copy Markdown
Contributor

Hi @dahn15
Thank you for this contribution!

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.

3 participants