Skip to content

[Form] Date field missing from submitted form data when value supplied #28584

@zanbaldwin

Description

@zanbaldwin

Symfony version(s) affected: 4.1.2.3 (that's the only version I've checked so far).

Description

A date field is missing from the submitted form data when a value is supplied. This behaviour doesn't happen for form types such as TextType.

How to reproduce

See zanbaldwin/symfony-issue-28584:master

  1. Create new project from symfony/skeleton:v4.1.2.3.
  2. composer req form
  3. Create JSON payload listener.
  4. Create form type with date field.
  5. Create controller (and route definition).
  6. Start local PHP webserver (php -S 127.0.0.1:8000 -t public)
  7. Send test payloads (I used HTTPie via the command: echo '$DATA' | http --json --print b POST ":8000")

Example Payloads

Request Data ($DATA) Response Data
{"my_date":null} array(1) { ["my_date"]=> NULL }
{"my_date":""} array(0) { }
{"my_date":"2018-01-01"} array(0) { }

Possible Solution

Haven't really dug into this yet, I'll update with anything I find.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions