Skip to content
Browse files

Merge branch '2.1'

* 2.1:
  [Routing] made it compatible with older PCRE version (pre 8)
  tiny refactoring for consistency
  fixed docblock return type
  Added HttpCache\Store::generateContentDigest() + changed visibility

Conflicts:
	src/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php
	src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php
	src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php
	src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php
	src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher3.php
	src/Symfony/Component/Routing/Tests/RouteCompilerTest.php
  • Loading branch information...
2 parents 4860e75 + 8f33f2e commit cec11fa08af84284304c21340f61aae733c4367f @fabpot fabpot committed Nov 19, 2012
View
2 src/Symfony/Component/HttpFoundation/ServerBag.php
@@ -23,7 +23,7 @@ class ServerBag extends ParameterBag
/**
* Gets the HTTP headers.
*
- * @return string
+ * @return array
*/
public function getHeaders()
{
View
16 src/Symfony/Component/HttpKernel/HttpCache/Store.php
@@ -24,7 +24,7 @@
*/
class Store implements StoreInterface
{
- private $root;
+ protected $root;
private $keyCache;
private $locks;
@@ -164,7 +164,7 @@ public function write(Request $request, Response $response)
// write the response body to the entity store if this is the original response
if (!$response->headers->has('X-Content-Digest')) {
- $digest = 'en'.sha1($response->getContent());
+ $digest = $this->generateContentDigest($response);
if (false === $this->save($digest, $response->getContent())) {
throw new \RuntimeException('Unable to store the entity.');
@@ -203,6 +203,18 @@ public function write(Request $request, Response $response)
}
/**
+ * Returns content digest for $response.
+ *
+ * @param Response $response
+ *
+ * @return string
+ */
+ protected function generateContentDigest(Response $response)
+ {
+ return 'en'.sha1($response->getContent());
+ }
+
+ /**
* Invalidates all cache entries that match the request.
*
* @param Request $request A Request instance
View
1 src/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php
@@ -55,7 +55,6 @@ public function dump(array $options = array())
$hostnameRegex = $compiledRoute->getHostnameRegex();
if (null !== $hostnameRegex && $prevHostnameRegex !== $hostnameRegex) {
-
$prevHostnameRegex = $hostnameRegex;
$hostnameRegexUnique++;
View
2 src/Symfony/Component/Routing/RouteCollection.php
@@ -288,7 +288,7 @@ public function setHostnamePattern($pattern)
public function getResources()
{
$resources = $this->resources;
- foreach ($this as $routes) {
+ foreach ($this->routes as $routes) {
if ($routes instanceof RouteCollection) {
$resources = array_merge($resources, $routes->getResources());
}
View
4 src/Symfony/Component/Routing/RouteCompiler.php
@@ -212,9 +212,9 @@ private function computeRegexp(array $tokens, $index, $firstOptional)
// Variable tokens
if (0 === $index && 0 === $firstOptional) {
// When the only token is an optional variable token, the separator is required
- return sprintf('%s(?<%s>%s)?', preg_quote($token[1], self::REGEX_DELIMITER), $token[3], $token[2]);
+ return sprintf('%s(?P<%s>%s)?', preg_quote($token[1], self::REGEX_DELIMITER), $token[3], $token[2]);
} else {
- $regexp = sprintf('%s(?<%s>%s)', preg_quote($token[1], self::REGEX_DELIMITER), $token[3], $token[2]);
+ $regexp = sprintf('%s(?P<%s>%s)', preg_quote($token[1], self::REGEX_DELIMITER), $token[3], $token[2]);
if ($index >= $firstOptional) {
// Enclose each optional token in a subpattern to make it optional.
// "?:" means it is non-capturing, i.e. the portion of the subject string that
View
1 src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php
@@ -71,7 +71,6 @@ public function match($pathinfo)
if ($pathinfo === '/test/baz3/') {
return array('_route' => 'baz3');
}
-
}
// baz4
View
2 src/Symfony/Component/Routing/Tests/RouteCompilerTest.php
@@ -100,7 +100,7 @@ public function provideCompileData()
array(
'Route with an optional variable as the first segment with requirements',
array('/{bar}', array('bar' => 'bar'), array('bar' => '(foo|bar)')),
- '', '#^/(?<bar>(foo|bar))?$#s', array('bar'), array(
+ '', '#^/(?P<bar>(foo|bar))?$#s', array('bar'), array(
array('variable', '/', '(foo|bar)', 'bar'),
)),

0 comments on commit cec11fa

Please sign in to comment.
Something went wrong with that request. Please try again.