SMF 2.0.2 "Stack overflow at line 1322"

Started by willyvmm, January 31, 2012, 04:27:35 PM

Previous topic - Next topic

willyvmm

Thereis a Bug in script.js. The bug exist on ALL  platforms, but only IE8 on XP platform shows that if you are not logged in. Other browsers just ignore that.

Code (JavaScript) Select

function addLoadEvent(fNewOnload)
{
// If there's no event set, just set this one
if (typeof(fNewOnload) == 'function' && (!('onload' in window) || typeof(window.onload) != 'function'))
window.onload = fNewOnload;

// If there's just one event, setup the array.
else if (aOnloadEvents.length == 0)
{
aOnloadEvents[0] = window.onload;
aOnloadEvents[1] = fNewOnload;
window.onload = function() {
for (var i = 0, n = aOnloadEvents.length; i < n; i++)
{
if (typeof(aOnloadEvents[i]) == 'function')
aOnloadEvents[i]();           
else if (typeof(aOnloadEvents[i]) == 'string')
eval(aOnloadEvents[i]);
}
}
}

// This isn't the first event function, add it to the list.
else
aOnloadEvents[aOnloadEvents.length] = fNewOnload;
}


In this function The array aOnloadEvents is defined, and the first
  • element of that array, point on the function that works in this case as a recursive function.
    It results as infinity recursive loop ...
    The fix is Easy:

    Just commnet out line 1316: (or remove);
    Code (JavaScript) Select
    aOnloadEvents[0] = window.onload;

    And change index from 1 to 0 in the next line (1317):
    Code (JavaScript) Select
    aOnloadEvents[1] = fNewOnload;

    after change:
    Code (JavaScript) Select
    // aOnloadEvents[0] = window.onload;
    aOnloadEvents[0] = fNewOnload;


    I'am not shure if the script lost some of its functionality but I hope it is still working as it should.

    Best Regards Willy.


    I've just found that is not the best solution ... and the error ocurs only if the function was called 2nd time with empty aOnloadEvents array.

willyvmm

I've investigated this problem little bit more. This is not SMF bug, this is Jfusion(joomla integration) bug.

emanuele

Thanks for taking time to report and look into it!


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Advertisement: