Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1509ec9

Browse filesBrowse files
Merge branch '3.0'
* 3.0: Fix merge [Form] fix BC break introduced with prototype_data option [Ldap] Escape carriage returns in LDAP DNs. Upgrade for 2.8: ContainerAware was deprecated in favour of ContainerAwareTrait [ci skip] simplify debug error_reporting levels given php version > 5.3 Fix wrong method name mapping in UPGRADE-3.0.md Use correct height for clearer [Validator] fixed raising violations to a maximum of one
2 parents 28e0f7b + f9ba2cd commit 1509ec9
Copy full SHA for 1509ec9

File tree

Expand file treeCollapse file tree

12 files changed

+94
-25
lines changed
Filter options
Expand file treeCollapse file tree

12 files changed

+94
-25
lines changed

‎UPGRADE-3.0.md

Copy file name to clipboardExpand all lines: UPGRADE-3.0.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ UPGRADE FROM 2.x to 3.0
1111
| `registerNamespaces()` | `addPrefixes()`
1212
| `registerPrefixes()` | `addPrefixes()`
1313
| `registerNamespaces()` | `addPrefix()`
14-
| `registerPrefixes()` | `addPrefix()`
14+
| `registerPrefix()` | `addPrefix()`
1515
| `getNamespaces()` | `getPrefixes()`
1616
| `getNamespaceFallbacks()` | `getFallbackDirs()`
1717
| `getPrefixFallbacks()` | `getFallbackDirs()`

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

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ public function testSubmitSingleNonExpandedStringCastableIdentifier()
603603

604604
$this->persist(array($entity1, $entity2));
605605

606-
$field = $this->factory->createNamed('name', 'entity', null, array(
606+
$field = $this->factory->createNamed('name', EntityType::class, null, array(
607607
'multiple' => false,
608608
'expanded' => false,
609609
'em' => 'default',
@@ -625,7 +625,7 @@ public function testSubmitSingleStringCastableIdentifierExpanded()
625625

626626
$this->persist(array($entity1, $entity2));
627627

628-
$field = $this->factory->createNamed('name', 'entity', null, array(
628+
$field = $this->factory->createNamed('name', EntityType::class, null, array(
629629
'multiple' => false,
630630
'expanded' => true,
631631
'em' => 'default',
@@ -651,7 +651,7 @@ public function testSubmitMultipleNonExpandedStringCastableIdentifierForExisting
651651

652652
$this->persist(array($entity1, $entity2, $entity3));
653653

654-
$field = $this->factory->createNamed('name', 'entity', null, array(
654+
$field = $this->factory->createNamed('name', EntityType::class, null, array(
655655
'multiple' => true,
656656
'expanded' => false,
657657
'em' => 'default',
@@ -682,7 +682,7 @@ public function testSubmitMultipleNonExpandedStringCastableIdentifier()
682682

683683
$this->persist(array($entity1, $entity2, $entity3));
684684

685-
$field = $this->factory->createNamed('name', 'entity', null, array(
685+
$field = $this->factory->createNamed('name', EntityType::class, null, array(
686686
'multiple' => true,
687687
'expanded' => false,
688688
'em' => 'default',
@@ -707,7 +707,7 @@ public function testSubmitMultipleStringCastableIdentifierExpanded()
707707

708708
$this->persist(array($entity1, $entity2, $entity3));
709709

710-
$field = $this->factory->createNamed('name', 'entity', null, array(
710+
$field = $this->factory->createNamed('name', EntityType::class, null, array(
711711
'multiple' => true,
712712
'expanded' => true,
713713
'em' => 'default',

‎src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.html.twig

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.html.twig
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<style>
2222
{{ include('@WebProfiler/Profiler/toolbar.css.twig', { 'position': position, 'floatable': true }) }}
2323
</style>
24-
<div id="sfToolbarClearer-{{ token }}" style="clear: both; height: 38px;"></div>
24+
<div id="sfToolbarClearer-{{ token }}" style="clear: both; height: 36px;"></div>
2525
{% endif %}
2626

2727
<div id="sfToolbarMainContent-{{ token }}" class="sf-toolbarreset clear-fix" data-no-turbolink>

‎src/Symfony/Component/Debug/Debug.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Debug/Debug.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class Debug
3131
* @param int $errorReportingLevel The level of error reporting you want
3232
* @param bool $displayErrors Whether to display errors (for development) or just log them (for production)
3333
*/
34-
public static function enable($errorReportingLevel = null, $displayErrors = true)
34+
public static function enable($errorReportingLevel = E_ALL, $displayErrors = true)
3535
{
3636
if (static::$enabled) {
3737
return;
@@ -42,7 +42,7 @@ public static function enable($errorReportingLevel = null, $displayErrors = true
4242
if (null !== $errorReportingLevel) {
4343
error_reporting($errorReportingLevel);
4444
} else {
45-
error_reporting(-1);
45+
error_reporting(E_ALL);
4646
}
4747

4848
if ('cli' !== php_sapi_name()) {

‎src/Symfony/Component/Debug/ErrorHandler.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Debug/ErrorHandler.php
+4-6Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,6 @@ public static function register(self $handler = null, $replace = true)
113113
register_shutdown_function(__CLASS__.'::handleFatalError');
114114
}
115115

116-
$levels = -1;
117-
118116
if ($handlerIsNew = null === $handler) {
119117
$handler = new static();
120118
}
@@ -131,7 +129,7 @@ public static function register(self $handler = null, $replace = true)
131129
restore_error_handler();
132130
}
133131

134-
$handler->throwAt($levels & $handler->thrownErrors, true);
132+
$handler->throwAt(E_ALL & $handler->thrownErrors, true);
135133

136134
return $handler;
137135
}
@@ -151,7 +149,7 @@ public function __construct(BufferingLogger $bootstrappingLogger = null)
151149
* @param array|int $levels An array map of E_* to LogLevel::* or an integer bit field of E_* constants
152150
* @param bool $replace Whether to replace or not any existing logger
153151
*/
154-
public function setDefaultLogger(LoggerInterface $logger, $levels = null, $replace = false)
152+
public function setDefaultLogger(LoggerInterface $logger, $levels = E_ALL, $replace = false)
155153
{
156154
$loggers = array();
157155

@@ -163,7 +161,7 @@ public function setDefaultLogger(LoggerInterface $logger, $levels = null, $repla
163161
}
164162
} else {
165163
if (null === $levels) {
166-
$levels = E_ALL | E_STRICT;
164+
$levels = E_ALL;
167165
}
168166
foreach ($this->loggers as $type => $log) {
169167
if (($type & $levels) && (empty($log[0]) || $replace || $log[0] === $this->bootstrappingLogger)) {
@@ -255,7 +253,7 @@ public function setExceptionHandler(callable $handler = null)
255253
public function throwAt($levels, $replace = false)
256254
{
257255
$prev = $this->thrownErrors;
258-
$this->thrownErrors = (E_ALL | E_STRICT) & ($levels | E_RECOVERABLE_ERROR | E_USER_ERROR) & ~E_USER_DEPRECATED & ~E_DEPRECATED;
256+
$this->thrownErrors = E_ALL & ($levels | E_RECOVERABLE_ERROR | E_USER_ERROR) & ~E_USER_DEPRECATED & ~E_DEPRECATED;
259257
if (!$replace) {
260258
$this->thrownErrors |= $prev;
261259
}

‎src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class DebugClassLoaderTest extends \PHPUnit_Framework_TestCase
2626

2727
protected function setUp()
2828
{
29-
$this->errorReporting = error_reporting(E_ALL | E_STRICT);
29+
$this->errorReporting = error_reporting(E_ALL);
3030
$this->loader = new ClassLoader();
3131
spl_autoload_register(array($this->loader, 'loadClass'), true, true);
3232
DebugClassLoader::enable();

‎src/Symfony/Component/Form/Extension/Core/Type/CollectionType.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Core/Type/CollectionType.php
+8-4Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,15 @@ class CollectionType extends AbstractType
2727
public function buildForm(FormBuilderInterface $builder, array $options)
2828
{
2929
if ($options['allow_add'] && $options['prototype']) {
30-
$prototype = $builder->create($options['prototype_name'], $options['entry_type'], array_replace(array(
30+
$prototypeOptions = array_replace(array(
3131
'label' => $options['prototype_name'].'label__',
32-
), $options['entry_options'], array(
33-
'data' => $options['prototype_data'],
34-
)));
32+
), $options['options']);
33+
34+
if (null !== $options['prototype_data']) {
35+
$prototypeOptions['data'] = $options['prototype_data'];
36+
}
37+
38+
$prototype = $builder->create($options['prototype_name'], $options['entry_type'], $prototypeOptions);
3539
$builder->setAttribute('prototype', $prototype->getForm());
3640
}
3741

‎src/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php
+16Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,4 +288,20 @@ public function testPrototypeData()
288288

289289
$this->assertSame('foo', $form->createView()->vars['prototype']->vars['value']);
290290
}
291+
292+
/**
293+
* @group legacy
294+
*/
295+
public function testLegacyPrototypeData()
296+
{
297+
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', array(), array(
298+
'allow_add' => true,
299+
'prototype' => true,
300+
'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
301+
'options' => array(
302+
'data' => 'bar',
303+
),
304+
));
305+
$this->assertSame('bar', $form->createView()->vars['prototype']->vars['value']);
306+
}
291307
}

‎src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ class DebugHandlersListener implements EventSubscriberInterface
4545
* @param bool $scream Enables/disables screaming mode, where even silenced errors are logged
4646
* @param string $fileLinkFormat The format for links to source files
4747
*/
48-
public function __construct(callable $exceptionHandler = null, LoggerInterface $logger = null, $levels = null, $throwAt = -1, $scream = true, $fileLinkFormat = null)
48+
public function __construct(callable $exceptionHandler = null, LoggerInterface $logger = null, $levels = E_ALL, $throwAt = E_ALL, $scream = true, $fileLinkFormat = null)
4949
{
5050
$this->exceptionHandler = $exceptionHandler;
5151
$this->logger = $logger;
52-
$this->levels = $levels;
53-
$this->throwAt = is_numeric($throwAt) ? (int) $throwAt : (null === $throwAt ? null : ($throwAt ? -1 : null));
52+
$this->levels = null === $levels ? E_ALL : $levels;
53+
$this->throwAt = is_numeric($throwAt) ? (int) $throwAt : (null === $throwAt ? null : ($throwAt ? E_ALL : null));
5454
$this->scream = (bool) $scream;
5555
$this->fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
5656
}
@@ -79,7 +79,7 @@ public function configure(Event $event = null)
7979
$scream |= $type;
8080
}
8181
} else {
82-
$scream = null === $this->levels ? E_ALL | E_STRICT : $this->levels;
82+
$scream = $this->levels;
8383
}
8484
if ($this->scream) {
8585
$handler->screamAt($scream);

‎src/Symfony/Component/Ldap/LdapClient.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Ldap/LdapClient.php
+14-1Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,20 @@ public function find($dn, $query, $filter = '*')
9999
*/
100100
public function escape($subject, $ignore = '', $flags = 0)
101101
{
102-
return ldap_escape($subject, $ignore, $flags);
102+
$value = ldap_escape($subject, $ignore, $flags);
103+
104+
// Per RFC 4514, leading/trailing spaces should be encoded in DNs, as well as carriage returns.
105+
if ((int) $flags & LDAP_ESCAPE_DN) {
106+
if (!empty($value) && $value[0] === ' ') {
107+
$value = '\\20'.substr($value, 1);
108+
}
109+
if (!empty($value) && $value[strlen($value) - 1] === ' ') {
110+
$value = substr($value, 0, -1).'\\20';
111+
}
112+
$value = str_replace("\r", '\0d', $value);
113+
}
114+
115+
return $value;
103116
}
104117

105118
private function connect()
+28Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
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\Ldap\Tests;
13+
14+
use Symfony\Component\Ldap\LdapClient;
15+
use Symfony\Polyfill\Php56\Php56 as p;
16+
17+
/**
18+
* @requires extension ldap
19+
*/
20+
class LdapClientTest extends \PHPUnit_Framework_TestCase
21+
{
22+
public function testLdapEscape()
23+
{
24+
$ldap = new LdapClient();
25+
26+
$this->assertEquals('\20foo\3dbar\0d(baz)*\20', $ldap->escape(" foo=bar\r(baz)* ", null, p::LDAP_ESCAPE_DN));
27+
}
28+
}

‎src/Symfony/Component/Validator/Constraints/BicValidator.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Constraints/BicValidator.php
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ public function validate($value, Constraint $constraint)
3838
->setParameter('{{ value }}', $this->formatValue($value))
3939
->setCode(Bic::INVALID_LENGTH_ERROR)
4040
->addViolation();
41+
42+
return;
4143
}
4244

4345
// must contain alphanumeric values only
@@ -46,6 +48,8 @@ public function validate($value, Constraint $constraint)
4648
->setParameter('{{ value }}', $this->formatValue($value))
4749
->setCode(Bic::INVALID_CHARACTERS_ERROR)
4850
->addViolation();
51+
52+
return;
4953
}
5054

5155
// first 4 letters must be alphabetic (bank code)
@@ -54,6 +58,8 @@ public function validate($value, Constraint $constraint)
5458
->setParameter('{{ value }}', $this->formatValue($value))
5559
->setCode(Bic::INVALID_BANK_CODE_ERROR)
5660
->addViolation();
61+
62+
return;
5763
}
5864

5965
// next 2 letters must be alphabetic (country code)
@@ -62,6 +68,8 @@ public function validate($value, Constraint $constraint)
6268
->setParameter('{{ value }}', $this->formatValue($value))
6369
->setCode(Bic::INVALID_COUNTRY_CODE_ERROR)
6470
->addViolation();
71+
72+
return;
6573
}
6674

6775
// should contain uppercase characters only
@@ -70,6 +78,8 @@ public function validate($value, Constraint $constraint)
7078
->setParameter('{{ value }}', $this->formatValue($value))
7179
->setCode(Bic::INVALID_CASE_ERROR)
7280
->addViolation();
81+
82+
return;
7383
}
7484
}
7585
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.