Skip to content

Commit

Permalink
[Filesystem] Fixed warnings in makePathRelative().
Browse files Browse the repository at this point in the history
  • Loading branch information
jakzal committed Apr 7, 2012
1 parent c9ed9c2 commit ab724d7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Filesystem.php
Expand Up @@ -180,7 +180,7 @@ public function makePathRelative($endPath, $startPath)
{
// Find for which character the the common path stops
$offset = 0;
while ($startPath[$offset] === $endPath[$offset]) {
while (isset($startPath[$offset]) && isset($endPath[$offset]) && $startPath[$offset] === $endPath[$offset]) {
$offset++;
}

Expand Down
3 changes: 2 additions & 1 deletion Tests/FilesystemTest.php
Expand Up @@ -444,7 +444,8 @@ public function providePathsForMakePathRelative()
$paths = array(
array('/var/lib/symfony/src/Symfony/', '/var/lib/symfony/src/Symfony/Component', '../'),
array('var/lib/symfony/', 'var/lib/symfony/src/Symfony/Component', '../../../'),
array('/usr/lib/symfony/', '/var/lib/symfony/src/Symfony/Component', '../../../../../../usr/lib/symfony/')
array('/usr/lib/symfony/', '/var/lib/symfony/src/Symfony/Component', '../../../../../../usr/lib/symfony/'),
array('/var/lib/symfony/src/Symfony/', '/var/lib/symfony/', '../src/Symfony/'),
);

// fix directory separator
Expand Down

0 comments on commit ab724d7

Please sign in to comment.