contains an invalid cURL option¶
Description¶
curl_setopt()
uses a cURL option as second parameter. These options are PHP native constants, and use the prefix CURLOPT_
, which resolve to an integer.
It is possible to use the equivalent integer to set a cURL option, for example via a variable. The value of this variable must be checked to be a valid cURL constant before usage.
Using another type instead of a cURL constant is reported as an error of type.
Example¶
<?php
$ch = curl_init(http://www.example.com/);
$fp = fopen(example_homepage.txt, w);
curl_setopt($ch, 12332, $fp);
curl_setopt($ch, 'abc', $fp);
?>
Solutions¶
Use the
CURLOPT_*
constant.Check that the intended value may be resolved as a
CURLOPT_*
constant (CURLOPT_APPEND
=== 50, so 50 may be used; etc.).