WebStart: Remove use of realpath() for $IP
authorTimo Tijhof <krinklemail@gmail.com>
Tue, 28 Nov 2017 04:46:38 +0000 (20:46 -0800)
committerKrinkle <krinklemail@gmail.com>
Wed, 29 Nov 2017 21:51:44 +0000 (21:51 +0000)
When installing MediaWiki in a sub directory of document root,
and including it from an /index.php file in the document root,
MediaWiki succesfully includes WebStart from index.php, but
WebStart.php fails to include Setup.php.

For example, MediaWiki installation at /var/www/mediawiki with the
following file at /var/www/index.php.

```
<?php
require __DIR__ . '/mediawiki/index.php';
```

Failure:

> Fatal error:
> require_once(): Failed opening required '/var/www/includes/Setup.php'
> (include_path='.:/usr/local/lib/php') in
> /var/www/mediawiki/includes/WebStart.php on line 97
>
> Stack trace:
>   1. {main}() /var/www/index.php:0
>   2. require() /var/www/index.php:3
>   3. require() /var/www/mediawiki/index.php:40

Bug: T153882
Change-Id: Icd8cfa580ce1c22bc3bf177570a9f4a940d2427c

includes/WebStart.php

index e4d93f9..be95779 100644 (file)
@@ -50,13 +50,10 @@ unset( $IP );
 # its purpose.
 define( 'MEDIAWIKI', true );
 
-# Full path to working directory.
-# Makes it possible to for example to have effective exclude path in apc.
-# __DIR__ breaks symlinked includes, but realpath() returns false
-# if we don't have permissions on parent directories.
+# Full path to the installation directory.
 $IP = getenv( 'MW_INSTALL_PATH' );
 if ( $IP === false ) {
-       $IP = realpath( '.' ) ?: dirname( __DIR__ );
+       $IP = dirname( __DIR__ );
 }
 
 // If no LocalSettings file exists, try to display an error page