Skip to content

Commit 07de761

Browse files
committed
Merge branch '2.3' into 2.4
* 2.3: (30 commits) Update validators.ro.xlf add non-standard port to HTTP_HOST fixed attribute "source-language" for translations Update PluralizationRules.php Update validators.pt_BR.xlf Translated remaining items (57-72) Updated Vietnamese translation added missing dot in translation updated Arabic translations Update validators.id.xlf [Validator] Translate validator messages into Brazilian Portuguese Added more Swedish validator translations Update validators.ca.xlf fixed typos in Welsh translation Added missing Croatian translations [Form] fixed allow render 0 and 0.0 numeric input values Fixed validators.nl.xlf [Component/Security] Fixed some phpdocs in Security/Core Completed Luxembourgish translation Fixing the Logger deprecation notices to match the correct method name it should be informing of ... Conflicts: src/Symfony/Bridge/Twig/composer.json src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_widget_simple.html.php src/Symfony/Component/Console/Application.php
2 parents 8c47a9f + 2381680 commit 07de761

File tree

52 files changed

+1072
-105
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1072
-105
lines changed

.travis.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ services: mongodb
1515

1616
before_script:
1717
- sudo apt-get install parallel
18-
- sh -c 'if [ $(php -r "echo (int) defined('HHVM_VERSION');") -eq 0 ]; then echo "" >> "~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini"; fi;'
19-
- sh -c 'if [ $(php -r "echo (int) defined('HHVM_VERSION');") -eq 0 ]; then echo "extension = mongo.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;'
20-
- sh -c 'if [ $(php -r "echo PHP_MINOR_VERSION;") -le 4 ]; then echo "extension = apc.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;'
21-
- sh -c 'if [ $(php -r "echo (int) defined('HHVM_VERSION');") -eq 0 ]; then echo "extension = memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;'
22-
- sh -c 'if [ $(php -r "echo (int) defined('HHVM_VERSION');") -eq 0 ]; then echo "extension = memcache.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;'
18+
- sh -c 'if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then echo "" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini; fi;'
19+
- sh -c 'if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then echo "extension = mongo.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;'
20+
- sh -c 'if [ "$TRAVIS_PHP_VERSION" != "hhvm" ] && [ $(php -r "echo PHP_MINOR_VERSION;") -le 4 ]; then echo "extension = apc.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;'
21+
- sh -c 'if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then echo "extension = memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;'
22+
- sh -c 'if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then echo "extension = memcache.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;'
2323
- COMPOSER_ROOT_VERSION=dev-master composer --prefer-source --dev install
2424

2525
script:

src/Symfony/Bridge/Doctrine/Form/ChoiceList/ORMQueryBuilderLoader.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,18 @@ public function getEntitiesByIds($identifier, array $values)
8181
$parameter = 'ORMQueryBuilderLoader_getEntitiesByIds_'.$identifier;
8282
$where = $qb->expr()->in($alias.'.'.$identifier, ':'.$parameter);
8383

84+
// Guess type
85+
$entity = current($qb->getRootEntities());
86+
$metadata = $qb->getEntityManager()->getClassMetadata($entity);
87+
if (in_array($metadata->getTypeOfField($identifier), array('integer', 'bigint', 'smallint'))) {
88+
$parameterType = Connection::PARAM_INT_ARRAY;
89+
} else {
90+
$parameterType = Connection::PARAM_STR_ARRAY;
91+
}
92+
8493
return $qb->andWhere($where)
8594
->getQuery()
86-
->setParameter($parameter, $values, Connection::PARAM_STR_ARRAY)
95+
->setParameter($parameter, $values, $parameterType)
8796
->getResult();
8897
}
8998
}

src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/ORMQueryBuilderLoaderTest.php

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@
1212
namespace Symfony\Bridge\Doctrine\Tests\Form\ChoiceList;
1313

1414
use Symfony\Bridge\Doctrine\Form\ChoiceList\ORMQueryBuilderLoader;
15+
use Symfony\Bridge\Doctrine\Tests\DoctrineOrmTestCase;
16+
use Doctrine\DBAL\Connection;
1517

16-
class ORMQueryBuilderLoaderTest extends \PHPUnit_Framework_TestCase
18+
class ORMQueryBuilderLoaderTest extends DoctrineOrmTestCase
1719
{
1820
/**
1921
* @expectedException \Symfony\Component\Form\Exception\UnexpectedTypeException
@@ -32,4 +34,43 @@ public function testClosureRequiresTheEntityManager()
3234

3335
new ORMQueryBuilderLoader($closure);
3436
}
37+
38+
public function testIdentifierTypeIsStringArray()
39+
{
40+
$this->checkIdentifierType('Symfony\Bridge\Doctrine\Tests\Fixtures\SingleStringIdEntity', Connection::PARAM_STR_ARRAY);
41+
}
42+
43+
public function testIdentifierTypeIsIntegerArray()
44+
{
45+
$this->checkIdentifierType('Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity', Connection::PARAM_INT_ARRAY);
46+
}
47+
48+
protected function checkIdentifierType($classname, $expectedType)
49+
{
50+
$em = $this->createTestEntityManager();
51+
52+
$query = $this->getMockBuilder('QueryMock')
53+
->setMethods(array('setParameter', 'getResult', 'getSql', '_doExecute'))
54+
->getMock();
55+
56+
$query->expects($this->once())
57+
->method('setParameter')
58+
->with('ORMQueryBuilderLoader_getEntitiesByIds_id', array(), $expectedType)
59+
->will($this->returnValue($query));
60+
61+
$qb = $this->getMockBuilder('Doctrine\ORM\QueryBuilder')
62+
->setConstructorArgs(array($em))
63+
->setMethods(array('getQuery'))
64+
->getMock();
65+
66+
$qb->expects($this->once())
67+
->method('getQuery')
68+
->will($this->returnValue($query));
69+
70+
$qb->select('e')
71+
->from($classname, 'e');
72+
73+
$loader = new ORMQueryBuilderLoader($qb);
74+
$loader->getEntitiesByIds('id', array());
75+
}
3576
}

src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueValidatorTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,23 @@ public function testAssociatedEntity()
330330
$this->assertEquals(1, $violationsList->count());
331331
}
332332

333+
public function testAssociatedEntityWithNull()
334+
{
335+
$entityManagerName = "foo";
336+
$em = DoctrineTestHelper::createTestEntityManager();
337+
$this->createSchema($em);
338+
$validator = $this->createValidator($entityManagerName, $em, 'Symfony\Bridge\Doctrine\Tests\Fixtures\AssociationEntity', array('single'), null, 'findBy', false);
339+
340+
$associated = new AssociationEntity();
341+
$associated->single = null;
342+
343+
$em->persist($associated);
344+
$em->flush();
345+
346+
$violationsList = $validator->validate($associated);
347+
$this->assertEquals(0, $violationsList->count());
348+
}
349+
333350
/**
334351
* @group GH-1635
335352
*/

src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function validate($entity, Constraint $constraint)
8989
return;
9090
}
9191

92-
if ($class->hasAssociation($fieldName)) {
92+
if (null !== $criteria[$fieldName] && $class->hasAssociation($fieldName)) {
9393
/* Ensure the Proxy is initialized before using reflection to
9494
* read its identifiers. This is necessary because the wrapped
9595
* getter methods in the Proxy are being bypassed.

src/Symfony/Bridge/Twig/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"require": {
1919
"php": ">=5.3.3",
2020
"symfony/security-csrf": "~2.4",
21-
"twig/twig": "~1.11"
21+
"twig/twig": "~1.12"
2222
},
2323
"require-dev": {
2424
"symfony/form": "~2.2",

src/Symfony/Bundle/FrameworkBundle/Controller/RedirectController.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Symfony\Component\HttpFoundation\RedirectResponse;
1616
use Symfony\Component\HttpFoundation\Request;
1717
use Symfony\Component\HttpFoundation\Response;
18+
use Symfony\Component\HttpKernel\Exception\HttpException;
1819
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
1920

2021
/**
@@ -39,11 +40,13 @@ class RedirectController extends ContainerAware
3940
* @param Boolean|array $ignoreAttributes Whether to ignore attributes or an array of attributes to ignore
4041
*
4142
* @return Response A Response instance
43+
*
44+
* @throws HttpException In case the route name is empty
4245
*/
4346
public function redirectAction(Request $request, $route, $permanent = false, $ignoreAttributes = false)
4447
{
4548
if ('' == $route) {
46-
return new Response(null, $permanent ? 410 : 404);
49+
throw new HttpException($permanent ? 410 : 404);
4750
}
4851

4952
$attributes = array();
@@ -75,11 +78,13 @@ public function redirectAction(Request $request, $route, $permanent = false, $ig
7578
* @param integer|null $httpsPort The HTTPS port (null to keep the current one for the same scheme or the configured port in the container)
7679
*
7780
* @return Response A Response instance
81+
*
82+
* @throws HttpException In case the path is empty
7883
*/
7984
public function urlRedirectAction(Request $request, $path, $permanent = false, $scheme = null, $httpPort = null, $httpsPort = null)
8085
{
8186
if ('' == $path) {
82-
return new Response(null, $permanent ? 410 : 404);
87+
throw new HttpException($permanent ? 410 : 404);
8388
}
8489

8590
$statusCode = $permanent ? 301 : 302;
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
<input type="<?php echo isset($type) ? $view->escape($type) : 'text' ?>" <?php echo $view['form']->block($form, 'widget_attributes') ?><?php if (!empty($value)): ?> value="<?php echo $view->escape($value) ?>"<?php endif ?> />
1+
<input
2+
type="<?php echo isset($type) ? $view->escape($type) : 'text' ?>"
3+
<?php echo $view['form']->block($form, 'widget_attributes') ?>
4+
<?php if (!empty($value) || is_numeric($value)): ?> value="<?php echo $view->escape($value) ?>"<?php endif ?>
5+
/>

src/Symfony/Bundle/FrameworkBundle/Tests/Controller/RedirectControllerTest.php

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Symfony\Component\HttpFoundation\Response;
1515
use Symfony\Component\HttpFoundation\ParameterBag;
1616
use Symfony\Component\HttpFoundation\Request;
17+
use Symfony\Component\HttpKernel\Exception\HttpException;
1718
use Symfony\Bundle\FrameworkBundle\Controller\RedirectController;
1819
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
1920

@@ -27,13 +28,19 @@ public function testEmptyRoute()
2728
$request = new Request();
2829
$controller = new RedirectController();
2930

30-
$returnResponse = $controller->redirectAction($request, '', true);
31-
$this->assertInstanceOf('\Symfony\Component\HttpFoundation\Response', $returnResponse);
32-
$this->assertEquals(410, $returnResponse->getStatusCode());
31+
try {
32+
$controller->redirectAction($request, '', true);
33+
$this->fail('Expected Symfony\Component\HttpKernel\Exception\HttpException to be thrown');
34+
} catch (HttpException $e) {
35+
$this->assertSame(410, $e->getStatusCode());
36+
}
3337

34-
$returnResponse = $controller->redirectAction($request, '', false);
35-
$this->assertInstanceOf('\Symfony\Component\HttpFoundation\Response', $returnResponse);
36-
$this->assertEquals(404, $returnResponse->getStatusCode());
38+
try {
39+
$controller->redirectAction($request, '', false);
40+
$this->fail('Expected Symfony\Component\HttpKernel\Exception\HttpException to be thrown');
41+
} catch (HttpException $e) {
42+
$this->assertSame(404, $e->getStatusCode());
43+
}
3744
}
3845

3946
/**
@@ -98,13 +105,19 @@ public function testEmptyPath()
98105
$request = new Request();
99106
$controller = new RedirectController();
100107

101-
$returnResponse = $controller->urlRedirectAction($request, '', true);
102-
$this->assertInstanceOf('\Symfony\Component\HttpFoundation\Response', $returnResponse);
103-
$this->assertEquals(410, $returnResponse->getStatusCode());
108+
try {
109+
$controller->urlRedirectAction($request, '', true);
110+
$this->fail('Expected Symfony\Component\HttpKernel\Exception\HttpException to be thrown');
111+
} catch (HttpException $e) {
112+
$this->assertSame(410, $e->getStatusCode());
113+
}
104114

105-
$returnResponse = $controller->urlRedirectAction($request, '', false);
106-
$this->assertInstanceOf('\Symfony\Component\HttpFoundation\Response', $returnResponse);
107-
$this->assertEquals(404, $returnResponse->getStatusCode());
115+
try {
116+
$controller->urlRedirectAction($request, '', false);
117+
$this->fail('Expected Symfony\Component\HttpKernel\Exception\HttpException to be thrown');
118+
} catch (HttpException $e) {
119+
$this->assertSame(404, $e->getStatusCode());
120+
}
108121
}
109122

110123
public function testFullURL()

src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ public function toolbarAction(Request $request, $token)
227227

228228
$session = $request->getSession();
229229

230-
if (null !== $session && $session->getFlashBag() instanceof AutoExpireFlashBag) {
230+
if (null !== $session && $session->isStarted() && $session->getFlashBag() instanceof AutoExpireFlashBag) {
231231
// keep current flashes for one more request if using AutoExpireFlashBag
232232
$session->getFlashBag()->setAll($session->getFlashBag()->peekAll());
233233
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy