Last modified: 2013-09-11 21:03:20 UTC
PHP has native stream support for URLs, i.e., if you pass http://www.google.com to any of fopen, fgets, etc., it will work perfectly. However, since stat() calls don't work on URLs, calls to file_exists and is_readable will return false for all URLs, even if the URL actually exists. This causes problems if a FileBackend instance uses URLs as its local references, which makes sense because there would be no need to download and copy the file. BitmapHandler will check file_exists before transforming the file, and then fail erroneously. (Note: The imagecreatefromjpeg in PHP does support URLs, so it doesn't need a local copy for thumbnailing to work.) In cases where a URL would work fine as a file stream, file_exists should be bypassed in the case a URL is given. It might even be a good idea to make a global function for this, i.e., wfFileExists, which appropriately checks if the file exists as a URL or as a file.
https://gerrit.wikimedia.org/r/51893
https://gerrit.wikimedia.org/r/51893 (Gerrit Change Ib5a2684ab77dca4d3ba0c060bc0100935d411a23) | change ABANDONED [by Parent5446]
Brian's comment: > Most of the cases are specificly asking if the file exists locally. Not if it > can be opened with magic fopen stuff. > > For the actual media handlers - most of them assume a local file to work with > (they pass file names to binaries, etc). I see no reason to break this > assumption. The relavent file backend should just download the files when a > local reference is needed. Unless somebody disagrees, might as well close this as WONTFIX.
Closing per above notes.