Advertisement:

Author Topic: Error with time zones RC4  (Read 721 times)

Offline Bigguy

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 13,094
  • Gender: Male
  • Be nice, or else....
    • smfbigguy on GitHub
    • What's Ur Beef
Error with time zones RC4
« on: July 14, 2021, 02:04:51 PM »
I was playin around with RC4 and tried to put countries in the time zone field. I tried "GB, USA" and "GB USA" (No quotes). It gave me errors and a token verification failure. Please see screenshot.

Offline lesmond

  • Jr. Member
  • **
  • Posts: 104
  • Gender: Male
    • Buildz Hosting
Re: Error with time zones RC4
« Reply #1 on: July 14, 2021, 02:36:14 PM »
I can confirm this, on a fresh install of SMF RC4, the error appears when visiting the profile and  'Features and Options > General'



Free Forum Image Hosting


The only person who got all his work done by Friday was Robinson Crusoe

Online Sesquipedalian

  • The Mad Doctor
  • Lead Developer
  • Sophist Member
  • *
  • Posts: 1,225
  • Gender: Male
  • It works! ... in theory.
    • Sesquipedalian on GitHub
Re: Error with time zones RC4
« Reply #2 on: July 14, 2021, 02:59:32 PM »
This is being tracked at https://github.com/SimpleMachines/SMF2.1/issues/6844.

The problem is that "USA" is not a valid two character ISO country code, and SMF currently doesn't check whether the country codes supplied by the admin are valid before it tries to feed them to the timezone_identifiers_list() function. This will be addressed by adding some validation checks on the country codes.

In the meantime, you can avoid this on your forum by using valid two character ISO country codes. The help text for the "Show time zones from these countries first" setting includes a link that will help you look up the correct country codes for the countries you are interested in.
I promise you nothing.

Sesqu... Sesqui... what?
Sesquipedalian, the best word in the English language.

Online Sesquipedalian

  • The Mad Doctor
  • Lead Developer
  • Sophist Member
  • *
  • Posts: 1,225
  • Gender: Male
  • It works! ... in theory.
    • Sesquipedalian on GitHub
Re: Error with time zones RC4
« Reply #3 on: July 14, 2021, 03:38:51 PM »
I promise you nothing.

Sesqu... Sesqui... what?
Sesquipedalian, the best word in the English language.

Offline lesmond

  • Jr. Member
  • **
  • Posts: 104
  • Gender: Male
    • Buildz Hosting
Re: Error with time zones RC4
« Reply #4 on: July 14, 2021, 04:05:19 PM »
Thanks @Sesquipedalian


Free Forum Image Hosting


The only person who got all his work done by Friday was Robinson Crusoe

Online Sesquipedalian

  • The Mad Doctor
  • Lead Developer
  • Sophist Member
  • *
  • Posts: 1,225
  • Gender: Male
  • It works! ... in theory.
    • Sesquipedalian on GitHub
Re: Error with time zones RC4
« Reply #5 on: July 14, 2021, 04:11:30 PM »
No problem. :)
I promise you nothing.

Sesqu... Sesqui... what?
Sesquipedalian, the best word in the English language.

Offline Bigguy

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 13,094
  • Gender: Male
  • Be nice, or else....
    • smfbigguy on GitHub
    • What's Ur Beef
Re: Error with time zones RC4
« Reply #6 on: July 14, 2021, 05:59:27 PM »
Glad to hear it's bein looked at.

Offline live627

  • Developer
  • SMF Hero
  • *
  • Posts: 5,991
  • Gender: Male
    • live627 on Facebook
    • live627 on GitHub
    • live627 on LinkedIn
    • @live627 on Twitter
    • livemods
Re: Error with time zones RC4
« Reply #7 on: July 15, 2021, 06:14:43 AM »
Shouldn't the error details be left-aligned?

Offline Bigguy

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 13,094
  • Gender: Male
  • Be nice, or else....
    • smfbigguy on GitHub
    • What's Ur Beef
Re: Error with time zones RC4
« Reply #8 on: July 15, 2021, 02:55:44 PM »
I know there is a fix being implemented on GH for this but I think it is still bugged. This is a partial quote from one of my members:

Quote
you can't  take the first 2 letters of a 3 letter code. Some countries 2 and 3 letter codes change.
E.G Bangladesh's 2 letter is BD its 3 letter is BGD if you substitute BGD to BG that is Bulgaria.

Is this not going to cause a few bugs ??? He also suggests maybe trying to match up the first and third letter in a three letter country code as that may be more successful. I posted this on GH as well but though I might as well add it here to. I guess I should add that this is using the new code for the fix on GH.

Offline Aleksi "Lex" Kilpinen

  • A Peculiar Finn
  • Project Manager
  • SMF Super Hero
  • *
  • Posts: 20,364
  • Gender: Male
  • Don't worry, I'm n00b friendly
    • Aleksi.Kilpinen on Facebook
    • LexArma on GitHub
    • aleksi-kilpinen on LinkedIn
    • Aleksi Kilpinen
Re: Error with time zones RC4
« Reply #9 on: July 15, 2021, 03:14:06 PM »
https://www.iban.com/country-codes
Every country has a 2 letter code.
A Finnish Project Manager (Support Specialist)
Happily running multiple SMF 2.x installations.
 Fooling around with an i7-10700 @ 2,90GHz-4.80GHz / 16Gb / RTX-2070 Super / 3840x2160 / Win 10 x64


How you can help SMF

"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum.
Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Online Sesquipedalian

  • The Mad Doctor
  • Lead Developer
  • Sophist Member
  • *
  • Posts: 1,225
  • Gender: Male
  • It works! ... in theory.
    • Sesquipedalian on GitHub
Re: Error with time zones RC4
« Reply #10 on: July 15, 2021, 03:30:01 PM »
The member on your site misunderstands the purpose of that part of the code, Bigguy. It is not meant to correct three-character codes to two-character codes. It is just removing white space and any extra characters that might have snuck into the input for whatever reason.

If the admin enters "Purple monkeys", it will be truncated and capitalized to "PU". If the admin enters "Viet Nam", it will be truncated and capitalized to "VI". If the admin enters "USA", it will be truncated and capitalized to "US". If the admin enters "BGD", it will be truncated and capitalized to "BG".

Generally speaking, if the truncation happens to produce a valid but unexpected result, it will be the responsibility of the admin to find and enter the correct two-character code for the intended country.

EDIT: ...Actually, now that I think about it, it's probably cleaner to just fail immediately on overlong strings, rather than truncating them. If the admin accidentally enters an extra character, we'll just reject the whole string.
« Last Edit: July 15, 2021, 03:50:15 PM by Sesquipedalian »
I promise you nothing.

Sesqu... Sesqui... what?
Sesquipedalian, the best word in the English language.

Offline Bigguy

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 13,094
  • Gender: Male
  • Be nice, or else....
    • smfbigguy on GitHub
    • What's Ur Beef
Re: Error with time zones RC4
« Reply #11 on: July 15, 2021, 05:04:28 PM »
That's fine. I just thought I would bring it up as after your code from GH was applied to a RC4 install it got the two mixed up and we thought it was an error. Thanks for explaining and if something good came out  of this, well all the better. :)