Skip to content

Commit

Permalink
WP/AlternativeFunctions: allow calling curl_version()
Browse files Browse the repository at this point in the history
`curl_version()` doesn't create or need a cURL resource, so is perfectly fine to use.

Ref: http://php.net/manual/en/function.curl-version.php
  • Loading branch information
jrfnl committed Mar 7, 2019
1 parent 95b904e commit a6dbd88
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions WordPress/Sniffs/WP/AlternativeFunctionsSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,10 @@ public function process_matched_token( $stackPtr, $group_name, $matched_content
unset( $first_param );

break;

case 'curl_version':
// Curl version doesn't actually create a connection.
return;
}

if ( ! isset( $this->groups[ $group_name ]['since'] ) ) {
Expand Down
2 changes: 2 additions & 0 deletions WordPress/Tests/WP/AlternativeFunctionsUnitTest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,5 @@ $output_stream = fopen( 'php://fd/3', 'w' ); // OK.
$fp = fopen("php://temp/maxmemory:$fiveMBs", 'r+'); // OK.
readfile( 'php://filter/resource=http://www.example.com' ); // Warning.
file_put_contents("php://filter/write=string.rot13/resource=example.txt","Hello World"); // Warning.

curl_version(); // OK.

0 comments on commit a6dbd88

Please sign in to comment.