You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is actually a problem with Laravel itself, as Laravel retrieves query parameters like this:
$test = $_GET['test'];
While $_GET looks something like that:
Array
(
[test] => Array
(
0 => foobar
)
)
The reason for the index 0 being added is quite simple:
PHP only works with arrays that have keys. If no keys are found, PHP will automatically add them, starting from 0.
For example, if you pass the query parameters: ?test[0]=foo&test[]=bar,
it will redirect back as: ?test[0]=foo&test[1]=bar.
This won't be solved by Inertia as it's just a PHP convention.
Maybe you can let me know what you're trying to achieve, and we can find another way or a workaround.
Version:
@inertiajs/vue3
version: 2.0.3Describe the problem:
Inertia replaces array query params with number keys: it redirects from
http://localhost:8000/?test[]=foobar
tohttp://localhost:8000/?test[0]=foobar
Steps to reproduce:
Visit http://localhost:8000/?test[]=foobar.
Inertia redirects to
http://localhost:8000/?test[0]=foobar
The text was updated successfully, but these errors were encountered: