Skip to content

Commit

Permalink
Merge branch '3.0'
Browse files Browse the repository at this point in the history
* 3.0:
  [VarDumper] Fix tests on PHP 7
  [DomCrawler] Clarify the value returned by getPhpFiles()
  [DependencyInjection] Fix #16461 Let Container::set() replace existing aliases
  avoid (string) catchable fatal error for instances of __PHP_Incomplete_Class
  remove unnecessary retrieval and setting of data
  Update validators.fr.xlf
  avoid (string) catchable fatal error for __PHP_Incomplete_Class instances
  sendContent return as parent.
  [DomCrawler] Remove the overridden getHash() method to prevent problems when cloning the crawler
  [FrameworkBundle] Fix a typo
  Added more exceptions to singularify method
  Add width attribute on SVG
  [FrameworkBundle] Support autowiring for TranslationInterface
  [Validator] remove obsolete context and PropertyAccess code
  [WebProfiler] Fixed styles for search block and menu profiler for IE Edge
  • Loading branch information
nicolas-grekas committed Feb 13, 2016
2 parents ffa5790 + 74c4974 commit 2d75718
Show file tree
Hide file tree
Showing 43 changed files with 121 additions and 137 deletions.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ protected function configure()
))
->setDescription('Updates the translation file')
->setHelp(<<<'EOF'
The <info>%command.name%</info> command extract translation strings from templates
The <info>%command.name%</info> command extracts translation strings from templates
of a given bundle or the app folder. It can display them or merge the new ones into the translation files.
When new translation strings are found it can automatically add a prefix to the translation
message.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
<call method="setConfigCacheFactory">
<argument type="service" id="config_cache_factory" />
</call>

<autowiring-type>Symfony\Component\Translation\TranslatorInterface</autowiring-type>
</service>

<service id="translator.logging" class="Symfony\Component\Translation\LoggingTranslator" public="false">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
</service>

<service id="validator.expression" class="Symfony\Component\Validator\Constraints\ExpressionValidator">
<argument type="service" id="property_accessor" />
<tag name="validator.constraint_validator" alias="validator.expression" />
</service>

Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,7 @@ tr.status-warning td {
#menu-profiler {
margin: 0;
padding: 0;
list-style-type: none;
}
#menu-profiler li {
position: relative;
Expand Down
4 changes: 4 additions & 0 deletions src/Symfony/Component/DependencyInjection/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ public function set($id, $service)
throw new InvalidArgumentException('You cannot set service "service_container".');
}

if (isset($this->aliases[$id])) {
unset($this->aliases[$id]);
}

$this->services[$id] = $service;

if (null === $service) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,16 @@ public function testAddAliases()
$this->assertTrue(isset($aliases['foobar']));
}

public function testSetReplacesAlias()
{
$builder = new ContainerBuilder();
$builder->setAlias('alias', 'aliased');
$builder->set('aliased', new \stdClass());

$builder->set('alias', $foo = new \stdClass());
$this->assertSame($foo, $builder->get('alias'), '->set() replaces an existing alias');
}

public function testAddGetCompilerPass()
{
$builder = new ContainerBuilder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,14 @@ public function testSetWithNullResetTheService()
$this->assertFalse($sc->has('foo'), '->set() with null service resets the service');
}

public function testSetReplacesAlias()
{
$c = new ProjectServiceContainer();

$c->set('alias', $foo = new \stdClass());
$this->assertSame($foo, $c->get('alias'), '->set() replaces an existing alias');
}

public function testGet()
{
$sc = new ProjectServiceContainer();
Expand Down
6 changes: 5 additions & 1 deletion src/Symfony/Component/DomCrawler/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,12 @@ public function getPhpValues()
*
* This method converts fields with the array notation
* (like foo[bar] to arrays) like PHP does.
* The returned array is consistent with the array for field values
* (@see getPhpValues), rather than uploaded files found in $_FILES.
* For a compound file field foo[bar] it will create foo[bar][name],
* instead of foo[name][bar] which would be found in $_FILES.
*
* @return array An array of field values.
* @return array An array of file field values.
*/
public function getPhpFiles()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,10 @@ public function __construct($fieldName, CsrfTokenManagerInterface $tokenManager,
public function preSubmit(FormEvent $event)
{
$form = $event->getForm();
$data = $event->getData();

if ($form->isRoot() && $form->getConfig()->getOption('compound')) {
$data = $event->getData();

if (!isset($data[$this->fieldName]) || !$this->tokenManager->isTokenValid(new CsrfToken($this->tokenId, $data[$this->fieldName]))) {
$errorMessage = $this->errorMessage;

Expand All @@ -100,9 +101,8 @@ public function preSubmit(FormEvent $event)

if (is_array($data)) {
unset($data[$this->fieldName]);
$event->setData($data);
}
}

$event->setData($data);
}
}

0 comments on commit 2d75718

Please sign in to comment.