Skip to content

Commit

Permalink
FIX Double backslashes do not result in double periods
Browse files Browse the repository at this point in the history
  • Loading branch information
robbieaverill committed Jul 3, 2017
1 parent 3244720 commit 5ba1b12
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Lookup.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public function setUpgraderMap($map)
*/
public function sanitiseNamespaces($class)
{
return str_replace('\\', '.', ltrim($class, '\\'));
return preg_replace("/(\\\\+)/", '.', ltrim($class, '\\'));
}

/**
Expand Down
4 changes: 4 additions & 0 deletions tests/LookupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ public function handleProvider()
array('q' => '\Already\Fully\Qualified', 'version' => '3.4'),
'http://mockserver/3.4/class-Already.Fully.Qualified.html'
),
array(
array('q' => '\\\\Already\\\\Fully\\\\Qualified', 'version' => '3.4'),
'http://mockserver/3.4/class-Already.Fully.Qualified.html'
),
array(
array('q' => 'Director', 'module' => 'framework'),
'http://mockserver/master/class-SilverStripe.Control.Director.html'
Expand Down

0 comments on commit 5ba1b12

Please sign in to comment.