JaquelineBrandao / yii

Automatically exported from code.google.com/p/yii
0 stars 0 forks source link

urlSuffix "/" is not enforced #778

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
When CUrlManager::$urlSuffix is set to "/" and even if
CUrlManager::$useStrictParsing is enabled, this url

http://example.com/test

will match this rule

'test' => 'site/test'

The related problem is that CHttpRequest::getPathInfo() trims '/' of the
returned path. That means CUrlManager::removeUrlSuffix() has no effect
inside of the parseUrl() methods when $urlSuffix is set to '/'. I know
there is already a fix related to the slash issue (on line 658 in
CUrlManager.php, latest version from trunk):

> if($urlSuffix!='' && $urlSuffix!=='/')

But that fix only makes sure that the suffix '/' works at least. See:
http://code.google.com/p/yii/issues/detail?id=534

I suggest to rewrite the CUrlManager::parseUrl() method. For example on
line 297:

> $rawPathInfo=urldecode($request->getPathInfo());
> $pathInfo=$this->removeUrlSuffix($rawPathInfo,$this->urlSuffix);
> foreach($this->_rules as $rule)
> {
>    if(($r=$rule->parseUrl($this,$request,$pathInfo,$rawPathInfo))!==false)
>         return isset($_GET[$this->routeVar]) ? $_GET[$this->routeVar] : $r;
> }

Somewhere in there you could check if the urlSuffix is '/' and then pass
the correct pathInfo to $rule->parseUrl(...)

Let me know what you think. Thanks.

Original issue reported on code.google.com by keyboard...@gmail.com on 2 Jan 2010 at 9:32

GoogleCodeExporter commented 9 years ago

Original comment by qiang.xue on 31 Jan 2010 at 9:21

GoogleCodeExporter commented 9 years ago
Set for next release.

Original comment by qiang.xue on 13 Mar 2010 at 2:18

GoogleCodeExporter commented 9 years ago
Move to 1.1.3 release.

Original comment by qiang.xue on 2 May 2010 at 2:19

GoogleCodeExporter commented 9 years ago

Original comment by qiang.xue on 6 Jul 2010 at 4:57

GoogleCodeExporter commented 9 years ago
Move to 1.1.4.

Original comment by qiang.xue on 2 Sep 2010 at 4:09

GoogleCodeExporter commented 9 years ago
1.1.5

Original comment by qiang.xue on 2 Sep 2010 at 4:09

GoogleCodeExporter commented 9 years ago
Out of time. Set for 1.1.6 milestone.

Original comment by qiang.xue on 12 Nov 2010 at 1:54

GoogleCodeExporter commented 9 years ago
Set for next milestone.

Original comment by qiang.xue on 15 Jan 2011 at 7:25

GoogleCodeExporter commented 9 years ago
Out of time. Move to next milestone.

Original comment by qiang.xue on 26 Mar 2011 at 5:58

GoogleCodeExporter commented 9 years ago

Original comment by alexander.makarow on 1 Jul 2011 at 8:15

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
set for 1.1.10 milestone

Original comment by qiang.xue on 1 Jan 2012 at 3:36

GoogleCodeExporter commented 9 years ago
set for 1.1.10 milestone

Original comment by qiang.xue on 1 Jan 2012 at 3:37

GoogleCodeExporter commented 9 years ago
set for 1.1.10 milestone

Original comment by qiang.xue on 1 Jan 2012 at 3:37

GoogleCodeExporter commented 9 years ago

Original comment by qiang.xue on 13 Feb 2012 at 3:09

GoogleCodeExporter commented 9 years ago
Migrated to http://github.com/yiisoft/yii/issues/86

Original comment by qiang.xue on 15 Feb 2012 at 6:45