Closed powerman closed 6 years ago
This test panics (even if one of "A" or "A[1]" lines will be removed):
"A"
"A[1]"
func TestDecodeArrayBug(t *testing.T) { var data struct { A [2]string } form.NewDecoder().Decode(&data, url.Values{ "A": {"10"}, "A[1]": {"20"}, }) }
--- FAIL: TestDecodeArrayBug (0.00s) panic: reflect: call of reflect.Value.IsNil on array Value [recovered] panic: reflect: call of reflect.Value.IsNil on array Value goroutine 27 [running]: testing.tRunner.func1(0xc4201b6870) /usr/lib/go/src/testing/testing.go:742 +0x29d panic(0x5b6fa0, 0xc4201c21a0) /usr/lib/go/src/runtime/panic.go:502 +0x229 reflect.Value.IsNil(0x5ae180, 0xc4201c2100, 0x191, 0x1) /usr/lib/go/src/reflect/value.go:1018 +0x11d github.com/go-playground/form.(*decoder).setFieldByType(0xc4200aed70, 0x5ae180, 0xc4201c2100, 0x191, 0xc4200f2940, 0x1, 0x40, 0x0, 0x4) /home/powerman/gocode/src/github.com/go-playground/form/decoder.go:438 +0x187 github.com/go-playground/form.(*decoder).traverseStruct(0xc4200aed70, 0x5bd840, 0xc4201c2100, 0x199, 0x61b700, 0x5bd840, 0xc4200f2940, 0x0, 0x40, 0xc42004af50) /home/powerman/gocode/src/github.com/go-playground/form/decoder.go:172 +0x1b2 github.com/go-playground/form.(*Decoder).Decode(0xc4200b1a00, 0x5a3f60, 0xc4201c2100, 0xc4201be660, 0xc4201b8620, 0x5ac6cab6) /home/powerman/gocode/src/github.com/go-playground/form/form_decoder.go:161 +0x296
This test panics (even if one of
"A"
or"A[1]"
lines will be removed):