Skip to content

Commit

Permalink
Handle special chars for &
Browse files Browse the repository at this point in the history
  • Loading branch information
trecouvr committed Oct 6, 2013
1 parent 4477e84 commit 80413dc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Payutc/Cas.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function authenticate($ticket, $service)

public function getValidateUrl($ticket, $service)
{
return $this->url."serviceValidate?ticket=".$ticket."&service=".$service;
return $this->url."serviceValidate?ticket=".urlencode($ticket)."&service=".urlencode($service);
}
}

Expand Down
11 changes: 11 additions & 0 deletions tests/Payutc/CasTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@ public function testAuthenticateSuccess()
$this->assertEquals('trecouvr', $user);
}

/**
* Test cas can handle special chars like &, #
* @requires PHP 5.4
*/
public function testAuthenticateSuccessWithSpecialChar()
{
$cas = new Cas(Config::get('cas_url'));
$user = $cas->authenticate('trecouvr@couc#u&', 'couc#u&');
$this->assertEquals('trecouvr', $user);
}

/**
* @requires PHP 5.4
* @expectedException \Payutc\Exception\AuthenticationFailure
Expand Down

0 comments on commit 80413dc

Please sign in to comment.