Last modified: 2013-09-11 21:03:20 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T47663, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 45663 - URLs can exist, but file_exists says otherwise
URLs can exist, but file_exists says otherwise
Status: RESOLVED WONTFIX
Product: MediaWiki
Classification: Unclassified
File management (Other open bugs)
unspecified
All All
: Normal normal (vote)
: ---
Assigned To: Tyler Romeo
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-03-03 13:48 UTC by Tyler Romeo
Modified: 2013-09-11 21:03 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Tyler Romeo 2013-03-03 13:48:23 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.
Comment 1 Tyler Romeo 2013-03-03 14:27:21 UTC
https://gerrit.wikimedia.org/r/51893
Comment 2 Gerrit Notification Bot 2013-05-18 18:12:51 UTC
https://gerrit.wikimedia.org/r/51893 (Gerrit Change Ib5a2684ab77dca4d3ba0c060bc0100935d411a23) | change ABANDONED [by Parent5446]
Comment 3 Tyler Romeo 2013-05-18 19:10:43 UTC
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.
Comment 4 Brion Vibber 2013-09-11 21:03:20 UTC
Closing per above notes.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links