Skip to content

Commit a455848

Browse files
committed
Merge branch '2.5'
* 2.5: PHP Fatal error when getContainer method of ContainerAwareCommand has be... [HttpFoundation] Fixed isSecure() check to be compliant with the docs Update MimeTypeExtensionGuesser.php fix test src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php [Process] Do not redirect output to file handles when output is disabled [Validator] Fix array notation in the PropertyPath::append() Fixed undefined ImageValidator:: property when uploading an image during functional tests [HttpKernel] Fix event dispatcher dependency Fixed the Travis build on PHP 5.3.3
2 parents 319f561 + 2332c19 commit a455848

File tree

3 files changed

+37
-2
lines changed

3 files changed

+37
-2
lines changed

Constraints/FileValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public function validate($value, Constraint $constraint)
162162
$this->context->addViolation($constraint->maxSizeMessage, array(
163163
'{{ size }}' => $sizeAsString,
164164
'{{ limit }}' => $limitAsString,
165-
'{{ suffix }}' => static::$suffices[$coef],
165+
'{{ suffix }}' => self::$suffices[$coef],
166166
'{{ file }}' => $path,
167167
));
168168

Tests/Util/PropertyPathTest.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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\Validator\Tests\Util;
13+
14+
use Symfony\Component\Validator\Util\PropertyPath;
15+
16+
class PropertyPathTest extends \PHPUnit_Framework_TestCase
17+
{
18+
/**
19+
* @dataProvider provideAppendPaths
20+
*/
21+
public function testAppend($basePath, $subPath, $expectedPath, $message)
22+
{
23+
$this->assertSame($expectedPath, PropertyPath::append($basePath, $subPath), $message);
24+
}
25+
26+
public function provideAppendPaths()
27+
{
28+
return array(
29+
array('foo', '', 'foo', 'It returns the basePath if subPath is empty'),
30+
array('', 'bar', 'bar', 'It returns the subPath if basePath is empty'),
31+
array('foo', 'bar', 'foo.bar', 'It append the subPath to the basePath'),
32+
array('foo', '[bar]', 'foo[bar]', 'It does not include the dot separator if subPath uses the array notation')
33+
);
34+
}
35+
}

Util/PropertyPath.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class PropertyPath
3838
public static function append($basePath, $subPath)
3939
{
4040
if ('' !== (string) $subPath) {
41-
if ('[' === $subPath{1}) {
41+
if ('[' === $subPath{0}) {
4242
return $basePath.$subPath;
4343
}
4444

0 commit comments

Comments
 (0)