Closed asaokamei closed 9 years ago
@asaokamei Your example creates the expected URI without double slashes. Do you have this issue with the current version?
@micheh Yes, it still fails with the current 3.x branch. So, I made a PR #1413; I hope that was OK...
Here's the output from the phpunit.
vendor/bin/phpunit
PHPUnit 4.7.7 by Sebastian Bergmann and contributors.
............................................................... 63 / 357 ( 17%)
............................................................... 126 / 357 ( 35%)
............................................................... 189 / 357 ( 52%)
............................................................... 252 / 357 ( 70%)
............................................................... 315 / 357 ( 88%)
.........F................................
Time: 906 ms, Memory: 7.75Mb
There was 1 failure:
1) Slim\Tests\Http\UriTest::testWithPathWhenBaseRootIsEmpty
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'http://localhost/test'
+'http://localhost//test'
/Users/asao/vm/ubuntu1310/shared/www/Slim/tests/Http/UriTest.php:582
/Users/asao/vm/ubuntu1310/shared/www/Slim/vendor/phpunit/phpunit/phpunit:36
FYI, the PHP is version 5.6.5
php -v
PHP 5.6.5 (cli) (built: Feb 12 2015 10:39:21)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies
with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies
with Xdebug v2.2.5, Copyright (c) 2002-2014, by Derick Rethans
Thanks for the PR. The test passes in a Windows environment, where the directory separator is a backslash. The problem is this line, where the base path is set to /
: https://github.com/slimphp/Slim/blob/3.x/Slim/Http/Uri.php#L200
This is fixed in #1411 and your test will pass once the PR is merged.
Hi,
When setting a relative path using
withPath
method when no basePath is present (i.e. just '/'), the generated URI contains double slashes.example:
the current result is
where it should be
thanks,