Last modified: 2014-08-17 11:38:24 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 T46953, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 44953 - AutoLoader adds $IP to network share path
AutoLoader adds $IP to network share path
Status: UNCONFIRMED
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
1.20.x
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-02-13 15:49 UTC by kevinrose
Modified: 2014-08-17 11:38 UTC (History)
4 users (show)

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


Attachments

Description kevinrose 2013-02-13 15:49:42 UTC
I am running under IIS with the files stored on network storage.
I get an error from line 1142 in includes\AutoLoader.php when the $filename being passed is already a network share. Specifically in my case it then adds $IP a second time.

Here are the variables from my situation:

From debugging we know that:
$IP is set to "\\server\share\mediawiki"

The offending class being loaded in LocalSettings.php:

require_once("$IP/extensions/WikiEditor/WikiEditor.php" );

After line 1142 $filename = "\\server\share\mediawiki\\server\share\mediawiki\extensions\WikiEditor\WikiEditor.php"

Line 1140 checks if the first character is a / (root), or the second character is a : (windows local drive).

To work around the problem I added a third check, that the second character is a slash (windows network share):

		if ( substr( $filename, 0, 1 ) != '/' && substr( $filename, 1, 1 ) != ':' && substr( $filename, 1, 1 ) != '\\') {
Comment 1 kevinrose 2013-02-13 15:50:29 UTC
Sorry to avoid confusion - the actual error is at line 1145 when the incorrect $filename tries to get required.
Comment 2 Krinkle 2013-02-13 23:42:02 UTC
I think you're confusing "require" with "autoloading".

The require_once() call you mention:
> require_once("$IP/extensions/WikiEditor/WikiEditor.php" );

that isn't a class but an extension file. This is your own code and placed in your LocalSettings.php, correct?

AutoLoader isn't involved there.


> After line 1142 $filename =
> "\\server\share\mediawiki\\server\share\mediawiki\extensions\WikiEditor\WikiEditor.php"

Line 1142/1145 of which file? Assuming AutoLoader.php, why is WikiEditor listed in your autoloader configuration?
Comment 3 Krinkle 2013-03-06 05:07:39 UTC
Please confirm that this is a MediaWiki related problem. Otherwise this issue should be closed.
Comment 4 michael 2013-07-12 01:19:03 UTC
I experienced the same issue after upgrading to the latest version of GearHost.com's cloudsites platform, which too changed from local drive storage to a network share. Like the original poster, I found the same behavior. Additionally, though, I found that commenting the require_once("$IP/extensions/WikiEditor/WikiEditor.php" ); line would temporarily resolve the issue and allow MediaWiki to load, which suggests some dependency between require_once and the autoloader. I applied a similar change to the autoloader file which allowed to uncomment the require_once line successfully. I am running MediaWiki 1.19.1.
Comment 5 kevinrose 2013-07-16 13:22:14 UTC
I forgot about this bug - upgraded my mediawiki to latest snapshot of 1.22 and the issue came back.

The issue isn't related to a particular extension, but to the use of the AutoLoader.  Above the samples were with WikiEditor. This time I came across it with VisualEditor which uses AutoLoader.


In 1.22 latest snapshot 7/16/2013 line 1148-1152 of file includes\AutoLoader.php:

		# Make an absolute path, this improves performance by avoiding some stat calls
		if ( substr( $filename, 0, 1 ) != '/' && substr( $filename, 1, 1 ) != ':' ) {
			global $IP;
			$filename = "$IP/$filename";
		}



This handles the case where $filename is a linux full path (starting at /) or a windows full path (with the drive letter i.e. c:) but does not handle the case of a network share on windows (\\server\path)

Again fix in first message does address this:

if ( substr( $filename, 0, 1 ) != '/' && substr( $filename, 1, 1 ) !=
':' && substr( $filename, 0, 2 ) != '\\\\')

Adjusted to look specifically for two forward slashes in case there's some other case where one forward slash is ok?

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


Navigation
Links