jakajancar / DropboxUploader

MIT License
203 stars 114 forks source link

DropboxUploader warns about a deprecated feature on PHP 5.5 #22

Closed krizalys closed 10 years ago

krizalys commented 11 years ago

Hello there,

With error_reporting = E_ALL and display_errors = 1, DropboxUploader warns about a deprecated feature on PHP 5.5

The full message looks like this: Deprecated function: curl_setopt(): The usage of the @filename API for file uploading is deprecated. Please use the CURLFile class instead in DropboxUploader->request() (line 125 of /xxx/drupal/sites/all/libraries/DropboxUploader/DropboxUploader.php).

Uploading the file still works, though.

Indeed, this depreciation is fully documented on the PHP website:

"CURLOPT_POSTFIELDS: The full data to post in a HTTP "POST" operation. To post a file, prepend a filename with @ and use the full path. The filetype can be explicitly specified by following the filename with the type in the format ';type=mimetype'. This parameter can either be passed as a urlencoded string like 'para1=val1&para2=val2&...' or as an array with the field name as key and field data as value. If value is an array, the Content-Type header will be set to multipart/form-data. As of PHP 5.2.0, value must be an array if files are passed to this option with the @ prefix. As of PHP 5.5.0, the @ prefix is deprecated and files can be sent using CURLFile."

(quoted from http://www.php.net/manual/en/function.curl-setopt.php)

It would be nice to fix it before PHP 5.5 becomes the mainstream version... May not happen anytime soon, I know ;)

Thanks, Krizalys

hakre commented 10 years ago

Thanks for reporting this. It has been fixed in v1.1.14

Sorry it got unnoticed so far.