Feel free to discuss anything interesting you see about the changelog updates!
New revs - Public comments
« on July 27th, 2011, 12:20 PM »
* encodeURIComponent() has been supported as far back as IE 5.5, so there's no reason to use SMF's way of emulating it
* php_strtr uses charAt when it could use [] instead. It's a bit faster, which is good in long loops. (script.js)
I'm letting them be for now because they're testing for %u in the URL, which only happens in escape()'d strings
Do they behave differently? Specifically, the php_* functions in JS are not necessarily exact analogues of existing or later-defined JS structures, they are implemented specifically to replicate how PHP does things especially where character sets are concerned (since .toLowerCase() can behave rather differently to strtolower(), as a typical example)Quote * encodeURIComponent() has been supported as far back as IE 5.5, so there's no reason to use SMF's way of emulating it
* php_strtr uses charAt when it could use [] instead. It's a bit faster, which is good in long loops. (script.js)
Is that all they're actually doing?Quote I'm letting them be for now because they're testing for %u in the URL, which only happens in escape()'d strings
That's one of the slightly maddening things about the codebase - stuff like that has been in there for years and it is a little tricky at times prising out the specific reason for it.
! If a timezone has no slash in it (such as 'UTC'), the timezone retrieval code will generate a warning. (ManageSettings.php)
The reason for using strtolower done like that is for accuracy. JavaScript's one is way more aware of things like UTF-8 than PHP's has been for a long time, and I suspect with PHP 5.4 this will have to be revisited anyway.
But ultimately the two have to be done exactly the same for password hashing to actually work, so JS has to then proceed to use the exact same case adjuster even if the browser could do a "better" job of it.
I had actually fixed that locally, though I've not committed what I have because I'm not happy with it yet, concerning how users select timezones. Still not sure about that, maybe I should just commit what I have (which is to use a timezone column in the user's table and fallback to the offset for the time being)
Is my fix okay for you? Feel free to rewrite it... I only fixed the error, really.
Your number convert function -- isn't he comma_format stuff going to kill performance if used on a larger scale...?
I haven't looked (been way too busy with stuff) but I suspect it's similar to the one I have on my local copy, which also has the ability to load the timezone from the members table as well.Quote Is my fix okay for you? Feel free to rewrite it... I only fixed the error, really.
Not really, no, because it's not actually used all that often in the scheme of things.Quote Your number convert function -- isn't he comma_format stuff going to kill performance if used on a larger scale...?
Again, I didn't touch the timezone code. I only fixed the loop that retrieves them, to ensure it won't generate a warning on the list (,) code (since UTC doesn't have a comma and thus throws out an error when splitting it.)
I suppose we could have used it more, though
So, who's going to convert the rest of the plural thingies?
Yeah, that's what I meant; I've fixed the loop myself separately, but I'll fix it when I commit what I do have.
Yes, it can be used more, because it's not heavy in itself, it's only heavy if comma_format wasn't being used already, but the places that occurs are not common.
That one's on my todo list.Quote So, who's going to convert the rest of the plural thingies?
I've dealt with the existing _n plurals in rev 900, too. And added one that was in the index language file. Should be a good start
Bah, I missed the array_flip, thinking you were just doing the isset check on it at the end and that it wouldn't work as expected then...