Welcome Guest, Not a member yet? Register   Sign In
Validate is changing the integer keys of my post data
#1
Question 

I don't really know how to explain this well, but basically:
Original post data:
PHP Code:
[
  "17" => "a",
  "18" => "b",
  "normal" => "c",


After validating (retrieved using validator->getValidated())

PHP Code:
[
  "0" => "a",
  "1" => "b",
  "normal" => "c",


As you can see, string keys are fine even after validation, but integer keys gets changed.
Why does it do this, and how do I preserve my original keys? (Right now, I'm just adding a prefix "_" to every keys, but I wonder if there's a better way)
Reply
#2

This bug?
https://github.com/codeigniter4/CodeIgniter4/pull/8425
Reply
#3

(01-22-2024, 10:08 PM)kenjis Wrote: This bug?
https://github.com/codeigniter4/CodeIgniter4/pull/8425

Oh wow, that's exactly it. So it was a bug after all.
I tried using the command "composer update", but it didn't do anything, so I assume I'm going to have to change it myself and wait for an update.
Thanks for the help though!
Reply
#4

Yes, the bug fix will be included in v4.4.5.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB