Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.5] Validation of array on request returns bad array #20973

Closed
mbaeuerle opened this issue Sep 4, 2017 · 1 comment
Closed

[5.5] Validation of array on request returns bad array #20973

mbaeuerle opened this issue Sep 4, 2017 · 1 comment

Comments

@mbaeuerle
Copy link

  • Laravel Version: 5.5.1
  • PHP Version: 7.1.8
  • Database Driver & Version: -

Description:

When trying to validate an array through $params = $request->validate([]) the returning $params contains the key * which was not specified.

Steps To Reproduce:

  • Create a route:
Route::post('/test', function (Request $request) {
    $data = $request->validate([
        'test' => 'required|array',
        'test.*.a' => 'required|integer',
    ]);

    dump($data);
    return new \Symfony\Component\HttpFoundation\Response();
});
  • Call it with:
{
  "test": [{
    "a": 123
  }]
}
  • Dump shows:
array:1 [
  "test" => array:2 [
    0 => array:1 [
      "a" => 123
    ]
    "*" => array:1 [
      "a" => array:1 [
        0 => 123
      ]
    ]
  ]
]
@themsaid
Copy link
Member

themsaid commented Sep 4, 2017

Handled in #20974

@themsaid themsaid closed this as completed Sep 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants