Skip to content

Commit 6012a6f

Browse files
committed
Merge branch '2.8' into 3.4
* 2.8: [Intl] Update ICU data to 61.1 [Validator] Add Japanese translation Support phpdbg SAPI in Debug::enable() [Ldap] cast to string when checking empty passwords [Validator] sync validator translation id no type errors with invalid submitted data types [FrameworkBundle] Partially revert HttpCache is not longer abstract (4d075da) [Finder] Fixed leading/trailing / in filename allow html5 compatible rendering of forms with null names Change datetime input to datetime-local
2 parents 611b100 + bd56f5f commit 6012a6f

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

SplFileInfo.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class SplFileInfo extends \SplFileInfo
2828
*/
2929
public function __construct($file, $relativePath, $relativePathname)
3030
{
31-
parent::__construct($file);
31+
parent::__construct(realpath($file) ?: $file);
3232
$this->relativePath = $relativePath;
3333
$this->relativePathname = $relativePathname;
3434
}

Tests/FinderTest.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,20 @@ public function testFiles()
4646
$this->assertIterator($this->toAbsolute(array('foo/bar.tmp', 'test.php', 'test.py', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
4747
}
4848

49+
public function testRemoveTrailingSlash()
50+
{
51+
if ('\\' === \DIRECTORY_SEPARATOR) {
52+
$this->markTestSkipped('This test cannot be run on Windows.');
53+
}
54+
55+
$finder = $this->buildFinder();
56+
57+
$expected = $this->toAbsolute(array('foo/bar.tmp', 'test.php', 'test.py', 'foo bar'));
58+
$in = '//'.realpath(self::$tmpDir).'//';
59+
60+
$this->assertIterator($expected, $finder->in($in)->files()->getIterator());
61+
}
62+
4963
public function testDepth()
5064
{
5165
$finder = $this->buildFinder();
@@ -514,8 +528,8 @@ public function testMultipleLocationsWithSubDirectories()
514528
$finder->in($locations)->depth('< 10')->name('*.neon');
515529

516530
$expected = array(
517-
__DIR__.'/Fixtures/one'.DIRECTORY_SEPARATOR.'b'.DIRECTORY_SEPARATOR.'c.neon',
518-
__DIR__.'/Fixtures/one'.DIRECTORY_SEPARATOR.'b'.DIRECTORY_SEPARATOR.'d.neon',
531+
__DIR__.DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.'one'.DIRECTORY_SEPARATOR.'b'.DIRECTORY_SEPARATOR.'c.neon',
532+
__DIR__.DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.'one'.DIRECTORY_SEPARATOR.'b'.DIRECTORY_SEPARATOR.'d.neon',
519533
);
520534

521535
$this->assertIterator($expected, $finder);

0 commit comments

Comments
 (0)