Skip to content

Commit 0468f74

Browse files
committed
Merge branch '2.8'
* 2.8: Fixed the wrong source name and the ja translation [Debug] fix readme: DebugClassLoader moved to debug itself [SecurityBundle] disable the init:acl command if ACL is not used [DI] remove useless condition around unset [Console] Fix bug with overloading [Form] Fixed wrong usages of the "text" type [Form] Disabled view data validation if "data_class" is set to null [HttpFoundation] Workaround HHVM rewriting HTTP response line
2 parents d258ee8 + 5de9c35 commit 0468f74

File tree

9 files changed

+37
-38
lines changed

9 files changed

+37
-38
lines changed

src/Symfony/Bundle/FrameworkBundle/Command/ServerStartCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ protected function configure()
7474
*/
7575
protected function execute(InputInterface $input, OutputInterface $output)
7676
{
77-
$output = new SymfonyStyle($input, $output);
77+
$output = new SymfonyStyle($input, $cliOutput = $output);
7878

7979
if (!extension_loaded('pcntl')) {
8080
$output->error(array(
@@ -85,7 +85,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
8585
if ($output->ask('Do you want to execute <info>server:run</info> immediately? [Yn] ', true)) {
8686
$command = $this->getApplication()->find('server:run');
8787

88-
return $command->run($input, $output);
88+
return $command->run($input, $cliOutput);
8989
}
9090

9191
return 1;

src/Symfony/Bundle/SecurityBundle/Command/InitAclCommand.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,18 @@
2323
*/
2424
class InitAclCommand extends ContainerAwareCommand
2525
{
26+
/**
27+
* {@inheritdoc}
28+
*/
29+
public function isEnabled()
30+
{
31+
if (!$this->getContainer()->has('security.acl.dbal.connection')) {
32+
return false;
33+
}
34+
35+
return parent::isEnabled();
36+
}
37+
2638
/**
2739
* {@inheritdoc}
2840
*/

src/Symfony/Component/Debug/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Debug::enable();
1515
You can also use the tools individually:
1616

1717
```php
18+
use Symfony\Component\Debug\DebugClassLoader;
1819
use Symfony\Component\Debug\ErrorHandler;
1920
use Symfony\Component\Debug\ExceptionHandler;
2021

@@ -25,11 +26,9 @@ if ('cli' !== php_sapi_name()) {
2526
ini_set('display_errors', 1);
2627
}
2728
ErrorHandler::register();
29+
DebugClassLoader::enable();
2830
```
2931

30-
Note that the `Debug::enable()` call also registers the debug class loader
31-
from the Symfony ClassLoader component when available.
32-
3332
This component can optionally take advantage of the features of the HttpKernel
3433
component.
3534

src/Symfony/Component/DependencyInjection/Definition.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -393,9 +393,7 @@ public function hasTag($name)
393393
*/
394394
public function clearTag($name)
395395
{
396-
if (isset($this->tags[$name])) {
397-
unset($this->tags[$name]);
398-
}
396+
unset($this->tags[$name]);
399397

400398
return $this;
401399
}

src/Symfony/Component/Form/Form.php

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -355,21 +355,11 @@ public function setData($modelData)
355355
if (!FormUtil::isEmpty($viewData)) {
356356
$dataClass = $this->config->getDataClass();
357357

358-
$actualType = is_object($viewData) ? 'an instance of class '.get_class($viewData) : 'a(n) '.gettype($viewData);
359-
360-
if (null === $dataClass && is_object($viewData) && !$viewData instanceof \ArrayAccess) {
361-
$expectedType = 'scalar, array or an instance of \ArrayAccess';
362-
363-
throw new LogicException(
364-
'The form\'s view data is expected to be of type '.$expectedType.', '.
365-
'but is '.$actualType.'. You '.
366-
'can avoid this error by setting the "data_class" option to '.
367-
'"'.get_class($viewData).'" or by adding a view transformer '.
368-
'that transforms '.$actualType.' to '.$expectedType.'.'
369-
);
370-
}
371-
372358
if (null !== $dataClass && !$viewData instanceof $dataClass) {
359+
$actualType = is_object($viewData)
360+
? 'an instance of class '.get_class($viewData)
361+
: 'a(n) '.gettype($viewData);
362+
373363
throw new LogicException(
374364
'The form\'s view data is expected to be an instance of class '.
375365
$dataClass.', but is '.$actualType.'. You can avoid this error '.
@@ -856,7 +846,7 @@ public function add($child, $type = null, array $options = array())
856846
$options['auto_initialize'] = false;
857847

858848
if (null === $type && null === $this->config->getDataClass()) {
859-
$type = 'text';
849+
$type = 'Symfony\Component\Form\Extension\Core\Type\TextType';
860850
}
861851

862852
if (null === $type) {

src/Symfony/Component/Form/Resources/translations/validators.ja.xlf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
<target>アップロードされたファイルが大きすぎます。小さなファイルで再度アップロードしてください。</target>
1212
</trans-unit>
1313
<trans-unit id="30">
14-
<source>The CSRF token is invalid.</source>
15-
<target>CSRFトークンが無効です。</target>
14+
<source>The CSRF token is invalid. Please try to resubmit the form.</source>
15+
<target>CSRFトークンが無効です、再送信してください。</target>
1616
</trans-unit>
1717
</body>
1818
</file>

src/Symfony/Component/Form/Tests/CompoundFormTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,13 @@ public function testAddUsingNameAndType()
172172

173173
$this->factory->expects($this->once())
174174
->method('createNamed')
175-
->with('foo', 'text', null, array(
175+
->with('foo', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, array(
176176
'bar' => 'baz',
177177
'auto_initialize' => false,
178178
))
179179
->will($this->returnValue($child));
180180

181-
$this->form->add('foo', 'text', array('bar' => 'baz'));
181+
$this->form->add('foo', 'Symfony\Component\Form\Extension\Core\Type\TextType', array('bar' => 'baz'));
182182

183183
$this->assertTrue($this->form->has('foo'));
184184
$this->assertSame($this->form, $child->getParent());
@@ -191,14 +191,14 @@ public function testAddUsingIntegerNameAndType()
191191

192192
$this->factory->expects($this->once())
193193
->method('createNamed')
194-
->with('0', 'text', null, array(
194+
->with('0', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, array(
195195
'bar' => 'baz',
196196
'auto_initialize' => false,
197197
))
198198
->will($this->returnValue($child));
199199

200200
// in order to make casting unnecessary
201-
$this->form->add(0, 'text', array('bar' => 'baz'));
201+
$this->form->add(0, 'Symfony\Component\Form\Extension\Core\Type\TextType', array('bar' => 'baz'));
202202

203203
$this->assertTrue($this->form->has(0));
204204
$this->assertSame($this->form, $child->getParent());
@@ -211,7 +211,7 @@ public function testAddWithoutType()
211211

212212
$this->factory->expects($this->once())
213213
->method('createNamed')
214-
->with('foo', 'text')
214+
->with('foo', 'Symfony\Component\Form\Extension\Core\Type\TextType')
215215
->will($this->returnValue($child));
216216

217217
$this->form->add('foo');

src/Symfony/Component/Form/Tests/SimpleFormTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -829,19 +829,19 @@ public function testGetPropertyPathDefaultsToIndexedNameIfDataClassOfFirstParent
829829
$this->assertEquals(new PropertyPath('[name]'), $form->getPropertyPath());
830830
}
831831

832-
/**
833-
* @expectedException \Symfony\Component\Form\Exception\LogicException
834-
*/
835-
public function testViewDataMustNotBeObjectIfDataClassIsNull()
832+
public function testViewDataMayBeObjectIfDataClassIsNull()
836833
{
834+
$object = new \stdClass();
837835
$config = new FormConfigBuilder('name', null, $this->dispatcher);
838836
$config->addViewTransformer(new FixedDataTransformer(array(
839837
'' => '',
840-
'foo' => new \stdClass(),
838+
'foo' => $object,
841839
)));
842840
$form = new Form($config);
843841

844842
$form->setData('foo');
843+
844+
$this->assertSame($object, $form->getViewData());
845845
}
846846

847847
public function testViewDataMayBeArrayAccessIfDataClassIsNull()

src/Symfony/Component/HttpFoundation/Response.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -329,16 +329,16 @@ public function sendHeaders()
329329
$this->setDate(\DateTime::createFromFormat('U', time()));
330330
}
331331

332-
// status
333-
header(sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText), true, $this->statusCode);
334-
335332
// headers
336333
foreach ($this->headers->allPreserveCase() as $name => $values) {
337334
foreach ($values as $value) {
338335
header($name.': '.$value, false, $this->statusCode);
339336
}
340337
}
341338

339+
// status
340+
header(sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText), true, $this->statusCode);
341+
342342
// cookies
343343
foreach ($this->headers->getCookies() as $cookie) {
344344
setcookie($cookie->getName(), $cookie->getValue(), $cookie->getExpiresTime(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly());

0 commit comments

Comments
 (0)