Skip to content

Commit 8c201a3

Browse files
author
Fabian Lange
committed
Merge branch 'symfony'
2 parents 86a080a + 9d604fe commit 8c201a3

File tree

231 files changed

+6187
-15698
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

231 files changed

+6187
-15698
lines changed

phpunit.xml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<phpunit backupGlobals="false"
4+
backupStaticAttributes="false"
5+
colors="false"
6+
convertErrorsToExceptions="true"
7+
convertNoticesToExceptions="true"
8+
convertWarningsToExceptions="true"
9+
processIsolation="false"
10+
stopOnFailure="true"
11+
syntaxCheck="false"
12+
>
13+
<testsuites>
14+
<testsuite name="Symfony Test Suite">
15+
<directory>./tests/Symfony/</directory>
16+
<directory>./src/Symfony/Framework/</directory>
17+
</testsuite>
18+
</testsuites>
19+
20+
<filter>
21+
<whitelist>
22+
<directory suffix=".php">./src/Symfony/</directory>
23+
<exclude>
24+
<directory suffix=".php">./src/Symfony/Framework/DoctrineBundle</directory>
25+
<directory suffix=".php">./src/Symfony/Framework/ZendBundle</directory>
26+
27+
<directory suffix=".php">./src/Symfony/Framework/DoctrineBundle/Resources</directory>
28+
<directory suffix=".php">./src/Symfony/Framework/ProfilerBundle/Resources</directory>
29+
<directory suffix=".php">./src/Symfony/Framework/SwiftmailerBundle/Resources</directory>
30+
<directory suffix=".php">./src/Symfony/Framework/WebBundle/Resources</directory>
31+
<directory suffix=".php">./src/Symfony/Framework/ZendBundle/Resources</directory>
32+
33+
<file>src/Symfony/Foundation/bootstrap.php</file>
34+
<file>src/Symfony/Foundation/packager.php</file>
35+
</exclude>
36+
</whitelist>
37+
</filter>
38+
</phpunit>

src/Symfony/Components/Templating/Engine.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Symfony\Components\Templating\Loader\LoaderInterface;
66
use Symfony\Components\Templating\Renderer\PhpRenderer;
77
use Symfony\Components\Templating\Renderer\RendererInterface;
8+
use Symfony\Components\Templating\Helper\HelperInterface;
89

910
/*
1011
* This file is part of the symfony package.
@@ -31,6 +32,7 @@ class Engine
3132
protected $parents;
3233
protected $stack;
3334
protected $charset;
35+
protected $cache;
3436

3537
/**
3638
* Constructor.
@@ -171,7 +173,7 @@ public function addHelpers(array $helpers = array())
171173
* Sets a helper.
172174
*
173175
* @param HelperInterface $value The helper instance
174-
* @param string $alias An alias
176+
* @param string $alias An alias
175177
*/
176178
public function set(HelperInterface $helper, $alias = null)
177179
{
@@ -181,7 +183,7 @@ public function set(HelperInterface $helper, $alias = null)
181183
$this->helpers[$alias] = $helper;
182184
}
183185

184-
$helper->setEngine($this);
186+
$helper->setCharset($this->charset);
185187
}
186188

187189
/**

src/Symfony/Components/Templating/Helper/Helper.php

+9-11
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
namespace Symfony\Components\Templating\Helper;
44

5-
use Symfony\Components\Templating\Engine;
6-
75
/*
86
* This file is part of the symfony package.
97
*
@@ -22,25 +20,25 @@
2220
*/
2321
abstract class Helper implements HelperInterface
2422
{
25-
protected $engine;
23+
protected $charset = 'UTF-8';
2624

2725
/**
28-
* Sets the engine associated with this helper.
26+
* Sets the default charset.
2927
*
30-
* @param Engine $engine A Engine instance
28+
* @param string $charset The charset
3129
*/
32-
public function setEngine(Engine $engine = null)
30+
public function setCharset($charset)
3331
{
34-
$this->engine = $engine;
32+
$this->charset = $charset;
3533
}
3634

3735
/**
38-
* Gets the engine associated with this helper.
36+
* Gets the default charset.
3937
*
40-
* @return Engine A Engine instance
38+
* @return string The default charset
4139
*/
42-
public function getEngine()
40+
public function getCharset()
4341
{
44-
return $this->engine;
42+
return $this->charset;
4543
}
4644
}

src/Symfony/Components/Templating/Helper/HelperInterface.php

+6-8
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
namespace Symfony\Components\Templating\Helper;
44

5-
use Symfony\Components\Templating\Engine;
6-
75
/*
86
* This file is part of the symfony package.
97
*
@@ -30,16 +28,16 @@ interface HelperInterface
3028
function getName();
3129

3230
/**
33-
* Sets the engine associated with this helper.
31+
* Sets the default charset.
3432
*
35-
* @param Engine $engine A Engine instance
33+
* @param string $charset The charset
3634
*/
37-
function setEngine(Engine $engine = null);
35+
function setCharset($charset);
3836

3937
/**
40-
* Gets the engine associated with this helper.
38+
* Gets the default charset.
4139
*
42-
* @return Engine A Engine instance
40+
* @return string The default charset
4341
*/
44-
function getEngine();
42+
function getCharset();
4543
}

src/Symfony/Components/Templating/Helper/JavascriptsHelper.php

+13-2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,17 @@
2828
class JavascriptsHelper extends Helper
2929
{
3030
protected $javascripts = array();
31+
protected $assetHelper;
32+
33+
/**
34+
* Constructor.
35+
*
36+
* @param AssetsHelper $assetHelper A AssetsHelper instance
37+
*/
38+
public function __construct(AssetsHelper $assetHelper)
39+
{
40+
$this->assetHelper = $assetHelper;
41+
}
3142

3243
/**
3344
* Adds a JavaScript file.
@@ -37,7 +48,7 @@ class JavascriptsHelper extends Helper
3748
*/
3849
public function add($javascript, $attributes = array())
3950
{
40-
$this->javascripts[$this->engine->get('assets')->getUrl($javascript)] = $attributes;
51+
$this->javascripts[$this->assetHelper->getUrl($javascript)] = $attributes;
4152
}
4253

4354
/**
@@ -63,7 +74,7 @@ public function render()
6374
$atts = '';
6475
foreach ($attributes as $key => $value)
6576
{
66-
$atts .= ' '.sprintf('%s="%s"', $key, $this->engine->escape($value));
77+
$atts .= ' '.sprintf('%s="%s"', $key, htmlspecialchars($value, ENT_QUOTES, $this->charset));
6778
}
6879

6980
$html .= sprintf('<script type="text/javascript" src="%s"%s></script>', $path, $atts)."\n";

src/Symfony/Components/Templating/Helper/StylesheetsHelper.php

+13-2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,17 @@
2828
class StylesheetsHelper extends Helper
2929
{
3030
protected $stylesheets = array();
31+
protected $assetHelper;
32+
33+
/**
34+
* Constructor.
35+
*
36+
* @param AssetsHelper $assetHelper A AssetsHelper instance
37+
*/
38+
public function __construct(AssetsHelper $assetHelper)
39+
{
40+
$this->assetHelper = $assetHelper;
41+
}
3142

3243
/**
3344
* Adds a stylesheets file.
@@ -37,7 +48,7 @@ class StylesheetsHelper extends Helper
3748
*/
3849
public function add($stylesheet, $attributes = array())
3950
{
40-
$this->stylesheets[$this->engine->get('assets')->getUrl($stylesheet)] = $attributes;
51+
$this->stylesheets[$this->assetHelper->getUrl($stylesheet)] = $attributes;
4152
}
4253

4354
/**
@@ -63,7 +74,7 @@ public function render()
6374
$atts = '';
6475
foreach ($attributes as $key => $value)
6576
{
66-
$atts .= ' '.sprintf('%s="%s"', $key, $this->engine->escape($value));
77+
$atts .= ' '.sprintf('%s="%s"', $key, htmlspecialchars($value, ENT_QUOTES, $this->charset));
6778
}
6879

6980
$html .= sprintf('<link href="%s" rel="stylesheet" type="text/css"%s />', $path, $atts)."\n";

src/Symfony/Components/Yaml/Parser.php

+2-5
Original file line numberDiff line numberDiff line change
@@ -299,12 +299,9 @@ protected function getNextEmbedBlock()
299299

300300
while ($this->moveToNextLine())
301301
{
302-
if ($this->isCurrentLineEmpty())
302+
if ($this->isCurrentLineBlank())
303303
{
304-
if ($this->isCurrentLineBlank())
305-
{
306-
$data[] = substr($this->currentLine, $newIndent);
307-
}
304+
$data[] = substr($this->currentLine, $newIndent);
308305

309306
continue;
310307
}

0 commit comments

Comments
 (0)