diff options
| -rw-r--r-- | .gitattributes | 3 | ||||
| -rw-r--r-- | HISTORY | 1 | ||||
| -rw-r--r-- | framework/Web/TUrlMapping.php | 8 | ||||
| -rw-r--r-- | tests/FunctionalTests/tickets/protected/application.xml | 3 | ||||
| -rw-r--r-- | tests/FunctionalTests/tickets/protected/pages/Ticket922.page | 12 | ||||
| -rw-r--r-- | tests/FunctionalTests/tickets/protected/pages/Ticket922.php | 13 | ||||
| -rw-r--r-- | tests/FunctionalTests/tickets/tests/Ticket922TestCase.php | 18 | 
7 files changed, 53 insertions, 5 deletions
diff --git a/.gitattributes b/.gitattributes index 59824a42..1c18a97d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3103,6 +3103,8 @@ tests/FunctionalTests/tickets/protected/pages/Ticket897.page -text  tests/FunctionalTests/tickets/protected/pages/Ticket897.php -text  tests/FunctionalTests/tickets/protected/pages/Ticket900.page -text  tests/FunctionalTests/tickets/protected/pages/Ticket900.php -text +tests/FunctionalTests/tickets/protected/pages/Ticket922.page -text +tests/FunctionalTests/tickets/protected/pages/Ticket922.php -text  tests/FunctionalTests/tickets/protected/pages/Ticket93.page -text  tests/FunctionalTests/tickets/protected/pages/Ticket93.php -text  tests/FunctionalTests/tickets/protected/pages/ToggleTest.page -text @@ -3171,6 +3173,7 @@ tests/FunctionalTests/tickets/tests/Ticket876TestCase.php -text  tests/FunctionalTests/tickets/tests/Ticket886TestCase.php -text  tests/FunctionalTests/tickets/tests/Ticket897TestCase.php -text  tests/FunctionalTests/tickets/tests/Ticket900TestCase.php -text +tests/FunctionalTests/tickets/tests/Ticket922TestCase.php -text  tests/FunctionalTests/tickets/tests/Ticket93TestCase.php -text  tests/FunctionalTests/validators.php -text  tests/FunctionalTests/validators/index.php -text @@ -20,6 +20,7 @@ BUG: Ticket#897 - TSimpleDateFormatter: If no YearPattern is set it should defau  BUG: Ticket#899 - TSqlCriteria: SQL-statements with limit and offset doesn't work (Knut)  BUG: Ticket#904 - TDbConnection: Add emulate prepares workaround for boolean compares (Knut)  BUG: Ticket#908 - TDbCache::init / Exception (Knut) +BUG: Ticket#922 - Problem with TUrlMapping and urlencoding (Michael)  BUG: Ticket#938 - TPageStateFormatter EnableStateEncryption causes massive page state (Michael)  BUG: Ticket#622 - Changing Display-attribute of a TActiveCheckBox dy  CHG: Ticket#844 - Upgraded TinyMCE to 3.1.0.1 (Christophe) diff --git a/framework/Web/TUrlMapping.php b/framework/Web/TUrlMapping.php index d3757aaa..662f96dd 100644 --- a/framework/Web/TUrlMapping.php +++ b/framework/Web/TUrlMapping.php @@ -617,7 +617,7 @@ class TUrlMappingPattern extends TComponent  		foreach($getItems as $key=>$value)
  		{
  			if($encodeGetItems)
 -				$value=urlencode($value);
 +				$value=rawurlencode($value);
  			if($this->_parameters->contains($key))
  				$replace['{'.$key.'}']=$value;
  			else
 @@ -637,12 +637,12 @@ class TUrlMappingPattern extends TComponent  				{
  					if(is_array($value))
  					{
 -						$name=urlencode($name.'[]');
 +						$name=rawurlencode($name.'[]');
  						foreach($value as $v)
 -							$url2.=$amp.$name.'='.urlencode($v);
 +							$url2.=$amp.$name.'='.rawurlencode($v);
  					}
  					else
 -						$url2.=$amp.urlencode($name).'='.urlencode($value);
 +						$url2.=$amp.rawurlencode($name).'='.rawurlencode($value);
  				}
  			}
  			else
 diff --git a/tests/FunctionalTests/tickets/protected/application.xml b/tests/FunctionalTests/tickets/protected/application.xml index 29273a2f..113b8455 100644 --- a/tests/FunctionalTests/tickets/protected/application.xml +++ b/tests/FunctionalTests/tickets/protected/application.xml @@ -1,8 +1,9 @@  <?xml version="1.0" encoding="UTF-8"?>  <application id="TicketTests" Mode="Debug">  <modules> -	<module id="friendly-url" class="System.Web.TUrlMapping"> +	<module id="friendly-url" class="System.Web.TUrlMapping" EnableCustomUrl="True">  		<url ServiceID="testService" ServiceParameter="ticket653" pattern="/ticket653/?" /> +		<url ServiceParameter="Ticket922" pattern="/ticket922/{text}" parameters.text=".*" />  	</module>  	<module id="request" class="THttpRequest" UrlManager="friendly-url"/>  </modules> diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket922.page b/tests/FunctionalTests/tickets/protected/pages/Ticket922.page new file mode 100644 index 00000000..87932680 --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/pages/Ticket922.page @@ -0,0 +1,12 @@ +<com:TContent ID="Content"> + +<h1>Problem with TUrlMapping and urlencoding</h1> + +Enter a string with spaces that will be used as URL parameter +<com:TTextBox ID="Text" /> +<com:TButton Text="Perform redirect" OnClick="processString" /> + +<br /> +Decoded String: +<com:TLabel ID="Result" /> +</com:TContent> diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket922.php b/tests/FunctionalTests/tickets/protected/pages/Ticket922.php new file mode 100644 index 00000000..52d4e411 --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/pages/Ticket922.php @@ -0,0 +1,13 @@ +<?php +class Ticket922 extends TPage { +    public function processString($sender,$param) { +        $text = $this->Text->Text; +        $url= $this->getService()->constructUrl('Ticket922', array('text'=>$text)); +        $this->getResponse()->redirect($url); +    } + +    public function onLoad($param) { +        if ($this->Request->contains('text')) +            $this->Result->setText($this->Request->itemAt('text')); +    } +} diff --git a/tests/FunctionalTests/tickets/tests/Ticket922TestCase.php b/tests/FunctionalTests/tickets/tests/Ticket922TestCase.php new file mode 100644 index 00000000..8420c10d --- /dev/null +++ b/tests/FunctionalTests/tickets/tests/Ticket922TestCase.php @@ -0,0 +1,18 @@ +<?php + +class Ticket922TestCase extends SeleniumTestCase +{ +	function test() +	{ +		$this->open('tickets/index.php?page=Ticket922'); +		$this->assertTitle("Verifying Ticket 922"); +		$base = 'ctl0_Content_'; +		 +		$this->type($base.'Text', 'two words'); +		$this->clickAndWait('ctl0$Content$ctl0'); +		$this->assertText($base.'Result','two words'); + +	} +} + +?>  | 
