Closed (fixed)
Project:
Drupal core
Version:
5.4
Component:
poll.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
25 Oct 2007 at 20:39 UTC
Updated:
17 Dec 2007 at 22:53 UTC
We noticed that the "Need more choices" box wasn't working when creating a poll. After looking into it, it seemed that $form_values at line 129 of poll.module wasn't behaving as expected.
My current work-around is to change:
if (isset($form_values)) {
$choices = $form_values['choices'];
if ($form_values['morechoices']) {
$choices *= 2;
}
}
to:
if (isset($_POST['choices'])) {
$choices = $_POST['choices'];
if ($_POST['morechoices']) {
$choices *= 2;
}
}
-Nate
Comments
Comment #1
gábor hojtsyThis sounds quite interesting. The hook_form() for Drupal 5 docs are a bit vague on what might be passed on the second parameter, but node_form() calls hook_form() actually, and it does this:
So it passes on the form_values it got from Drupal.
I tested this with both freshly submitted polls, in preview before submission, after submission and in preview as well as after voting and preview, and cannot reproduce.
Comment #2
nschindler commentedYeah, I know... and the polls module is the only place I have this problem.
I recently upgraded to 5.4, so I reverted my work-around for this issue. It still misbehaved.
Here's the really weird part... I've had problems using mysqli vs. mysql before, so I switched to mysqli just to see if it had any effect. Nope. So I switched back to mysql, and now all of the sudden the original code (using $form_values) works.
I'm confused, but whatever. I think there's something quirky with my version of PHP.
Database interface - mysql
Database version - 5.0.26
PHP version - 5.1.2
Web Server - apache2-prefork-2.2.3
OS - SLES 10 SP1 2.6.16.53
Comment #3
gábor hojtsyMarking closed then.