tel8618217223380 / prado3

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

Patch for minor error in TUrlMappingPattern r3261 #460

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Wildcard Parameters do not work anymore with r3261 applied.
The following patch fixes the issue for me.

Sample application.xml configuration:
>     <module id="friendly-url" class="System.Web.TUrlMapping" 
EnableCustomUrl="true" UrlPrefix="/frontend">
>         <url class="CultureMapping" ServiceParameter="CP.*" pattern="CP/{*}" 
UrlFormat="HiddenPath" />
>     </module>

Cheers,
Raoul
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
- -
diff --git a/framework/Web/TUrlMapping.php b/framework/Web/TUrlMapping.php
index dfbaad3..7fde7af 100644
--- a/framework/Web/TUrlMapping.php
+++ b/framework/Web/TUrlMapping.php
@@ -896,7 +896,7 @@ class TUrlMappingPattern extends TComponent
                // for the GET variables matching the pattern, put them in the URL path
                foreach($getItems as $key=>$value)
                {
-                       if($this->_parameters && 
($this->_parameters->contains($key) || $key==='*' && 
$this->getIsWildCardPattern()))
+                       if(($this->_parameters && 
$this->_parameters->contains($key)) || ($key==='*' && 
$this->getIsWildCardPattern()))
                                $replace['{'.$key.'}']=$encodeGetItems ? rawurlencode($value) : $value;
                        else
                                $extra[$key]=$value;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
- -

Original issue reported on code.google.com by ra...@bhatia.at on 30 Apr 2013 at 12:34

GoogleCodeExporter commented 9 years ago
This patch changes the if statement in the following way:

OLD:   if (A->x() || B && C)
r3261: if (A && (A->x() || B && C))
patch: if ((A && A->x()) || (B && C))

please note:
the B && C check aka ($key==='*' && $this->getIsWildCardPattern()) check
is unrelated to A and should work even if A does not exist.

with r3261, A isn't initialized anymore during __construct() thus leading the 
the
if statement to be false.

Thanks for your efforts - i hope i can contribute a little bit as well :)
Raoul

Original comment by ra...@bhatia.at on 30 Apr 2013 at 12:37

GoogleCodeExporter commented 9 years ago
committed as r3289, thank you!

Original comment by ctrlal...@gmail.com on 4 May 2013 at 2:03