BryanDavis has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/174865

Change subject: Fix AutoloadGenerator to work on MediaWiki-Vagrant
......................................................................

Fix AutoloadGenerator to work on MediaWiki-Vagrant

The use of realpath() in AutoloadGenerator::readFile() causes the
LocalSettings.php symlink to be dereferenced. Since the target file
lives outside of $IP, AutoloadGenerator would fail with an exception.

Change-Id: I4623b3da9b984026999189d70349ffb4754812a5
---
M includes/utils/AutoloadGenerator.php
1 file changed, 3 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/65/174865/1

diff --git a/includes/utils/AutoloadGenerator.php 
b/includes/utils/AutoloadGenerator.php
index 98efd27..727f485 100644
--- a/includes/utils/AutoloadGenerator.php
+++ b/includes/utils/AutoloadGenerator.php
@@ -81,19 +81,15 @@
         * @var string $inputPath Path to a php file to find classes within
         */
        public function readFile( $inputPath ) {
-               $path = realpath( $inputPath );
-               if ( !$path ) {
-                       throw new \Exception( "Invalid path: $inputPath" );
-               }
                $len = strlen( $this->basepath );
-               if ( substr( $path, 0, $len ) !== $this->basepath ) {
+               if ( substr( $inputPath, 0, $len ) !== $this->basepath ) {
                        throw new \Exception( "Path is not within basepath: 
$inputPath" );
                }
                $result = $this->collector->getClasses(
-                       file_get_contents( $path )
+                       file_get_contents( $inputPath )
                );
                if ( $result ) {
-                       $shortpath = substr( $path, $len );
+                       $shortpath = substr( $inputPath, $len );
                        $this->classes[$shortpath] = $result;
                }
        }

-- 
To view, visit https://gerrit.wikimedia.org/r/174865
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4623b3da9b984026999189d70349ffb4754812a5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: BryanDavis <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to