10000 [Filesystem] Fixed warnings in makePathRelative(). · symfony/symfony@100e97e · GitHub
[go: up one dir, main page]

Skip to content

Commit 100e97e

Browse files
committed
[Filesystem] Fixed warnings in makePathRelative().
1 parent f5f5c21 commit 100e97e

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/Symfony/Component/Filesystem/Filesystem.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ public function makePathRelative($endPath, $startPath)
180180
{
181181
// Find for which character the the common path stops
182182
$offset = 0;
183-
while ($startPath[$offset] === $endPath[$offset]) {
183+
while (isset($startPath[$offset]) && isset($endPath[$offset]) && $startPath[$offset] === $endPath[$offset]) {
184184
$offset++;
185185
}
186186

src/Symfony/Component/Filesystem/Tests/FilesystemTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,8 @@ public function providePathsForMakePathRelative()
444444
$paths = array(
445445
array('/var/lib/symfony/src/Symfony/', '/var/lib/symfony/src/Symfony/Component', '../'),
446446
array('var/lib/symfony/', 'var/lib/symfony/src/Symfony/Component', '../../../'),
447-
array('/usr/lib/symfony/', '/var/lib/symfony/src/Symfony/Component', '../../../../../../usr/lib/symfony/')
447+
array('/usr/lib/symfony/', '/var/lib/symfony/src/Symfony/Component', '../../../../../../usr/lib/symfony/'),
448+
array('/var/lib/symfony/src/Symfony/', '/var/lib/symfony/', '../src/Symfony/'),
448449
);
449450

450451
// fix directory separator

0 commit comments

Comments
 (0)
0