WordPress / WordPress/Requests

PHP Warning when curl_exec() is disabled

Open
#269 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
3.6k
Forks
500
Avg merge
2d 21h
Merged PRs (30d)
5

Description

We're getting this warning from WordPress from time to time:

curl_exec() has been disabled for security reasons

It seems to me that this test is not enough to determine if curl is available:

https://github.com/rmccue/Requests/blob/master/library/Requests/Transport/cURL.php#L528

This simple test shows that function_exists() still returns true when curl_exec is disabled using disable_functions:

var_dump(ini_get('disable_functions'));
var_dump(function_exists('curl_exec'));
string(241) "… curl_exec …" 
bool(true)

I'm thinking that an additional test for if curl_exec or curl_init is present in the disable_functions ini setting should solve this issue.

Would you consider a PR with such a change? Thanks

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at library/Requests/Transport/cURL.php around line 528 and inspect how cURL availability is checked. Reproduce the disabled-function configuration described in the issue, then add coverage for it and verify that Requests no longer emits the PHP warning when curl_exec() or curl_init() is disabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
api, backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.