Happened to have an old product which was at one time using DropBox File Store for its files. That plugin is now disabled but the paths remain. So when I purchase a download which has files which were uploaded using DropBox but DBFS is disabled, I get a page full of errors, starting with:
Warning: file_exists(): Unable to find the wrapper "edd-dbfs" - did you forget to enable it when you configured PHP? in .../edd.dev/wp-content/plugins/easy-digital-downloads/includes/process-download.php on line 144
and followed by "headers already sent" errors.
Reactivating DBFS results in the process completing successfully.
We could possibly fix this by confirming the file is a valid URL / path before attempting to check that it exists.
We could check that the $file_details['scheme'] is in the list of stream_get_wrappers()...which is what the wrapper for DBFS would be registered in.
This way we could fail gracefully in more than just the DBFS case.
Ok so the fun part here is that when DBFS is enabled, the URLs are converted over to HTTPS by the DBFS addon, but when DBFS isn't active, it just serves up with the edd-dbfs scheme...so what this PR does is detects invalid schemes that aren't supported by streams, and ditches.
In reality, we should never deliver a file incorrectly now since schemes that aren't registered are ditched.
To test this, setup DBFS, assign a download to a file in Dropbox and then deactivate the plugin.
You should get a 501 WP_Die error. When the plugin is active, all works just fine.
Tested and working fine.
It looks like this may be causing some problems with file downloading. We have 3 tickets open about it right now:
https://secure.helpscout.net/search/?query=%22Error%20downloading%20File%22
The line added in this issue is the only place in EDD where I can find "Error downloading file. Please contact support."
Based on learning about the stream_get_wrappers function, I suppose the type of file they are delivering is not support in their PHP settings?
@mintplugins the tickets we've seen, while it caused this error, the files, when removing this call, were corrupt. If you have access to any of these sites, please comment out the wp_die line and see if the file actually downloads successfully.
the other thing that fixes it are File downloads being Redirect with symlink.
Are these 3 sites running Windows by any chance?
@cklosowski Yes all are running Windows who are affected.
Ok thanks, I'm going to open a new issue to just bypass this on Windows machines.
Most helpful comment
We could check that the
$file_details['scheme']is in the list ofstream_get_wrappers()...which is what the wrapper for DBFS would be registered in.This way we could fail gracefully in more than just the DBFS case.