You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the timer variable is being overwritten so previous setIntervals cant be stopped resulting in possible multiple infinite loop simultaneously.
long explanation
When the upload button is clicked, a function is set to be fired every 500ms using the setInverval method.
The setInterval method is assigned the variable 'timer'. This will continue to loop until a file has been selected and then 'timer' will be cleared(deleted). If the browsers upload dialog box is closed without selecting a file it still continues to loop.
Every time #button-upload is clicked another setInverval is run meaning there are now multiple loops occurring simultaneously but the latest has been given the same variable name meaning none of the others can now be cleared(deleted).
so once the loop sees that the file has been set then the ajax request is fired and 'timer' is cleared. leaving all previous setinverval methods to to loop infinity but because the a file has been selected it will continue to fire the ajax request resulting in lots of alerts().
Solution
$('#form-upload input[name=\'file\']').trigger('click');
/* new code */
if(typeof timer !='undefined'){
clearInterval(timer);
}
/* new code end */
timer = setInterval(function() {
issue #2142, issue #2609
short explanation
the timer variable is being overwritten so previous setIntervals cant be stopped resulting in possible multiple infinite loop simultaneously.
long explanation
When the upload button is clicked, a function is set to be fired every 500ms using the setInverval method.
The setInterval method is assigned the variable 'timer'. This will continue to loop until a file has been selected and then 'timer' will be cleared(deleted). If the browsers upload dialog box is closed without selecting a file it still continues to loop.
Every time #button-upload is clicked another setInverval is run meaning there are now multiple loops occurring simultaneously but the latest has been given the same variable name meaning none of the others can now be cleared(deleted).
so once the loop sees that the file has been set then the ajax request is fired and 'timer' is cleared. leaving all previous setinverval methods to to loop infinity but because the a file has been selected it will continue to fire the ajax request resulting in lots of alerts().
Solution
Affected files
htdocs\opencart-2.0.1.1\admin\view\template\catalog\download_form.tpl
htdocs\opencart-2.0.1.1\admin\view\template\common\filemanager.tpl
htdocs\opencart-2.0.1.1\admin\view\template\extension\installer.tpl
htdocs\opencart-2.0.1.1\admin\view\template\payment\amazon_checkout_order.tpl
htdocs\opencart-2.0.1.1\admin\view\template\sale\customer_form.tpl
htdocs\opencart-2.0.1.1\admin\view\template\sale\order_form.tpl
htdocs\opencart-2.0.1.1\catalog\view\theme\default\template\account\address_form.tpl
htdocs\opencart-2.0.1.1\catalog\view\theme\default\template\account\edit.tpl
htdocs\opencart-2.0.1.1\catalog\view\theme\default\template\account\register.tpl
htdocs\opencart-2.0.1.1\catalog\view\theme\default\template\checkout\guest.tpl
htdocs\opencart-2.0.1.1\catalog\view\theme\default\template\checkout\guest_shipping.tpl
htdocs\opencart-2.0.1.1\catalog\view\theme\default\template\checkout\payment_address.tpl
htdocs\opencart-2.0.1.1\catalog\view\theme\default\template\checkout\register.tpl
htdocs\opencart-2.0.1.1\catalog\view\theme\default\template\checkout\shipping_address.tpl
htdocs\opencart-2.0.1.1\catalog\view\theme\default\template\product\product.tpl
The text was updated successfully, but these errors were encountered: