Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5626d73

Browse files
committed
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)
2 parents b9f45d1 + 99f3475 commit 5626d73

File tree

11 files changed

+243
-6
lines changed

11 files changed

+243
-6
lines changed

CHANGELOG-2.6.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,55 @@ in 2.6 minor versions.
77
To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash
88
To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v2.6.0...v2.6.1
99

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

1261
* bug #14777 Avoid using the app global variable in the profiler templates (stof)

CHANGELOG-2.7.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,60 @@ in 2.7 minor versions.
77
To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash
88
To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v2.7.0...v2.7.1
99

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

1266
* bug #14835 [DependencyInjection] Fixed resolving of service configurators containing Definition objects (webmozart)

src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public static function createChoiceLabel($choice)
8787
*/
8888
public static function createChoiceName($choice, $key, $value)
8989
{
90-
return (string) $value;
90+
return str_replace('-', '_', (string) $value);
9191
}
9292

9393
/**

src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,31 @@ public function testSubmitMultipleExpanded()
495495
$this->assertSame('3', $field['3']->getViewData());
496496
}
497497

498+
public function testSubmitMultipleExpandedWithNegativeIntegerId()
499+
{
500+
$entity1 = new SingleIntIdEntity(-1, 'Foo');
501+
$entity2 = new SingleIntIdEntity(2, 'Bar');
502+
503+
$this->persist(array($entity1, $entity2));
504+
505+
$field = $this->factory->createNamed('name', 'entity', null, array(
506+
'multiple' => true,
507+
'expanded' => true,
508+
'em' => 'default',
509+
'class' => self::SINGLE_IDENT_CLASS,
510+
'choice_label' => 'name',
511+
));
512+
513+
$field->submit(array('-1'));
514+
515+
$expected = new ArrayCollection(array($entity1));
516+
517+
$this->assertTrue($field->isSynchronized());
518+
$this->assertEquals($expected, $field->getData());
519+
$this->assertTrue($field['_1']->getData());
520+
$this->assertFalse($field['2']->getData());
521+
}
522+
498523
public function testOverrideChoices()
499524
{
500525
$entity1 = new SingleIntIdEntity(1, 'Foo');

src/Symfony/Component/Console/Question/ChoiceQuestion.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ private function getDefaultValidator()
162162
throw new \InvalidArgumentException(sprintf($errorMessage, $value));
163163
}
164164

165-
$multiselectChoices[] = $choices[(string) $result];
165+
$multiselectChoices[] = (string) $result;
166166
}
167167

168168
if ($multiselect) {

src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,18 @@ public function testAskChoice()
3636
$questionHelper->setInputStream($this->getInputStream("\n1\n 1 \nFabien\n1\nFabien\n1\n0,2\n 0 , 2 \n\n\n"));
3737

3838
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes, '2');
39+
$question->setMaxAttempts(1);
3940
// first answer is an empty answer, we're supposed to receive the default value
4041
$this->assertEquals('Spiderman', $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question));
4142

4243
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes);
44+
$question->setMaxAttempts(1);
4345
$this->assertEquals('Batman', $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question));
4446
$this->assertEquals('Batman', $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question));
4547

4648
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes);
4749
$question->setErrorMessage('Input "%s" is not a superhero!');
50+
$question->setMaxAttempts(2);
4851
$this->assertEquals('Batman', $questionHelper->ask($this->createInputInterfaceMock(), $output = $this->createOutputInterface(), $question));
4952

5053
rewind($output->getStream());
@@ -61,18 +64,21 @@ public function testAskChoice()
6164
}
6265

6366
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes, null);
67+
$question->setMaxAttempts(1);
6468
$question->setMultiselect(true);
6569

6670
$this->assertEquals(array('Batman'), $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question));
6771
$this->assertEquals(array('Superman', 'Spiderman'), $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question));
6872
$this->assertEquals(array('Superman', 'Spiderman'), $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question));
6973

7074
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes, '0,1');
75+
$question->setMaxAttempts(1);
7176
$question->setMultiselect(true);
7277

7378
$this->assertEquals(array('Superman', 'Batman'), $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question));
7479

7580
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes, ' 0 , 1 ');
81+
$question->setMaxAttempts(1);
7682
$question->setMultiselect(true);
7783

7884
$this->assertEquals(array('Superman', 'Batman'), $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question));
@@ -227,6 +233,7 @@ public function testSelectChoiceFromSimpleChoices($providedAnswer, $expectedValu
227233
$dialog->setHelperSet($helperSet);
228234

229235
$question = new ChoiceQuestion('Please select the environment to load', $possibleChoices);
236+
$question->setMaxAttempts(1);
230237
$answer = $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question);
231238

232239
$this->assertSame($expectedValue, $answer);

src/Symfony/Component/HttpFoundation/Response.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1247,7 +1247,7 @@ public static function closeOutputBuffers($targetLevel, $flush)
12471247
{
12481248
$status = ob_get_status(true);
12491249
$level = count($status);
1250-
$flags = PHP_VERSION_ID >= 50400 ? PHP_OUTPUT_HANDLER_REMOVABLE | ($flush ? PHP_OUTPUT_HANDLER_FLUSHABLE : PHP_OUTPUT_HANDLER_CLEANABLE) : -1;
1250+
$flags = defined('PHP_OUTPUT_HANDLER_REMOVABLE') ? PHP_OUTPUT_HANDLER_REMOVABLE | ($flush ? PHP_OUTPUT_HANDLER_FLUSHABLE : PHP_OUTPUT_HANDLER_CLEANABLE) : -1;
12511251

12521252
while ($level-- > $targetLevel && ($s = $status[$level]) && (!isset($s['del']) ? !isset($s['flags']) || $flags === ($s['flags'] & $flags) : $s['del'])) {
12531253
if ($flush) {

src/Symfony/Component/PropertyAccess/PropertyAccessor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function setValue(&$objectOrArray, $propertyPath, $value)
8888
$this->writeProperty($objectOrArray, $property, $value);
8989
}
9090

91-
if ($propertyValues[$i][self::IS_REF]) {
91+
if ($propertyValues[$i][self::IS_REF] && is_object($objectOrArray)) {
9292
return;
9393
}
9494

@@ -149,7 +149,7 @@ public function isWritable($objectOrArray, $propertyPath)
149149
}
150150
}
151151

152-
if ($propertyValues[$i][self::IS_REF]) {
152+
if ($propertyValues[$i][self::IS_REF] && is_object($objectOrArray)) {
153153
return true;
154154
}
155155
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\PropertyAccess\Tests\Fixtures;
13+
14+
class TestClassIsWritable
15+
{
16+
protected $value;
17+
18+
public function getValue()
19+
{
20+
return $this->value;
21+
}
22+
23+
public function __construct($value)
24+
{
25+
$this->value = $value;
26+
}
27+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\PropertyAccess\Tests\Fixtures;
13+
14+
class TestClassSetValue
15+
{
16+
protected $value;
17+
18+
public function getValue()
19+
{
20+
return $this->value;
21+
}
22+
23+
public function setValue($value)
24+
{
25+
$this->value = $value;
26+
}
27+
28+
public function __construct($value)
29+
{
30+
$this->value = $value;
31+
}
32+
}

src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
use Symfony\Component\PropertyAccess\Tests\Fixtures\TestClassMagicCall;
1717
use Symfony\Component\PropertyAccess\Tests\Fixtures\TestClassMagicGet;
1818
use Symfony\Component\PropertyAccess\Tests\Fixtures\Ticket5775Object;
19+
use Symfony\Component\PropertyAccess\Tests\Fixtures\TestClassSetValue;
20+
use Symfony\Component\PropertyAccess\Tests\Fixtures\TestClassIsWritable;
1921

2022
class PropertyAccessorTest extends \PHPUnit_Framework_TestCase
2123
{
@@ -446,4 +448,45 @@ public function testSetValueDeepWithMagicGetter()
446448
$this->propertyAccessor->setValue($obj, 'publicProperty[foo][bar]', 'Updated');
447449
$this->assertSame('Updated', $obj->publicProperty['foo']['bar']);
448450
}
449-
}
451+
452+
public function getReferenceChainObjectsForSetValue()
453+
{
454+
return array(
455+
array(array('a' => array('b' => array('c' => 'old-value'))), '[a][b][c]', 'new-value'),
456+
array(new TestClassSetValue(new TestClassSetValue('old-value')), 'value.value', 'new-value'),
457+
array(new TestClassSetValue(array('a' => array('b' => array('c' => new TestClassSetValue('old-value'))))), 'value[a][b][c].value', 'new-value'),
458+
array(new TestClassSetValue(array('a' => array('b' => 'old-value'))), 'value[a][b]', 'new-value'),
459+
array(new \ArrayIterator(array('a' => array('b' => array('c' => 'old-value')))), '[a][b][c]', 'new-value'),
460+
);
461+
462+
}
463+
464+
/**
465+
* @dataProvider getReferenceChainObjectsForSetValue
466+
*/
467+
public function testSetValueForReferenceChainIssue($object, $path, $value)
468+
{
469+
$this->propertyAccessor->setValue($object, $path, $value);
470+
471+
$this->assertEquals($value, $this->propertyAccessor->getValue($object, $path));
472+
}
473+
474+
public function getReferenceChainObjectsForIsWritable()
475+
{
476+
return array(
477+
array(new TestClassIsWritable(array('a' => array('b' => 'old-value'))), 'value[a][b]', false),
478+
array(new TestClassIsWritable(new \ArrayIterator(array('a' => array('b' => 'old-value')))), 'value[a][b]', true),
479+
array(new TestClassIsWritable(array('a' => array('b' => array('c' => new TestClassSetValue('old-value'))))), 'value[a][b][c].value', true),
480+
);
481+
482+
}
483+
484+
/**
485+
* @dataProvider getReferenceChainObjectsForIsWritable
486+
*/
487+
public function testIsWritableForReferenceChainIssue($object, $path, $value)
488+
{
489+
$this->assertEquals($value, $this->propertyAccessor->isWritable($object, $path));
490+
}
491+
492+
}

0 commit comments

Comments
 (0)