• Welcome to Simple Machines Community Forum. Please login or sign up.

Error with time zones RC4

Started by Bigguy, July 14, 2021, 02:04:51 PM

Previous topic - Next topic

Bigguy

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.

lesmond

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

Sesquipedalian

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.

Sesquipedalian

I promise you nothing.
Sesqu... Sesqui... what?
Sesquipedalian, the best word in the English language.

lesmond




Free Forum Image Hosting



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

Sesquipedalian

I promise you nothing.
Sesqu... Sesqui... what?
Sesquipedalian, the best word in the English language.

Bigguy

Glad to hear it's bein looked at.

live627

Shouldn't the error details be left-aligned?

Bigguy

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:

Quoteyou 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.

Aleksi "Lex" Kilpinen

A Finnish Project Manager (Support Specialist)
 Happily running multiple SMF 2.x installations.
  Fooling around with 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

Sesquipedalian

July 15, 2021, 03:30:01 PM #10 Last Edit: July 15, 2021, 03:50:15 PM by Sesquipedalian
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.
I promise you nothing.
Sesqu... Sesqui... what?
Sesquipedalian, the best word in the English language.

Bigguy

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. :)

Advertisement: