Skip to content

Commit

Permalink
merged branch pulzarraider/patch-1 (PR #8878)
Browse files Browse the repository at this point in the history
This PR was merged into the master branch.

Discussion
----------

[HttpFoundation] [BrowserKit] Missing sprintf in exceptions

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

Commits
-------

16d7ef1 [BrowserKit] Fixed missing sprintf in InvalidArgumentException
713f623 Use sprintf in "Untrusted Host" and "Invalid Host" exception
  • Loading branch information
fabpot committed Aug 31, 2013
2 parents e838bf0 + 16d7ef1 commit 98b14f1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Symfony/Component/BrowserKit/Cookie.php
Expand Up @@ -127,7 +127,7 @@ public static function fromString($cookie, $url = null)
$parts = explode(';', $cookie);

if (false === strpos($parts[0], '=')) {
throw new \InvalidArgumentException('The cookie string "%s" is not valid.');
throw new \InvalidArgumentException(sprintf('The cookie string "%s" is not valid.', $cookie));
}

list($name, $value) = explode('=', array_shift($parts), 2);
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/HttpFoundation/Request.php
Expand Up @@ -1112,7 +1112,7 @@ public function getHost()
// as the host can come from the user (HTTP_HOST and depending on the configuration, SERVER_NAME too can come from the user)
// check that it does not contain forbidden characters (see RFC 952 and RFC 2181)
if ($host && !preg_match('/^\[?(?:[a-zA-Z0-9-:\]_]+\.?)+$/', $host)) {
throw new \UnexpectedValueException('Invalid Host "'.$host.'"');
throw new \UnexpectedValueException(sprintf('Invalid Host "%s"', $host));
}

if (count(self::$trustedHostPatterns) > 0) {
Expand All @@ -1130,7 +1130,7 @@ public function getHost()
}
}

throw new \UnexpectedValueException('Untrusted Host "'.$host.'"');
throw new \UnexpectedValueException(sprintf('Untrusted Host "%s"', $host));
}

return $host;
Expand Down

0 comments on commit 98b14f1

Please sign in to comment.