Merge branch '2.7' into 2.8

* 2.7:
  [HttpFoundation] Fix Response::closeOutputBuffers() for HHVM 3.3
  [Console] Set QuestionHelper max attempts in tests
  [Form] Fix a BC break in the entity
  fix broken ChoiceQuestion
  bumped Symfony version to 2.7.3
  updated VERSION for 2.7.2
  updated CHANGELOG for 2.7.2
  bumped Symfony version to 2.6.11
  updated VERSION for 2.6.10
  updated CHANGELOG for 2.6.10
  [PropertyAccess] setValue & isWritable loops must only stops on reference and object. References can also be arrays and if the loop stops the value is never set in the object. (Breaks since 2.6.5 commit e3e4695)
This commit is contained in:
Fabien Potencier 2015-07-16 14:22:14 +02:00
commit 5626d73992
11 changed files with 243 additions and 6 deletions

View File

@ -7,6 +7,55 @@ in 2.6 minor versions.
To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash
To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v2.6.0...v2.6.1
* 2.6.10 (2015-07-13)
* bug #15248 Added 'default' color (jaytaph)
* bug #15243 Reload the session after regenerating its id (jakzal)
* bug #15202 [Security] allow to use `method` in XML configs (xabbuh)
* bug #15218 [Twig][Bridge] replaced `extends` with `use` in bootstrap_3_horizontal_layout.html.twig (MatTheCat)
* bug #15223 [Finder] Command::addAtIndex() fails with Command instance argument (thunderer)
* bug #15220 [DependencyInjection] Freeze also FrozenParameterBag::remove (lyrixx)
* bug #15110 Add a way to reset the singleton (dawehner)
* bug #15115 [Validator] always evaluate binary format when changed (xabbuh)
* bug #15163 Update DateTimeToArrayTransformer.php (zhil)
* bug #15150 [Translation] Azerbaijani language pluralization rule is wrong (shehi)
* bug #15159 Towards 100% HHVM compat (nicolas-grekas)
* bug #15146 Towards 100% HHVM compat (nicolas-grekas)
* bug #15069 [Form] Fixed: Data mappers always receive forms indexed by their names (webmozart)
* bug #15137 [Security] Initialize SwitchUserEvent::targetUser on attemptExitUser (Rvanlaak, xabbuh)
* bug #15126 [Validator] Fix BC for Validator's validate method (michalmarcinkowski)
* bug #15083 [DependencyInjection] Fail when dumping a Definition with no class nor factory (nicolas-grekas)
* bug #15127 [Validator] fix validation for Maestro UK card numbers (xabbuh)
* bug #15128 DbalLogger: Small nonutf8 array fix (vpetrovych, weaverryan)
* bug #15048 [Translation][Form][choice] empty_value shouldn't be translated when it has an empty value (Restless-ET)
* bug #15117 [Form] fixed sending non array data on submit to ResizeListener (BruceWouaigne)
* bug #15102 [Translation][debug cmd] fixed failing tests. (aitboudad)
* bug #13750 [DependencyInjection] Fixed decoration of service for service with parent (hason)
* bug #15086 Fixed the regexp for the validator of Maestro-based credit/debit cards (javiereguiluz)
* bug #15058 [Console] Fix STDERR output text on IBM iSeries OS400 (johnkary)
* bug #14853 [Validator] more strict e-mail validation regex (xabbuh)
* bug #15065 [Form] Fixed: remove quoted strings from Intl date formats (e.g. es_ES full pattern) (webmozart)
* bug #15039 [Translation][update cmd] taken account into bundle overrides path. (aitboudad)
* bug #15038 [Translation][debug cmd] taken account into bundle overrides path. (aitboudad)
* bug #14964 [bugfix][MonologBridge] WebProcessor: passing $extraFields to BaseWebProcessor (MacDada)
* bug #15036 [VarDumper] Fix dump output for better readability (nicolas-grekas)
* bug #15027 [Form] Fixed: Filter non-integers when selecting entities by int ID (webmozart, nicolas-grekas)
* bug #15000 [Debug] Fix fatal-errors handling on HHVM (nicolas-grekas)
* bug #14999 [Debug] Fix fatal-errors handling on HHVM (nicolas-grekas, digitalkaoz)
* bug #14959 [Debug+VarDumper] Fix handling of PHP7 "Throwable" exceptions (nicolas-grekas)
* bug #15010 [Debug] Fix log level of stacked errors (nicolas-grekas)
* bug #15017 [VarDumper] Fix uninitialized id in HtmlDumper (nicolas-grekas)
* bug #14980 Fixed fluent interface (jaytaph)
* bug #14974 [Security][Translation] #14920 update translations (vincentaubert)
* bug #14930 Bug #14836 [HttpFoundation] Moves default JSON encoding assignment fr… (Incognito)
* bug #14897 Allow new lines in Messages translated with transchoice() (replacement for #14867) (azine)
* bug #14895 [Form] Support DateTimeImmutable in transform() (c960657)
* bug #14891 without this change allways the legacy code get called (dominikzogg)
* bug #14859 Improve the config validation in TwigBundle (stof)
* bug #14785 [BrowserKit] Fix bug when uri starts with http. (amouhzi)
* bug #14807 [Security][Acl] enforce string identifiers (xabbuh)
* bug #14808 [WebProfilerBundle][logger] added missing deprecation message. (aitboudad)
* 2.6.9 (2015-05-30)
* bug #14777 Avoid using the app global variable in the profiler templates (stof)

View File

@ -7,6 +7,60 @@ in 2.7 minor versions.
To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash
To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v2.7.0...v2.7.1
* 2.7.2 (2015-07-13)
* bug #15248 Added 'default' color (jaytaph)
* bug #15243 Reload the session after regenerating its id (jakzal)
* bug #15176 [Serializer] Fix ClassMetadata::sleep() (dunglas)
* bug #15202 [Security] allow to use `method` in XML configs (xabbuh)
* bug #15218 [Twig][Bridge] replaced `extends` with `use` in bootstrap_3_horizontal_layout.html.twig (MatTheCat)
* bug #15223 [Finder] Command::addAtIndex() fails with Command instance argument (thunderer)
* bug #15220 [DependencyInjection] Freeze also FrozenParameterBag::remove (lyrixx)
* bug #15110 Add a way to reset the singleton (dawehner)
* bug #15183 [TwigBridge] fix for legacy asset() with EmptyVersionStrategy (xabbuh)
* bug #15115 [Validator] always evaluate binary format when changed (xabbuh)
* bug #15163 Update DateTimeToArrayTransformer.php (zhil)
* bug #15150 [Translation] Azerbaijani language pluralization rule is wrong (shehi)
* bug #15159 Towards 100% HHVM compat (nicolas-grekas)
* bug #15146 Towards 100% HHVM compat (nicolas-grekas)
* bug #15061 [Form] Fixed handling of choices passed in choice groups (webmozart)
* bug #15145 [Bridge/PhpUnit] Enforce a consistent locale (nicolas-grekas)
* bug #15069 [Form] Fixed: Data mappers always receive forms indexed by their names (webmozart)
* bug #15137 [Security] Initialize SwitchUserEvent::targetUser on attemptExitUser (Rvanlaak, xabbuh)
* bug #15142 Fix choice translation domain for expanded choice widget (jvasseur)
* bug #15126 [Validator] Fix BC for Validator's validate method (michalmarcinkowski)
* bug #15101 [Form] Fixed compatibility with FormTypeInterface implementations that don't extend AbstractType (webmozart)
* bug #15083 [DependencyInjection] Fail when dumping a Definition with no class nor factory (nicolas-grekas)
* bug #15127 [Validator] fix validation for Maestro UK card numbers (xabbuh)
* bug #15128 DbalLogger: Small nonutf8 array fix (vpetrovych, weaverryan)
* bug #15048 [Translation][Form][choice] empty_value shouldn't be translated when it has an empty value (Restless-ET)
* bug #15117 [Form] fixed sending non array data on submit to ResizeListener (BruceWouaigne)
* bug #15122 [Console] respect multi-character shortcuts (xabbuh)
* bug #15012 [Validator] don't trigger deprecation with empty group array (xabbuh)
* bug #15102 [Translation][debug cmd] fixed failing tests. (aitboudad)
* bug #13750 [DependencyInjection] Fixed decoration of service for service with parent (hason)
* bug #15086 Fixed the regexp for the validator of Maestro-based credit/debit cards (javiereguiluz)
* bug #15058 [Console] Fix STDERR output text on IBM iSeries OS400 (johnkary)
* bug #14853 [Validator] more strict e-mail validation regex (xabbuh)
* bug #15064 [Form] Fixed: Support objects with __toString() in choice groups (webmozart)
* bug #15065 [Form] Fixed: remove quoted strings from Intl date formats (e.g. es_ES full pattern) (webmozart)
* bug #15039 [Translation][update cmd] taken account into bundle overrides path. (aitboudad)
* bug #15038 [Translation][debug cmd] taken account into bundle overrides path. (aitboudad)
* bug #14964 [bugfix][MonologBridge] WebProcessor: passing $extraFields to BaseWebProcessor (MacDada)
* bug #14989 [FrameworkBundle] Reuse PropertyAccessor service for ObjectNormalizer (dunglas)
* bug #15036 [VarDumper] Fix dump output for better readability (nicolas-grekas)
* bug #15031 [PhpUnitBridge] Enforce @-silencing of deprecation notices according to new policy (nicolas-grekas)
* bug #15027 [Form] Fixed: Filter non-integers when selecting entities by int ID (webmozart, nicolas-grekas)
* bug #15000 [Debug] Fix fatal-errors handling on HHVM (nicolas-grekas)
* bug #14999 [Debug] Fix fatal-errors handling on HHVM (nicolas-grekas, digitalkaoz)
* bug #14959 [Debug+VarDumper] Fix handling of PHP7 "Throwable" exceptions (nicolas-grekas)
* bug #15010 [Debug] Fix log level of stacked errors (nicolas-grekas)
* bug #15017 [VarDumper] Fix uninitialized id in HtmlDumper (nicolas-grekas)
* bug #14980 Fixed fluent interface (jaytaph)
* bug #14974 [Security][Translation] #14920 update translations (vincentaubert)
* bug #14950 [Form] Fixed: Filter non-integers when selecting entities by int ID (webmozart)
* bug #14930 Bug #14836 [HttpFoundation] Moves default JSON encoding assignment fr… (Incognito)
* 2.7.1 (2015-06-11)
* bug #14835 [DependencyInjection] Fixed resolving of service configurators containing Definition objects (webmozart)

View File

@ -87,7 +87,7 @@ abstract class DoctrineType extends AbstractType
*/
public static function createChoiceName($choice, $key, $value)
{
return (string) $value;
return str_replace('-', '_', (string) $value);
}
/**

View File

@ -495,6 +495,31 @@ class EntityTypeTest extends TypeTestCase
$this->assertSame('3', $field['3']->getViewData());
}
public function testSubmitMultipleExpandedWithNegativeIntegerId()
{
$entity1 = new SingleIntIdEntity(-1, 'Foo');
$entity2 = new SingleIntIdEntity(2, 'Bar');
$this->persist(array($entity1, $entity2));
$field = $this->factory->createNamed('name', 'entity', null, array(
'multiple' => true,
'expanded' => true,
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
'choice_label' => 'name',
));
$field->submit(array('-1'));
$expected = new ArrayCollection(array($entity1));
$this->assertTrue($field->isSynchronized());
$this->assertEquals($expected, $field->getData());
$this->assertTrue($field['_1']->getData());
$this->assertFalse($field['2']->getData());
}
public function testOverrideChoices()
{
$entity1 = new SingleIntIdEntity(1, 'Foo');

View File

@ -162,7 +162,7 @@ class ChoiceQuestion extends Question
throw new \InvalidArgumentException(sprintf($errorMessage, $value));
}
$multiselectChoices[] = $choices[(string) $result];
$multiselectChoices[] = (string) $result;
}
if ($multiselect) {

View File

@ -36,15 +36,18 @@ class QuestionHelperTest extends \PHPUnit_Framework_TestCase
$questionHelper->setInputStream($this->getInputStream("\n1\n 1 \nFabien\n1\nFabien\n1\n0,2\n 0 , 2 \n\n\n"));
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes, '2');
$question->setMaxAttempts(1);
// first answer is an empty answer, we're supposed to receive the default value
$this->assertEquals('Spiderman', $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question));
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes);
$question->setMaxAttempts(1);
$this->assertEquals('Batman', $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question));
$this->assertEquals('Batman', $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question));
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes);
$question->setErrorMessage('Input "%s" is not a superhero!');
$question->setMaxAttempts(2);
$this->assertEquals('Batman', $questionHelper->ask($this->createInputInterfaceMock(), $output = $this->createOutputInterface(), $question));
rewind($output->getStream());
@ -61,6 +64,7 @@ class QuestionHelperTest extends \PHPUnit_Framework_TestCase
}
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes, null);
$question->setMaxAttempts(1);
$question->setMultiselect(true);
$this->assertEquals(array('Batman'), $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question));
@ -68,11 +72,13 @@ class QuestionHelperTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(array('Superman', 'Spiderman'), $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question));
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes, '0,1');
$question->setMaxAttempts(1);
$question->setMultiselect(true);
$this->assertEquals(array('Superman', 'Batman'), $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question));
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes, ' 0 , 1 ');
$question->setMaxAttempts(1);
$question->setMultiselect(true);
$this->assertEquals(array('Superman', 'Batman'), $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question));
@ -227,6 +233,7 @@ class QuestionHelperTest extends \PHPUnit_Framework_TestCase
$dialog->setHelperSet($helperSet);
$question = new ChoiceQuestion('Please select the environment to load', $possibleChoices);
$question->setMaxAttempts(1);
$answer = $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question);
$this->assertSame($expectedValue, $answer);

View File

@ -1247,7 +1247,7 @@ class Response
{
$status = ob_get_status(true);
$level = count($status);
$flags = PHP_VERSION_ID >= 50400 ? PHP_OUTPUT_HANDLER_REMOVABLE | ($flush ? PHP_OUTPUT_HANDLER_FLUSHABLE : PHP_OUTPUT_HANDLER_CLEANABLE) : -1;
$flags = defined('PHP_OUTPUT_HANDLER_REMOVABLE') ? PHP_OUTPUT_HANDLER_REMOVABLE | ($flush ? PHP_OUTPUT_HANDLER_FLUSHABLE : PHP_OUTPUT_HANDLER_CLEANABLE) : -1;
while ($level-- > $targetLevel && ($s = $status[$level]) && (!isset($s['del']) ? !isset($s['flags']) || $flags === ($s['flags'] & $flags) : $s['del'])) {
if ($flush) {

View File

@ -88,7 +88,7 @@ class PropertyAccessor implements PropertyAccessorInterface
$this->writeProperty($objectOrArray, $property, $value);
}
if ($propertyValues[$i][self::IS_REF]) {
if ($propertyValues[$i][self::IS_REF] && is_object($objectOrArray)) {
return;
}
@ -149,7 +149,7 @@ class PropertyAccessor implements PropertyAccessorInterface
}
}
if ($propertyValues[$i][self::IS_REF]) {
if ($propertyValues[$i][self::IS_REF] && is_object($objectOrArray)) {
return true;
}
}

View File

@ -0,0 +1,27 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\PropertyAccess\Tests\Fixtures;
class TestClassIsWritable
{
protected $value;
public function getValue()
{
return $this->value;
}
public function __construct($value)
{
$this->value = $value;
}
}

View File

@ -0,0 +1,32 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\PropertyAccess\Tests\Fixtures;
class TestClassSetValue
{
protected $value;
public function getValue()
{
return $this->value;
}
public function setValue($value)
{
$this->value = $value;
}
public function __construct($value)
{
$this->value = $value;
}
}

View File

@ -16,6 +16,8 @@ use Symfony\Component\PropertyAccess\Tests\Fixtures\TestClass;
use Symfony\Component\PropertyAccess\Tests\Fixtures\TestClassMagicCall;
use Symfony\Component\PropertyAccess\Tests\Fixtures\TestClassMagicGet;
use Symfony\Component\PropertyAccess\Tests\Fixtures\Ticket5775Object;
use Symfony\Component\PropertyAccess\Tests\Fixtures\TestClassSetValue;
use Symfony\Component\PropertyAccess\Tests\Fixtures\TestClassIsWritable;
class PropertyAccessorTest extends \PHPUnit_Framework_TestCase
{
@ -446,4 +448,45 @@ class PropertyAccessorTest extends \PHPUnit_Framework_TestCase
$this->propertyAccessor->setValue($obj, 'publicProperty[foo][bar]', 'Updated');
$this->assertSame('Updated', $obj->publicProperty['foo']['bar']);
}
}
public function getReferenceChainObjectsForSetValue()
{
return array(
array(array('a' => array('b' => array('c' => 'old-value'))), '[a][b][c]', 'new-value'),
array(new TestClassSetValue(new TestClassSetValue('old-value')), 'value.value', 'new-value'),
array(new TestClassSetValue(array('a' => array('b' => array('c' => new TestClassSetValue('old-value'))))), 'value[a][b][c].value', 'new-value'),
array(new TestClassSetValue(array('a' => array('b' => 'old-value'))), 'value[a][b]', 'new-value'),
array(new \ArrayIterator(array('a' => array('b' => array('c' => 'old-value')))), '[a][b][c]', 'new-value'),
);
}
/**
* @dataProvider getReferenceChainObjectsForSetValue
*/
public function testSetValueForReferenceChainIssue($object, $path, $value)
{
$this->propertyAccessor->setValue($object, $path, $value);
$this->assertEquals($value, $this->propertyAccessor->getValue($object, $path));
}
public function getReferenceChainObjectsForIsWritable()
{
return array(
array(new TestClassIsWritable(array('a' => array('b' => 'old-value'))), 'value[a][b]', false),
array(new TestClassIsWritable(new \ArrayIterator(array('a' => array('b' => 'old-value')))), 'value[a][b]', true),
array(new TestClassIsWritable(array('a' => array('b' => array('c' => new TestClassSetValue('old-value'))))), 'value[a][b][c].value', true),
);
}
/**
* @dataProvider getReferenceChainObjectsForIsWritable
*/
public function testIsWritableForReferenceChainIssue($object, $path, $value)
{
$this->assertEquals($value, $this->propertyAccessor->isWritable($object, $path));
}
}