Skip to content

Commit a6dbd88

Browse files
committed
WP/AlternativeFunctions: allow calling curl_version()
`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
1 parent 95b904e commit a6dbd88

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

WordPress/Sniffs/WP/AlternativeFunctionsSniff.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,10 @@ public function process_matched_token( $stackPtr, $group_name, $matched_content
273273
unset( $first_param );
274274

275275
break;
276+
277+
case 'curl_version':
278+
// Curl version doesn't actually create a connection.
279+
return;
276280
}
277281

278282
if ( ! isset( $this->groups[ $group_name ]['since'] ) ) {

WordPress/Tests/WP/AlternativeFunctionsUnitTest.inc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,5 @@ $output_stream = fopen( 'php://fd/3', 'w' ); // OK.
6666
$fp = fopen("php://temp/maxmemory:$fiveMBs", 'r+'); // OK.
6767
readfile( 'php://filter/resource=http://www.example.com' ); // Warning.
6868
file_put_contents("php://filter/write=string.rot13/resource=example.txt","Hello World"); // Warning.
69+
70+
curl_version(); // OK.

0 commit comments

Comments
 (0)