Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
When we unite against a common enemy that attacks our ethos, it nurtures group solidarity. Trolls are sensational, yes, but we keep everyone honest. | Game Memorial

emanuele

  • Posts: 125
Re: SMF bug 4954 (poll options can get mixed up when > 127 options)
« Reply #1, on March 2nd, 2012, 01:44 PM »
The (real) problem is in the logic of the javascript: the script counts how many items are there and it continues the numbering from there, so if you let's add 5 options you have ids from 0 to 4, then you edit the poll and remove two options in the middle (2 and 3 let's say)  and save the ids on the next page load will be 0, 3, 4, but when you add a new option with the javascript it add the new input with id equal to 3, that way you have 2 input box with id 3 and of course the second will be the one used by php.

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: SMF bug 4954 (poll options can get mixed up when > 127 options)
« Reply #2, on March 2nd, 2012, 01:49 PM »
Ah, that makes perfect sense, thanks :)

I note the commit note mentions fixing it for > 255, is the column a smallint in SMF 2.1, or is a suitable error thrown at the user? (A poll with 255 options, or lots and lots of editing, is probably going to be messy and probably should be recreated from scratch.)

emanuele

  • Posts: 125
Re: SMF bug 4954 (poll options can get mixed up when > 127 options)
« Reply #3, on March 2nd, 2012, 02:06 PM »
For the 255 options I simply added a $poll/post_errors even though is not 100% reliable because this count is based on the number of options ($optionCount), but since the id_poll is not based on that count (because in case an option is deleted the id is not decreased) it could still throw errors...I think I'll see if there is another option.

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: SMF bug 4954 (poll options can get mixed up when > 127 options)
« Reply #4, on March 2nd, 2012, 02:11 PM »
Well, you have another method that you can use - examine $_POST['options'] when it comes in. Pull the array_keys and iterate over them, looking for any values > 255, which can be relied upon to be accurate, as it were.

Nao

  • Dadman with a boy
  • Posts: 16,079
Re: SMF bug 4954 (poll options can get mixed up when > 127 options)
« Reply #5, on March 2nd, 2012, 03:10 PM »
emanuele, aren't you one of the current SMF developers? ;)
(It would seem that they're all lurking here, I reckon... Possibly even more now with all of the SMF bug topics :P)

Re: poll options, I never bothered much about them, but I'd just like to point out that whenever I edit some options (e.g. remove one and replace another), the result will usually be mixed up. Not the number of votes for each item, but the order in which they're shown.

emanuele

  • Posts: 125

Nao

  • Dadman with a boy
  • Posts: 16,079
Re: SMF bug 4954 (poll options can get mixed up when > 127 options)
« Reply #7, on March 2nd, 2012, 04:41 PM »
Don't forget to follow our changelogs, we often report SMF bugs there too. (When we're merciful, we specify 'SMF bug' so that SMF devs can easily find them in the logs :P)

I'm definitely curious to know where the SMF dev team currently stands with regards to Wedge, though :)

emanuele

  • Posts: 125
Re: SMF bug 4954 (poll options can get mixed up when > 127 options)
« Reply #8, on March 2nd, 2012, 05:52 PM »
Quote from Nao on March 2nd, 2012, 04:41 PM
Don't forget to follow our changelogs, we often report SMF bugs there too. (When we're merciful, we specify 'SMF bug' so that SMF devs can easily find them in the logs :P)
One of my best skills is datamining. :P
Quote from Nao on March 2nd, 2012, 04:41 PM
I'm definitely curious to know where the SMF dev team currently stands with regards to Wedge, though :)
Don't know: I'm not the SMF dev team, just a member of the team. ;)

Personally I'm plain curios (as always I am) to see the final result! :D

And if the question is another: well, I'm too young (in SMF years) to know the full story and I don't like to rely on others' reports and opinions in this kind of matters. ;) So let's say I feel neutral.

Nao

  • Dadman with a boy
  • Posts: 16,079
Re: SMF bug 4954 (poll options can get mixed up when > 127 options)
« Reply #9, on March 2nd, 2012, 05:59 PM »
Oh, it's safe to say that since most of those we thought undermined SMF's community (most notably vblamer) left to other failures, we're fine with the SMF management these days. It's been quite some time since I've been in a flame war with SMF really... Over a year I'd say?

godboko71

  • Fence accomplished!
  • Hello
  • Posts: 361
Thank you,
Boko

Nao

  • Dadman with a boy
  • Posts: 16,079

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278

Nao

  • Dadman with a boy
  • Posts: 16,079

emanuele

  • Posts: 125