Ascomae
(Ckuetbach)
May 20, 2009, 5:14pm
1
Hallo,
I've got some trouble with upgrading my application from 1.0.1 to 1.0.5:
I have a simple URL-Rule:
'web/<path:(.*)>'=>'pages/show'
in 1.0.0 - 1.0.2 I get the following result:
/web/interessen/index.php will be generated as new Link
in 1.0.3
Invalid argument supplied for foreach()
[...]
00115: protected function afterFind()
00116: {
00117: $tags=$this->tags;
00118: $tagInputs=array();
00119: foreach($tags as $tag)
00120: $tagInputs[]=$tag->name;
00121: $this->tagInput=implode(', ',$tagInputs);
00122: }
in 1.0.4 and 1.0.5
/web/interessen%2Findex.php will be generated
I think there may be a problem with masquarading the parameter.
May be it was a bug in 1.0.1 - 1.0.3. But how do i create an URL like that?
By the way, I create the links this way:
<?php echo CHtml::link($item['label'],array('pages/show','path'=>$item['url']), array('class'=>'smnlnk')); ?>
Christian
PS:
I checked out alls tagged Yii versions. The only thing i changed between the tries was the path to the framework.
qiang
(Qiang Xue)
May 20, 2009, 6:45pm
2
The behavior in 1.0.4 and 1.0.5 is expected because the slash '/' is url-encoded (in general, you should avoid putting slashes in GET variable names and values).
I'm not sure why 1.0.3 is causing an error. Maybe it's because of cache you enabled?
Ascomae
(Ckuetbach)
May 20, 2009, 7:07pm
3
I changed no line of code or configuration. I just took another framework-version.
I try to hide the index.php to create "virtual files".
The path would look like:
domain.tld/web/interests/index.php
and not
domain.tld/index.php?r=page/show&path=interests%2Findex.php
I thought this is a main feature of the url rewriting.
Christian
Ascomae
(Ckuetbach)
July 30, 2009, 6:51pm
4
Why should a "/" be a problem in a get-variable?
Lots of Websites uses them.
In fact I create a
CHtml::link($item['label'],array('pages/show','path'=>'/virtual/index.php'), array());
before 1.0.3 it worked great.
if i configure a rule like that:
'urlManager'=>array(
'urlFormat'=>'path',
'rules'=>array(
'web/<path:(.*)>'=>'pages/show',
...
will be produced (doesn’t work).
/yiitest/trunk/index.php/web/virtual%2Findex.php
'urlManager'=>array(
//'urlFormat'=>'path',
'rules'=>array(
//'web/<path:(.*)>'=>'pages/show',
...
will produce a working link like this:
/yiitest/trunk/index.php?r=pages/show&path=virtual%2Findex.php
I think its a Bug in the rewrite mechanism. If the parameter isn’t treatet as url-paramter key=val.it should not be urlencoded.
Regards,
christian
qiang
(Qiang Xue)
July 30, 2009, 7:05pm
5
I couldn’t reproduce this issue. I had this rule in the test: ‘index/<param:(.*)>’=>‘site/index’
Accessing URL “/index.php/index/abc/def” shows that $_GET[‘param’]=‘abc/def’
And creating URL <?php echo $this->createUrl(‘site/index’,array(‘param’=>‘test/abc’)); ?> gives /index.php/index/test%2Fabc
Ascomae
(Ckuetbach)
July 31, 2009, 7:59pm
6
qiang:
I couldn’t reproduce this issue. I had this rule in the test: ‘index/<param:(.*)>’=>‘site/index’
Accessing URL “/index.php/index/abc/def” shows that $_GET[‘param’]=‘abc/def’
And creating URL <?php echo $this->createUrl(‘site/index’,array(‘param’=>‘test/abc’)); ?> gives /index.php/index/test%2Fabc
Well i think, that url should not be '/index.php/index/test%2Fabc. It should be ‘/index.php/index/test/abc’.
But that seems not to be my problem. I get an apache 404, while i try to access that url. If I change the %2F to / that page will be found.
If I set the path (param in your example) to a non existing key I get my Yii-404 page. It seems, that my Yii-App isn’t called at all, if there is the %2F in the url
Update:
http://localhost/yiitest/trunk/index.php/asd/asd
-> invokes my Yii-Application
http://localhost/yiitest/trunk/index.php/asd%2Fasd
-> Apache 404
I don’t know if this is a Apache problem or a Yii-Error.
Regards,
Christian
Ascomae
(Ckuetbach)
July 31, 2009, 8:35pm
7
I solved one part of my problem.
AllowEncodedSlashes On
included to my httpd.conf solved the 404-problem.
But my url is still ugly (%2F). Is there a standard, witch forbids un encoded ‘/’ in th PATH_INFO ?
Christian