Skip to content

Commit d66f0eb

Browse files
committed
Merge branch '2.3' into 2.7
* 2.3: Updated all the README files [TwigBundle] Fix failing test on appveyor [FrameworkBundle] Fix a regression in handling absolute and namespaced template paths Allow to normalize \Traversable Remove _path from query parameters when fragment is a subrequest and request attributes are already set Added tests for _path removal in FragmentListener Simplified everything Added a test Fixed the problem in an easier way Fixed a syntax issue Improved the error message when a template is not found [CodingStandards] Conformed to coding standards [TwigBundle] fixed Include file locations in "Template could not be found" exception
2 parents aab2783 + 9a5ea71 commit d66f0eb

File tree

40 files changed

+307
-953
lines changed

40 files changed

+307
-953
lines changed

src/Symfony/Bridge/Doctrine/README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ various Symfony components.
77
Resources
88
---------
99

10-
You can run the unit tests with the following command:
11-
12-
$ cd path/to/Symfony/Bridge/Doctrine/
13-
$ composer install
14-
$ phpunit
10+
* [Contributing](https://symfony.com/doc/current/contributing/index.html)
11+
* [Report issues](https://github.com/symfony/symfony/issues) and
12+
[send Pull Requests](https://github.com/symfony/symfony/pulls)
13+
in the [main Symfony repository](https://github.com/symfony/symfony)

src/Symfony/Bridge/Monolog/README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ Provides integration for Monolog with various Symfony components.
66
Resources
77
---------
88

9-
You can run the unit tests with the following command:
10-
11-
$ cd path/to/Symfony/Bridge/Monolog/
12-
$ composer install
13-
$ phpunit
9+
* [Contributing](https://symfony.com/doc/current/contributing/index.html)
10+
* [Report issues](https://github.com/symfony/symfony/issues) and
11+
[send Pull Requests](https://github.com/symfony/symfony/pulls)
12+
in the [main Symfony repository](https://github.com/symfony/symfony)

src/Symfony/Bridge/Propel1/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Propel Bridge
2+
=============
3+
4+
Provides integration for Propel with various Symfony components.
5+
6+
Resources
7+
---------
8+
9+
* [Contributing](https://symfony.com/doc/current/contributing/index.html)
10+
* [Report issues](https://github.com/symfony/symfony/issues) and
11+
[send Pull Requests](https://github.com/symfony/symfony/pulls)
12+
in the [main Symfony repository](https://github.com/symfony/symfony)

src/Symfony/Bridge/ProxyManager/README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ Provides integration for [ProxyManager][1] with various Symfony components.
66
Resources
77
---------
88

9-
You can run the unit tests with the following command:
10-
11-
$ cd path/to/Symfony/Bridge/ProxyManager/
12-
$ composer install
13-
$ phpunit
9+
* [Contributing](https://symfony.com/doc/current/contributing/index.html)
10+
* [Report issues](https://github.com/symfony/symfony/issues) and
11+
[send Pull Requests](https://github.com/symfony/symfony/pulls)
12+
in the [main Symfony repository](https://github.com/symfony/symfony)
1413

1514
[1]: https://github.com/Ocramius/ProxyManager

src/Symfony/Bridge/Twig/README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ Symfony components.
77
Resources
88
---------
99

10-
If you want to run the unit tests, install dev dependencies before
11-
running PHPUnit:
12-
13-
$ cd path/to/Symfony/Bridge/Twig/
14-
$ composer install
15-
$ phpunit
10+
* [Contributing](https://symfony.com/doc/current/contributing/index.html)
11+
* [Report issues](https://github.com/symfony/symfony/issues) and
12+
[send Pull Requests](https://github.com/symfony/symfony/pulls)
13+
in the [main Symfony repository](https://github.com/symfony/symfony)

src/Symfony/Bundle/FrameworkBundle/Templating/TemplateNameParser.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function parse($name)
5555
throw new \RuntimeException(sprintf('Template name "%s" contains invalid characters.', $name));
5656
}
5757

58-
if (!preg_match('/^(?:([^:]*):)?(?:([^:]*):)?(.+)\.([^\.]+)\.([^\.]+)$/', $name, $matches)) {
58+
if (!preg_match('/^(?:([^:]*):([^:]*):)?(.+)\.([^\.]+)\.([^\.]+)$/', $name, $matches) || $this->isAbsolutePath($name) || 0 === strpos($name, '@')) {
5959
return parent::parse($name);
6060
}
6161

@@ -71,4 +71,9 @@ public function parse($name)
7171

7272
return $this->cache[$name] = $template;
7373
}
74+
75+
private function isAbsolutePath($file)
76+
{
77+
return (bool) preg_match('#^(?:/|[a-zA-Z]:)#', $file);
78+
}
7479
}

src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateNameParserTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ public function parseProvider()
6666
array('::index.html.php', '::index.html.php', 'views/index.html.php', new TemplateReference('', '', 'index', 'html', 'php')),
6767
array('index.html.php', '::index.html.php', 'views/index.html.php', new TemplateReference('', '', 'index', 'html', 'php')),
6868
array('FooBundle:Post:foo.bar.index.html.php', 'FooBundle:Post:foo.bar.index.html.php', '@FooBundle/Resources/views/Post/foo.bar.index.html.php', new TemplateReference('FooBundle', 'Post', 'foo.bar.index', 'html', 'php')),
69+
array('@FooBundle/Resources/views/layout.html.twig', '@FooBundle/Resources/views/layout.html.twig', '@FooBundle/Resources/views/layout.html.twig', new BaseTemplateReference('@FooBundle/Resources/views/layout.html.twig', 'twig')),
70+
array('@FooBundle/Foo/layout.html.twig', '@FooBundle/Foo/layout.html.twig', '@FooBundle/Foo/layout.html.twig', new BaseTemplateReference('@FooBundle/Foo/layout.html.twig', 'twig')),
71+
array('/path/to/section/index.html.php', '/path/to/section/index.html.php', '/path/to/section/index.html.php', new BaseTemplateReference('/path/to/section/index.html.php', 'php')),
72+
array('C:\\path\\to\\section\\name.html.php', 'C:path/to/section/name.html.php', 'C:path/to/section/name.html.php', new BaseTemplateReference('C:path/to/section/name.html.php', 'php')),
73+
array('C:\\path\\to\\section\\name:foo.html.php', 'C:path/to/section/name:foo.html.php', 'C:path/to/section/name:foo.html.php', new BaseTemplateReference('C:path/to/section/name:foo.html.php', 'php')),
74+
array('\\path\\to\\section\\name.html.php', '/path/to/section/name.html.php', '/path/to/section/name.html.php', new BaseTemplateReference('/path/to/section/name.html.php', 'php')),
6975
array('/path/to/section/name.php', '/path/to/section/name.php', '/path/to/section/name.php', new BaseTemplateReference('/path/to/section/name.php', 'php')),
7076
array('name.twig', 'name.twig', 'name.twig', new BaseTemplateReference('name.twig', 'twig')),
7177
array('name', 'name', 'name', new BaseTemplateReference('name')),

src/Symfony/Bundle/TwigBundle/Loader/FilesystemLoader.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,18 @@ protected function findTemplate($template, $throw = true)
7676
try {
7777
$file = parent::findTemplate($logicalName);
7878
} catch (\Twig_Error_Loader $e) {
79-
$previous = $e;
79+
$twigLoaderException = $e;
8080

8181
// for BC
8282
try {
8383
$template = $this->parser->parse($template);
8484
$file = $this->locator->locate($template);
8585
} catch (\Exception $e) {
86-
$previous = $e;
8786
}
8887
}
8988

9089
if (false === $file || null === $file) {
91-
throw new \Twig_Error_Loader(sprintf('Unable to find template "%s".', $logicalName), -1, null, $previous);
90+
throw $twigLoaderException;
9291
}
9392

9493
return $this->cache[$logicalName] = $file;

src/Symfony/Bundle/TwigBundle/Tests/Loader/FilesystemLoaderTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,21 @@ public function testTwigErrorIfLocatorReturnsFalse()
9898
$loader = new FilesystemLoader($locator, $parser);
9999
$loader->getCacheKey('name.format.engine');
100100
}
101+
102+
/**
103+
* @expectedException \Twig_Error_Loader
104+
* @expectedExceptionMessageRegExp /Unable to find template "name\.format\.engine" \(looked into: .*Tests.Loader.\.\..DependencyInjection.Fixtures.Resources.views\)/
105+
*/
106+
public function testTwigErrorIfTemplateDoesNotExist()
107+
{
108+
$parser = $this->getMock('Symfony\Component\Templating\TemplateNameParserInterface');
109+
$locator = $this->getMock('Symfony\Component\Config\FileLocatorInterface');
110+
111+
$loader = new FilesystemLoader($locator, $parser);
112+
$loader->addPath(__DIR__.'/../DependencyInjection/Fixtures/Resources/views');
113+
114+
$method = new \ReflectionMethod('Symfony\Bundle\TwigBundle\Loader\FilesystemLoader', 'findTemplate');
115+
$method->setAccessible(true);
116+
$method->invoke($loader, 'name.format.engine');
117+
}
101118
}
Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,14 @@
11
BrowserKit Component
22
====================
33

4-
BrowserKit simulates the behavior of a web browser.
5-
6-
The component only provides an abstract client and does not provide any
7-
"default" backend for the HTTP layer.
4+
The BrowserKit component simulates the behavior of a web browser, allowing you
5+
to make requests, click on links and submit forms programmatically.
86

97
Resources
108
---------
119

12-
For a simple implementation of a browser based on an HTTP layer, have a look
13-
at [Goutte](https://github.com/FriendsOfPHP/Goutte).
14-
15-
For an implementation based on HttpKernelInterface, have a look at the
16-
[Client](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpKernel/Client.php)
17-
provided by the HttpKernel component.
18-
19-
You can run the unit tests with the following command:
20-
21-
$ cd path/to/Symfony/Component/BrowserKit/
22-
$ composer install
23-
$ phpunit
10+
* [Documentation](https://symfony.com/doc/current/components/browser_kit/introduction.html)
11+
* [Contributing](https://symfony.com/doc/current/contributing/index.html)
12+
* [Report issues](https://github.com/symfony/symfony/issues) and
13+
[send Pull Requests](https://github.com/symfony/symfony/pulls)
14+
in the [main Symfony repository](https://github.com/symfony/symfony)

0 commit comments

Comments
 (0)