I use the WordPress to Dropbox backup plugin on many of my WordPress installs and, up until I changed the setup to use PHP7, things were working great.

Thanks to the post from smowton over on the wordpress.org support channel, it is now working again.

The backup plugin was throwing errors in the logs about curl and an unexpected “overwrite” parameter. E.g.
Warning: curl_setopt_array(): Disabling safe uploads is no longer supported in /srv/users/mjburton/apps/mjburton/public/wp-content/plugins/wordpress-backup-to-dropbox/Dropbox/Dropbox/OAuth/Consumer/Curl.php on line 92

The fix is as follows:

All paths are relative to $YOUR_SITE_DIRECTORY/wp-content/plugins/wordpress-backup-to-dropbox.

In file Dropbox/Dropbox/OAuth/Consumer/Curl.php:
comment out the line:
$options[CURLOPT_SAFE_UPLOAD] = false;
(this option is no longer valid in PHP 7)

In file Dropbox/Dropbox/OAuth/Consumer/ConsumerAbstract.php: replace the test if (isset($value[0]) && $value[0] === '@') with if ($value instanceof CURLFile)

In file Dropbox/Dropbox/API.php: replace 'file' => '@' . str_replace('\\', '/', $file) . ';filename=' . $filename with 'file' => new CURLFile(str_replace('\\', '/', $file), "application/octet-stream", $filename)

This replaces the long-deprecated, now-disabled support for uploading files with “@/file/to/upload” with the replacement “CURLFile” class. Also a note to the author (and optional patch for the reader): check the return value for curl_setopt_array, as this was failing unnoticed, leading to confusing behaviour downstream.

Comments are closed.

Post Navigation