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

Skip to content

Commit 5de9c35

Browse files
committed
Merge branch '2.7' into 2.8
* 2.7: 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 [Form] Disabled view data validation if "data_class" is set to null [HttpFoundation] Workaround HHVM rewriting HTTP response line
2 parents 402d474 + d65b924 commit 5de9c35

File tree

8 files changed

+30
-34
lines changed

8 files changed

+30
-34
lines changed

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
and HttpFoundation components.
3534

src/Symfony/Component/DependencyInjection/Container.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -312,10 +312,7 @@ public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE
312312
$service = $this->$method();
313313
} catch (\Exception $e) {
314314
unset($this->loading[$id]);
315-
316-
if (array_key_exists($id, $this->services)) {
317-
unset($this->services[$id]);
318-
}
315+
unset($this->services[$id]);
319316

320317
if ($e instanceof InactiveScopeException && self::EXCEPTION_ON_INVALID_REFERENCE !== $invalidBehavior) {
321318
return;

src/Symfony/Component/DependencyInjection/Definition.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -501,9 +501,7 @@ public function hasTag($name)
501501
*/
502502
public function clearTag($name)
503503
{
504-
if (isset($this->tags[$name])) {
505-
unset($this->tags[$name]);
506-
}
504+
unset($this->tags[$name]);
507505

508506
return $this;
509507
}

src/Symfony/Component/Form/Form.php

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

359-
$actualType = is_object($viewData) ? 'an instance of class '.get_class($viewData) : 'a(n) '.gettype($viewData);
360-
361-
if (null === $dataClass && is_object($viewData) && !$viewData instanceof \ArrayAccess) {
362-
$expectedType = 'scalar, array or an instance of \ArrayAccess';
363-
364-
throw new LogicException(
365-
'The form\'s view data is expected to be of type '.$expectedType.', '.
366-
'but is '.$actualType.'. You '.
367-
'can avoid this error by setting the "data_class" option to '.
368-
'"'.get_class($viewData).'" or by adding a view transformer '.
369-
'that transforms '.$actualType.' to '.$expectedType.'.'
370-
);
371-
}
372-
373359
if (null !== $dataClass && !$viewData instanceof $dataClass) {
360+
$actualType = is_object($viewData)
361+
? 'an instance of class '.get_class($viewData)
362+
: 'a(n) '.gettype($viewData);
363+
374364
throw new LogicException(
375365
'The form\'s view data is expected to be an instance of class '.
376366
$dataClass.', but is '.$actualType.'. You can avoid this error '.

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/SimpleFormTest.php

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

843-
/**
844-
* @expectedException \Symfony\Component\Form\Exception\LogicException
845-
*/
846-
public function testViewDataMustNotBeObjectIfDataClassIsNull()
843+
public function testViewDataMayBeObjectIfDataClassIsNull()
847844
{
845+
$object = new \stdClass();
848846
$config = new FormConfigBuilder('name', null, $this->dispatcher);
849847
$config->addViewTransformer(new FixedDataTransformer(array(
850848
'' => '',
851-
'foo' => new \stdClass(),
849+
'foo' => $object,
852850
)));
853851
$form = new Form($config);
854852

855853
$form->setData('foo');
854+
855+
$this->assertSame($object, $form->getViewData());
856856
}
857857

858858
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)