Skip to content

Commit

Permalink
Merge branch '3.2' into 3.3
Browse files Browse the repository at this point in the history
* 3.2: (42 commits)
  Show exception is checked twice in ExceptionController of twig
  allow SSI fragments configuration in XML files
  Display a better error message when the toolbar cannot be displayed
  render hidden _method field in form_rest()
  Add Doctrine Cache to dev dependencies to fix failing unit tests.
  return fallback locales whenever possible
  [Console] Fix catching exception type in QuestionHelper
  [WebProfilerBundle] Eliminate line wrap on count columnt (routing)
  [Routing] Fix XmlFileLoader exception message
  [Translation] Fix FileLoader::loadResource() php doc
  Sessions: configurable "use_strict_mode" option for NativeSessionStorage
  [FrameworkBundle] [Command] Clean bundle directory, fixes #23177
  Reset redirectCount when throwing exception
  [TwigBundle] Remove template.xml services when templating is disabled
  add content-type header on exception response
  Embedding a response that combines expiration and validation, that should not defeat expiration on the combined response
  fixed bad merge
  Fix two edge cases in ResponseCacheStrategy
  [Routing] Expose request in route conditions, if needed and possible
  [Routing] Expose request in route conditions, if needed and possible
  ...
  • Loading branch information
xabbuh committed Jun 24, 2017
2 parents 7bb72b0 + 80b114e commit 22723da
Show file tree
Hide file tree
Showing 49 changed files with 449 additions and 75 deletions.
19 changes: 10 additions & 9 deletions CONTRIBUTORS.md
Expand Up @@ -20,13 +20,13 @@ Symfony is the result of the work of many people who made the code better
- Javier Eguiluz (javier.eguiluz)
- Hugo Hamon (hhamon)
- Abdellatif Ait boudad (aitboudad)
- Romain Neutron (romain)
- Pascal Borreli (pborreli)
- Wouter De Jong (wouterj)
- Romain Neutron (romain)
- Grégoire Pineau (lyrixx)
- Robin Chalas (chalas_r)
- Joseph Bielawski (stloyd)
- Maxime Steinhausser (ogizanagi)
- Grégoire Pineau (lyrixx)
- Joseph Bielawski (stloyd)
- Karma Dordrak (drak)
- Lukas Kahwe Smith (lsmith)
- Martin Hasoň (hason)
Expand Down Expand Up @@ -72,8 +72,8 @@ Symfony is the result of the work of many people who made the code better
- Dariusz Górecki (canni)
- Titouan Galopin (tgalopin)
- Douglas Greenshields (shieldo)
- Konstantin Myakshin (koc)
- Jáchym Toušek (enumag)
- Konstantin Myakshin (koc)
- Lee McDermott
- Brandon Turner
- Luis Cordova (cordoval)
Expand Down Expand Up @@ -112,10 +112,10 @@ Symfony is the result of the work of many people who made the code better
- Jacob Dreesen (jdreesen)
- Tobias Nyholm (tobias)
- Tomáš Votruba (tomas_votruba)
- Yonel Ceruto González (yonelceruto)
- Fabien Pennequin (fabienpennequin)
- Gordon Franke (gimler)
- Eric GELOEN (gelo)
- Yonel Ceruto González (yonelceruto)
- Daniel Wehner (dawehner)
- Tugdual Saunier (tucksaun)
- Théo FIDRY (theofidry)
Expand All @@ -130,6 +130,7 @@ Symfony is the result of the work of many people who made the code better
- Daniel Gomes (danielcsgomes)
- Hidenori Goto (hidenorigoto)
- Guilherme Blanco (guilhermeblanco)
- Vincent AUBERT (vincent)
- Pablo Godel (pgodel)
- Jérémie Augustin (jaugustin)
- Andréia Bohner (andreia)
Expand All @@ -140,18 +141,17 @@ Symfony is the result of the work of many people who made the code better
- Joel Wurtz (brouznouf)
- Philipp Wahala (hifi)
- Vyacheslav Pavlov
- Richard van Laak (rvanlaak)
- Javier Spagnoletti (phansys)
- Richard Shank (iampersistent)
- Thomas Rabaix (rande)
- Vincent AUBERT (vincent)
- Rouven Weßling (realityking)
- Teoh Han Hui (teohhanhui)
- Jérôme Vasseur (jvasseur)
- Clemens Tolboom
- Helmer Aaviksoo
- Grégoire Paris (greg0ire)
- Hiromi Hishida (77web)
- Richard van Laak (rvanlaak)
- Matthieu Ouellette-Vachon (maoueh)
- Michał Pipa (michal.pipa)
- Amal Raghav (kertz)
Expand Down Expand Up @@ -244,6 +244,7 @@ Symfony is the result of the work of many people who made the code better
- Uwe Jäger (uwej711)
- Eugene Leonovich (rybakit)
- Filippo Tessarotto
- Oleg Voronkovich
- Joseph Rouff (rouffj)
- Félix Labrecque (woodspire)
- GordonsLondon
Expand Down Expand Up @@ -279,7 +280,6 @@ Symfony is the result of the work of many people who made the code better
- Jordan Samouh (jordansamouh)
- Chris Smith (cs278)
- Florian Klein (docteurklein)
- Oleg Voronkovich
- Manuel Kiessling (manuelkiessling)
- Atsuhiro KUBO (iteman)
- Andrew Moore (finewolf)
Expand Down Expand Up @@ -389,6 +389,7 @@ Symfony is the result of the work of many people who made the code better
- Emanuele Gaspari (inmarelibero)
- Sébastien Santoro (dereckson)
- Brian King
- Frank de Jonge (frenkynet)
- Michel Salib (michelsalib)
- geoffrey
- Steffen Roßkamp
Expand Down Expand Up @@ -525,7 +526,6 @@ Symfony is the result of the work of many people who made the code better
- Romain Pierre (romain-pierre)
- Jan Behrens
- Mantas Var (mvar)
- Frank de Jonge (frenkynet)
- Sebastian Krebs
- Jean-Christophe Cuvelier [Artack]
- Christopher Davis (chrisguitarguy)
Expand Down Expand Up @@ -1280,6 +1280,7 @@ Symfony is the result of the work of many people who made the code better
- ged15
- Daan van Renterghem
- Nicole Cordes
- Martin Kirilov
- Bram Van der Sype (brammm)
- Christopher Hertel (chertel)
- Guile (guile)
Expand Down
Expand Up @@ -302,6 +302,7 @@
{%- endblock form -%}

{%- block form_start -%}
{%- do form.setMethodRendered() -%}
{% set method = method|upper %}
{%- if method in ["GET", "POST"] -%}
{% set form_method = method %}
Expand Down Expand Up @@ -337,6 +338,20 @@
{{- form_row(child) -}}
{% endif %}
{%- endfor %}

{% if not form.methodRendered %}
{%- do form.setMethodRendered() -%}
{% set method = method|upper %}
{%- if method in ["GET", "POST"] -%}
{% set form_method = method %}
{%- else -%}
{% set form_method = "POST" %}
{%- endif -%}

{%- if form_method != method -%}
<input type="hidden" name="_method" value="{{ method }}" />
{%- endif -%}
{% endif %}
{% endblock form_rest %}

{# Support #}
Expand Down
5 changes: 4 additions & 1 deletion src/Symfony/Bridge/Twig/composer.json
Expand Up @@ -23,7 +23,7 @@
"fig/link-util": "^1.0",
"symfony/asset": "~2.8|~3.0",
"symfony/finder": "~2.8|~3.0",
"symfony/form": "^3.2.7",
"symfony/form": "^3.2.10|^3.3.3",
"symfony/http-kernel": "~3.2",
"symfony/polyfill-intl-icu": "~1.0",
"symfony/routing": "~2.8|~3.0",
Expand All @@ -38,6 +38,9 @@
"symfony/expression-language": "~2.8|~3.0",
"symfony/web-link": "~3.3"
},
"conflict": {
"symfony/form": "<3.2.10|~3.3,<3.3.3"
},
"suggest": {
"symfony/finder": "",
"symfony/asset": "For using the AssetExtension",
Expand Down
Expand Up @@ -114,6 +114,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$rows = array();
$copyUsed = false;
$exitCode = 0;
$validAssetDirs = array();
/** @var BundleInterface $bundle */
foreach ($this->getContainer()->get('kernel')->getBundles() as $bundle) {
if (!is_dir($originDir = $bundle->getPath().'/Resources/public')) {
Expand Down Expand Up @@ -152,6 +153,13 @@ protected function execute(InputInterface $input, OutputInterface $output)
$exitCode = 1;
$rows[] = array(sprintf('<fg=red;options=bold>%s</>', '\\' === DIRECTORY_SEPARATOR ? 'ERROR' : "\xE2\x9C\x98" /* HEAVY BALLOT X (U+2718) */), $message, $e->getMessage());
}
$validAssetDirs[] = $targetDir;
}
// remove the assets of the bundles that no longer exist
foreach (new \FilesystemIterator($bundlesDir) as $dir) {
if (!in_array($dir, $validAssetDirs)) {
$filesystem->remove($dir);
}
}

$io->table(array('', 'Bundle', 'Method / Error'), $rows);
Expand Down
10 changes: 6 additions & 4 deletions src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php
Expand Up @@ -158,7 +158,7 @@ protected function warmup($warmupDir, $realCacheDir, $enableOptionalWarmers = tr
$safeTempKernel = str_replace('\\', '\\\\', get_class($tempKernel));
$realKernelFQN = get_class($realKernel);

foreach (Finder::create()->files()->name('*.meta')->in($warmupDir) as $file) {
foreach (Finder::create()->files()->depth('<3')->name('*.meta')->in($warmupDir) as $file) {
file_put_contents($file, preg_replace(
'/(C\:\d+\:)"'.$safeTempKernel.'"/',
sprintf('$1"%s"', $realKernelFQN),
Expand All @@ -170,14 +170,16 @@ protected function warmup($warmupDir, $realCacheDir, $enableOptionalWarmers = tr
$search = array($warmupDir, str_replace('\\', '\\\\', $warmupDir));
$replace = str_replace('\\', '/', $realCacheDir);
foreach (Finder::create()->files()->in($warmupDir) as $file) {
$content = str_replace($search, $replace, file_get_contents($file));
file_put_contents($file, $content);
$content = str_replace($search, $replace, file_get_contents($file), $count);
if ($count) {
file_put_contents($file, $content);
}
}

// fix references to container's class
$tempContainerClass = get_class($tempKernel->getContainer());
$realContainerClass = get_class($realKernel->getContainer());
foreach (Finder::create()->files()->name($tempContainerClass.'*')->in($warmupDir) as $file) {
foreach (Finder::create()->files()->depth('<2')->name($tempContainerClass.'*')->in($warmupDir) as $file) {
$content = str_replace($tempContainerClass, $realContainerClass, file_get_contents($file));
file_put_contents($file, $content);
rename($file, str_replace(DIRECTORY_SEPARATOR.$tempContainerClass, DIRECTORY_SEPARATOR.$realContainerClass, $file));
Expand Down
Expand Up @@ -435,6 +435,7 @@ private function addSessionSection(ArrayNodeDefinition $rootNode)
->scalarNode('gc_divisor')->end()
->scalarNode('gc_probability')->defaultValue(1)->end()
->scalarNode('gc_maxlifetime')->end()
->booleanNode('use_strict_mode')->end()
->scalarNode('save_path')->defaultValue('%kernel.cache_dir%/sessions')->end()
->integerNode('metadata_update_threshold')
->defaultValue('0')
Expand Down
Expand Up @@ -702,7 +702,7 @@ private function registerSessionConfiguration(array $config, ContainerBuilder $c
// session storage
$container->setAlias('session.storage', $config['storage_id']);
$options = array();
foreach (array('name', 'cookie_lifetime', 'cookie_path', 'cookie_domain', 'cookie_secure', 'cookie_httponly', 'use_cookies', 'gc_maxlifetime', 'gc_probability', 'gc_divisor') as $key) {
foreach (array('name', 'cookie_lifetime', 'cookie_path', 'cookie_domain', 'cookie_secure', 'cookie_httponly', 'use_cookies', 'gc_maxlifetime', 'gc_probability', 'gc_divisor', 'use_strict_mode') as $key) {
if (isset($config[$key])) {
$options[$key] = $config[$key];
}
Expand Down
Expand Up @@ -13,6 +13,7 @@
<xsd:element name="form" type="form" minOccurs="0" maxOccurs="1" />
<xsd:element name="csrf-protection" type="csrf_protection" minOccurs="0" maxOccurs="1" />
<xsd:element name="esi" type="esi" minOccurs="0" maxOccurs="1" />
<xsd:element name="ssi" type="ssi" minOccurs="0" maxOccurs="1" />
<xsd:element name="fragments" type="fragments" minOccurs="0" maxOccurs="1" />
<xsd:element name="web-link" type="web_link" minOccurs="0" maxOccurs="1" />
<xsd:element name="profiler" type="profiler" minOccurs="0" maxOccurs="1" />
Expand Down Expand Up @@ -58,6 +59,10 @@
<xsd:attribute name="enabled" type="xsd:boolean" />
</xsd:complexType>

<xsd:complexType name="ssi">
<xsd:attribute name="enabled" type="xsd:boolean" />
</xsd:complexType>

<xsd:complexType name="fragments">
<xsd:attribute name="enabled" type="xsd:boolean" />
<xsd:attribute name="path" type="xsd:string" />
Expand Down Expand Up @@ -110,6 +115,7 @@
<xsd:attribute name="gc-maxlifetime" type="xsd:string" />
<xsd:attribute name="gc-divisor" type="xsd:string" />
<xsd:attribute name="gc-probability" type="xsd:string" />
<xsd:attribute name="use-strict-mode" type="xsd:boolean" />
<xsd:attribute name="save-path" type="xsd:string" />
</xsd:complexType>

Expand Down
Expand Up @@ -13,6 +13,9 @@
'esi' => array(
'enabled' => true,
),
'ssi' => array(
'enabled' => true,
),
'profiler' => array(
'only_exceptions' => true,
'enabled' => false,
Expand Down
Expand Up @@ -12,6 +12,7 @@
<framework:csrf-protection field-name="_csrf"/>
</framework:form>
<framework:esi enabled="true" />
<framework:ssi enabled="true" />
<framework:profiler only-exceptions="true" enabled="false" />
<framework:router resource="%kernel.root_dir%/config/routing.xml" type="xml" />
<framework:session gc-maxlifetime="90000" gc-probability="1" gc-divisor="108" storage-id="session.storage.native" handler-id="session.handler.native_file" name="_SYMFONY" cookie-lifetime="86400" cookie-path="/" cookie-domain="example.com" cookie-secure="true" cookie-httponly="false" use-cookies="true" save-path="/path/to/sessions" />
Expand Down
Expand Up @@ -8,6 +8,8 @@ framework:
http_method_override: false
esi:
enabled: true
ssi:
enabled: true
profiler:
only_exceptions: true
enabled: false
Expand Down
Expand Up @@ -134,6 +134,13 @@ public function testEsi()
$this->assertTrue($container->hasDefinition('esi'), '->registerEsiConfiguration() loads esi.xml');
}

public function testSsi()
{
$container = $this->createContainerFromFile('full');

$this->assertTrue($container->hasDefinition('ssi'), '->registerSsiConfiguration() loads ssi.xml');
}

public function testEnabledProfiler()
{
$container = $this->createContainerFromFile('profiler');
Expand Down
Expand Up @@ -293,6 +293,51 @@ public function testInvalidOptions()
(new Translator($container, new MessageSelector(), 'en', array(), array('foo' => 'bar')));
}

/** @dataProvider getDebugModeAndCacheDirCombinations */
public function testResourceFilesOptionLoadsBeforeOtherAddedResources($debug, $enableCache)
{
$someCatalogue = $this->getCatalogue('some_locale', array());

$loader = $this->getMockBuilder('Symfony\Component\Translation\Loader\LoaderInterface')->getMock();

$loader->expects($this->at(0))
->method('load')
/* The "messages.some_locale.loader" is passed via the resource_file option and shall be loaded first */
->with('messages.some_locale.loader', 'some_locale', 'messages')
->willReturn($someCatalogue);

$loader->expects($this->at(1))
->method('load')
/* This resource is added by an addResource() call and shall be loaded after the resource_files */
->with('second_resource.some_locale.loader', 'some_locale', 'messages')
->willReturn($someCatalogue);

$options = array(
'resource_files' => array('some_locale' => array('messages.some_locale.loader')),
'debug' => $debug,
);

if ($enableCache) {
$options['cache_dir'] = $this->tmpDir;
}

/** @var Translator $translator */
$translator = $this->createTranslator($loader, $options);
$translator->addResource('loader', 'second_resource.some_locale.loader', 'some_locale', 'messages');

$translator->trans('some_message', array(), null, 'some_locale');
}

public function getDebugModeAndCacheDirCombinations()
{
return array(
array(false, false),
array(true, false),
array(false, true),
array(true, true),
);
}

protected function getCatalogue($locale, $messages, $resources = array())
{
$catalogue = new MessageCatalogue($locale);
Expand Down

0 comments on commit 22723da

Please sign in to comment.