Closed (outdated)
Project:
Drupal core
Version:
7.x-dev
Component:
poll.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
13 Oct 2010 at 00:17 UTC
Updated:
20 Mar 2020 at 16:52 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
furamag commentedI'm able to reproduce this bug. It looks like you added 'No' to 'Vote count' field and validation doesn't work for this field in some reason.
Comment #2
furamag commentedThere is bug in function poll_insert in poll.module. We are using following code (line 537):
To fix bug we should use updated code:
Comment #3
Wolfflow commentedThanks @furamag for feedback, going to apply code.
Comment #4
amateescu commentedComment #5
amateescu commentedThe solution here is to fix the validation, not the database insert.
Attached patch cleans up this mess and applies cleanly to D7 and D8. I promise to follow up with tests in #295993: TestingParty08: Poll form validation :)
Comment #6
amateescu commentedRe-rolled to take http://drupal.org/node/1274212#comment-4973492 into account.
Comment #7
amateescu commentedThe string changes were not accepted for D7, so here's another patch that keeps the string and reuses one from number.module.
Again, I'd recommend to postpone this until #1274212: Incorrect order of choices in Poll module. is fixed.
Comment #9
marcingy commentedCan't we just use element_validate_integer_positive as an element validator?
Comment #10
marcingy commentedComment #11
marcingy commentedThis really also needs tests.
Comment #13
amateescu commented@marcingy: good idea, but element_validate_integer instead of element_validate_integer_positive because the vote count can be 0.
Comment #14
amateescu commentedI asked @chx in IRC to validate the test-only patch, and the only 'complaint' was that we don't need to logout the admin user because login does it for us.
So, new patches for review (It's sad that I can't stop the testbot from reviewing the previous ones..), and if everythings checks out, I'm going to RTBC based on the idea from #9 and the validated tests :)
Comment #15
amateescu commentedRTBC it is then.
Comment #16
catchThanks. Committed/pushed to 8.x. Moving to 7.x for backport.
Comment #17
amateescu commented7.x patch.
Comment #18
webchickCommitted and pushed to 7.x. Thanks for the fix, and the test!
Comment #21
George Bills commentedShouldn't the code also include #required => true?
Otherwise saving a poll node form with no values in the "count" fields gives "PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'chvotes'".
Comment #22
secretsayan commentedOk! Right!
So just added '#required => True' in line 412
Comment #23
mgiffordWe still need to D7 patch to review so changing the status.