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
This commit is contained in:
commit
0468f745d8
@ -74,7 +74,7 @@ EOF
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$output = new SymfonyStyle($input, $output);
|
||||
$output = new SymfonyStyle($input, $cliOutput = $output);
|
||||
|
||||
if (!extension_loaded('pcntl')) {
|
||||
$output->error(array(
|
||||
@ -85,7 +85,7 @@ EOF
|
||||
if ($output->ask('Do you want to execute <info>server:run</info> immediately? [Yn] ', true)) {
|
||||
$command = $this->getApplication()->find('server:run');
|
||||
|
||||
return $command->run($input, $output);
|
||||
return $command->run($input, $cliOutput);
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -23,6 +23,18 @@ use Doctrine\DBAL\Schema\SchemaException;
|
||||
*/
|
||||
class InitAclCommand extends ContainerAwareCommand
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isEnabled()
|
||||
{
|
||||
if (!$this->getContainer()->has('security.acl.dbal.connection')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return parent::isEnabled();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@ -15,6 +15,7 @@ Debug::enable();
|
||||
You can also use the tools individually:
|
||||
|
||||
```php
|
||||
use Symfony\Component\Debug\DebugClassLoader;
|
||||
use Symfony\Component\Debug\ErrorHandler;
|
||||
use Symfony\Component\Debug\ExceptionHandler;
|
||||
|
||||
@ -25,11 +26,9 @@ if ('cli' !== php_sapi_name()) {
|
||||
ini_set('display_errors', 1);
|
||||
}
|
||||
ErrorHandler::register();
|
||||
DebugClassLoader::enable();
|
||||
```
|
||||
|
||||
Note that the `Debug::enable()` call also registers the debug class loader
|
||||
from the Symfony ClassLoader component when available.
|
||||
|
||||
This component can optionally take advantage of the features of the HttpKernel
|
||||
component.
|
||||
|
||||
|
@ -393,9 +393,7 @@ class Definition
|
||||
*/
|
||||
public function clearTag($name)
|
||||
{
|
||||
if (isset($this->tags[$name])) {
|
||||
unset($this->tags[$name]);
|
||||
}
|
||||
unset($this->tags[$name]);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@ -355,21 +355,11 @@ class Form implements \IteratorAggregate, FormInterface
|
||||
if (!FormUtil::isEmpty($viewData)) {
|
||||
$dataClass = $this->config->getDataClass();
|
||||
|
||||
$actualType = is_object($viewData) ? 'an instance of class '.get_class($viewData) : 'a(n) '.gettype($viewData);
|
||||
|
||||
if (null === $dataClass && is_object($viewData) && !$viewData instanceof \ArrayAccess) {
|
||||
$expectedType = 'scalar, array or an instance of \ArrayAccess';
|
||||
|
||||
throw new LogicException(
|
||||
'The form\'s view data is expected to be of type '.$expectedType.', '.
|
||||
'but is '.$actualType.'. You '.
|
||||
'can avoid this error by setting the "data_class" option to '.
|
||||
'"'.get_class($viewData).'" or by adding a view transformer '.
|
||||
'that transforms '.$actualType.' to '.$expectedType.'.'
|
||||
);
|
||||
}
|
||||
|
||||
if (null !== $dataClass && !$viewData instanceof $dataClass) {
|
||||
$actualType = is_object($viewData)
|
||||
? 'an instance of class '.get_class($viewData)
|
||||
: 'a(n) '.gettype($viewData);
|
||||
|
||||
throw new LogicException(
|
||||
'The form\'s view data is expected to be an instance of class '.
|
||||
$dataClass.', but is '.$actualType.'. You can avoid this error '.
|
||||
@ -856,7 +846,7 @@ class Form implements \IteratorAggregate, FormInterface
|
||||
$options['auto_initialize'] = false;
|
||||
|
||||
if (null === $type && null === $this->config->getDataClass()) {
|
||||
$type = 'text';
|
||||
$type = 'Symfony\Component\Form\Extension\Core\Type\TextType';
|
||||
}
|
||||
|
||||
if (null === $type) {
|
||||
|
@ -11,8 +11,8 @@
|
||||
<target>アップロードされたファイルが大きすぎます。小さなファイルで再度アップロードしてください。</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="30">
|
||||
<source>The CSRF token is invalid.</source>
|
||||
<target>CSRFトークンが無効です。</target>
|
||||
<source>The CSRF token is invalid. Please try to resubmit the form.</source>
|
||||
<target>CSRFトークンが無効です、再送信してください。</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
|
@ -172,13 +172,13 @@ class CompoundFormTest extends AbstractFormTest
|
||||
|
||||
$this->factory->expects($this->once())
|
||||
->method('createNamed')
|
||||
->with('foo', 'text', null, array(
|
||||
->with('foo', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, array(
|
||||
'bar' => 'baz',
|
||||
'auto_initialize' => false,
|
||||
))
|
||||
->will($this->returnValue($child));
|
||||
|
||||
$this->form->add('foo', 'text', array('bar' => 'baz'));
|
||||
$this->form->add('foo', 'Symfony\Component\Form\Extension\Core\Type\TextType', array('bar' => 'baz'));
|
||||
|
||||
$this->assertTrue($this->form->has('foo'));
|
||||
$this->assertSame($this->form, $child->getParent());
|
||||
@ -191,14 +191,14 @@ class CompoundFormTest extends AbstractFormTest
|
||||
|
||||
$this->factory->expects($this->once())
|
||||
->method('createNamed')
|
||||
->with('0', 'text', null, array(
|
||||
->with('0', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, array(
|
||||
'bar' => 'baz',
|
||||
'auto_initialize' => false,
|
||||
))
|
||||
->will($this->returnValue($child));
|
||||
|
||||
// in order to make casting unnecessary
|
||||
$this->form->add(0, 'text', array('bar' => 'baz'));
|
||||
$this->form->add(0, 'Symfony\Component\Form\Extension\Core\Type\TextType', array('bar' => 'baz'));
|
||||
|
||||
$this->assertTrue($this->form->has(0));
|
||||
$this->assertSame($this->form, $child->getParent());
|
||||
@ -211,7 +211,7 @@ class CompoundFormTest extends AbstractFormTest
|
||||
|
||||
$this->factory->expects($this->once())
|
||||
->method('createNamed')
|
||||
->with('foo', 'text')
|
||||
->with('foo', 'Symfony\Component\Form\Extension\Core\Type\TextType')
|
||||
->will($this->returnValue($child));
|
||||
|
||||
$this->form->add('foo');
|
||||
|
@ -829,19 +829,19 @@ class SimpleFormTest extends AbstractFormTest
|
||||
$this->assertEquals(new PropertyPath('[name]'), $form->getPropertyPath());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Form\Exception\LogicException
|
||||
*/
|
||||
public function testViewDataMustNotBeObjectIfDataClassIsNull()
|
||||
public function testViewDataMayBeObjectIfDataClassIsNull()
|
||||
{
|
||||
$object = new \stdClass();
|
||||
$config = new FormConfigBuilder('name', null, $this->dispatcher);
|
||||
$config->addViewTransformer(new FixedDataTransformer(array(
|
||||
'' => '',
|
||||
'foo' => new \stdClass(),
|
||||
'foo' => $object,
|
||||
)));
|
||||
$form = new Form($config);
|
||||
|
||||
$form->setData('foo');
|
||||
|
||||
$this->assertSame($object, $form->getViewData());
|
||||
}
|
||||
|
||||
public function testViewDataMayBeArrayAccessIfDataClassIsNull()
|
||||
|
@ -329,9 +329,6 @@ class Response
|
||||
$this->setDate(\DateTime::createFromFormat('U', time()));
|
||||
}
|
||||
|
||||
// status
|
||||
header(sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText), true, $this->statusCode);
|
||||
|
||||
// headers
|
||||
foreach ($this->headers->allPreserveCase() as $name => $values) {
|
||||
foreach ($values as $value) {
|
||||
@ -339,6 +336,9 @@ class Response
|
||||
}
|
||||
}
|
||||
|
||||
// status
|
||||
header(sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText), true, $this->statusCode);
|
||||
|
||||
// cookies
|
||||
foreach ($this->headers->getCookies() as $cookie) {
|
||||
setcookie($cookie->getName(), $cookie->getValue(), $cookie->getExpiresTime(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly());
|
||||
|
Reference in New Issue
Block a user