Skip to content

Navigation Menu

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

[Form][Bug] Using radio elements results in an error when binding the request to the form. #2547

Copy link
Copy link
Closed
@Spea

Description

@Spea
Issue body actions

When adding radio elements to the form and the requets is being bind to the form, the following error appears:

_Warning: array_replace_recursive(): Argument #1 is not an array in /.../vendor/symfony/src/Symfony/Component/Form/Form.php line 583_

Here is an example code:

<?php 
namespace My\Bundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;

class TestController extends Controller
{
    public function testAction(Request $request)
    {
        $form = $this->createFormBuilder()
                ->add('test', 'text')
                ->add('test2', 'radio')
                ->add('test3', 'radio')
                ->getForm();

        if ($request->getMethod() == 'POST') {
            $form->bindRequest($request);
        }

        return $this->render('MyBundle:Test:form.html.twig', array(
            'form' => $form->createView(),
        ));
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

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