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

isset should return error on integer slices when passed a string value #3681

Closed
bwbecker opened this Issue Jul 7, 2017 · 6 comments

Comments

Projects
None yet
3 participants
@bwbecker

bwbecker commented Jul 7, 2017

Just updated hugo from 0.19 to 0.25 via "brew upgrade hugo". Ran hugo and got

Started building sites ...
WARNING: calling IsSet with unsupported type "invalid" (<nil>) will always return false.

panic: reflect: call of reflect.Value.Int on string Value [recovered]
	panic: reflect: call of reflect.Value.Int on string Value [recovered]
	panic: reflect: call of reflect.Value.Int on string Value [recovered]
	panic: reflect: call of reflect.Value.Int on string Value

goroutine 133 [running]:
text/template.errRecover(0xc4205cb830)
	/usr/local/Cellar/go/1.8.3/libexec/src/text/template/exec.go:146 +0x62
panic(0x1710e80, 0xc4203649a0)
	/usr/local/Cellar/go/1.8.3/libexec/src/runtime/panic.go:489 +0x2cf
text/template.errRecover(0xc4205cab38)
	/usr/local/Cellar/go/1.8.3/libexec/src/text/template/exec.go:146 +0x62
panic(0x1710e80, 0xc4203649a0)
	/usr/local/Cellar/go/1.8.3/libexec/src/runtime/panic.go:489 +0x2cf

etc.

Uninstalled hugo (brew uninstall --force hugo), reinstalled, with the same result.

MacBook Pro running MacOS 10.12.5.

@bep

This comment has been minimized.

Member

bep commented Jul 7, 2017

I need more info to guess what this is. Do you have the site source online for people to look at?

@bwbecker

This comment has been minimized.

bwbecker commented Jul 7, 2017

@bep

This comment has been minimized.

Member

bep commented Jul 7, 2017

@bwbecker that repository does not build out-of-the box. Probably a missing theme.

@bep bep changed the title from Panic attacks on MacOS to call of reflect.Value.Int on string Value Jul 7, 2017

@bwbecker

This comment has been minimized.

bwbecker commented Jul 7, 2017

Sorry; added the theme and pushed. Pulled to a fresh directory. Builds with Hugo v0.19 but gives the panic with Hugo v0.20.

@bep

This comment has been minimized.

Member

bep commented Jul 7, 2017

@moorereason this test panics for IsSet:

{[]interface{}{1, 2, 3, 5}, "2", false, false, ""},

@bwbecker the panic is unfortunate, and we will fix that, but the .Site.Sections was deprecated in Hugo 0.23 and is now replaced with a slice of Pages, so the isset constructs in your theme does not work anymore. Please take any further questions on https://discourse.gohugo.io/

@bep bep changed the title from call of reflect.Value.Int on string Value to isset should return error on integer slices when passed a string value Jul 7, 2017

@bep bep added Enhancement and removed NeedsUserFeedback labels Jul 7, 2017

@bep bep added this to the v0.26 milestone Jul 7, 2017

@bwbecker

This comment has been minimized.

bwbecker commented Jul 7, 2017

@bep bep modified the milestones: v0.39, v0.40 Apr 9, 2018

@bep bep modified the milestones: v0.40, v0.41 Apr 20, 2018

@bep bep modified the milestones: v0.41, v0.42 May 4, 2018

@bep bep modified the milestones: v0.42, v0.43 Jun 5, 2018

@bep bep modified the milestones: v0.43, v0.44 Jun 30, 2018

@bep bep modified the milestones: v0.44, v0.45, v0.46 Jul 10, 2018

@bep bep modified the milestones: v0.46, v0.47, v0.48 Aug 3, 2018

@bep bep modified the milestones: v0.48, v0.49 Aug 22, 2018

@bep bep modified the milestones: v0.49, v0.50 Sep 13, 2018

@moorereason moorereason self-assigned this Oct 3, 2018

moorereason added a commit to moorereason/hugo that referenced this issue Oct 3, 2018

tpl: Cast IsSet key to int for indexed types
Don't assume that the user sends an int as the key when checking against
indexed types.

Fixes gohugoio#3681

@moorereason moorereason added Bug and removed Enhancement labels Oct 3, 2018

@bep bep closed this in #5278 Oct 3, 2018

bep added a commit that referenced this issue Oct 3, 2018

tpl: Cast IsSet key to int for indexed types
Don't assume that the user sends an int as the key when checking against
indexed types.

Fixes #3681
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment