filerepo: always use realpath()
authorAntoine Musso <hashar@users.mediawiki.org>
Mon, 9 Jan 2012 13:40:09 +0000 (13:40 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Mon, 9 Jan 2012 13:40:09 +0000 (13:40 +0000)
commit42dee711d89daf338ae6c6898d6e951a274f6d37
tree6a6ec9877fad6e6109d33d0a3e3a448c136847ad
parent6cc12777484a775917ff8998cc04bd2f9fb613cc
filerepo: always use realpath()

The suffix to strip was determined using realpath() but applied on
the given path. This could lead to errors when the path is made of
a symbolic link or use consecutives slashes.
Example on Mac OS:

$ php -a
php > print realpath( '/private///tmp' );
/private/tmp
php > print realpath( '///tmp///////' );
/private/tmp
php >
$

Fix FileBackendTest::testGetFileList test which failed with:

1) FileBackendTest::testGetFileList
Correct file listing (FSFileBackend).
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
 Array (
-    0 => 'subdir1/test1.txt'
-    1 => 'subdir1/test2.txt'
-    2 => 'subdir2/subdir/sub/120-px-file.txt'
-    3 => 'subdir2/subdir/sub/test0.txt'
-    4 => 'subdir2/subdir/test1.txt'
-    5 => 'subdir2/subdir/test2.txt'
-    6 => 'subdir2/subdir/test3.txt'
-    7 => 'subdir2/subdir/test4.txt'
-    8 => 'subdir2/subdir/test5.txt'
-    9 => 'subdir2/test3.txt'
-    10 => 'subdir2/test4.txt'
-    11 => 'test1.txt'
-    12 => 'test2.txt'
-    13 => 'test3.txt'
+    0 => '/subdir/sub/120-px-file.txt'
+    1 => '/subdir/sub/test0.txt'
+    2 => '/subdir/test1.txt'
+    3 => '/subdir/test2.txt'
+    4 => '/subdir/test3.txt'
+    5 => '/subdir/test4.txt'
+    6 => '/subdir/test5.txt'
+    7 => '/test1.txt'
+    8 => '/test2.txt'
+    9 => '/test3.txt'
+    10 => '/test4.txt'
+    11 => 'xt'
+    12 => 'xt'
+    13 => 'xt'
 )
includes/filerepo/backend/FSFileBackend.php