multiple calls to uploadprogress_form_alter breaks progess monitoring

cassus - February 3, 2008 - 00:10
Project:File Upload Progress Monitor
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

I don't know why, but on my site uploadprogress_form_alter gets called two times on a node add page. And sadly this breaks the progress monitoring because "uploadprogress_uri" get's added (drupal_add_js) two times so that variable becomes an array, and that's really bad.

I've created a small patch for my site. Please review it and rethink if multiple calls to uploadprogress_form_alter in a single page generation is legal, or that's a bug.

AttachmentSize
uploadprogress-multiplecall-fix.patch654 bytes

#1

cassus - February 3, 2008 - 00:19

A backtrace where two calls are emitted. Hope it helps determine if this is normal behaviour.

AttachmentSize
backtrace.txt120.66 KB

#2

panis - February 4, 2008 - 18:31

you are right - that is a bug. Your patch should fix the javascript issue.

Thinking through a bit more I need to look at this in more detail because the form_alter will get called for every form on a page.

But I need only the forms that have a file upload to get this behavior.

Additionally progressbar status is maintained by a uniq ProgressbarID in PHP - each form on the page gets its own uniqid - the javascript that monitors the progress needs to be able to pickup the correct uniqid for the form being submitted and it may not doing so currently if there are multiple forms. If you have gotten this to work with your patch then you may hit this other problem depending on the order of how the forms are displayed on the page. The drupal.js patch will need to be modified to fix this problem.

stay tuned.

#3

illSleepWheniDie - February 22, 2008 - 04:24

Not meaning to add pressure guys, but what is the status now? Is the module safe for normal users to use? Also, the setup looks *very* complicated.

#4

panis - February 22, 2008 - 11:45
Status:active» fixed

Fixed in head. Please test.

'alwaysawake' - safe is a relative term - it relies on PHP extensions to get upload status and there is no easy way for drupal module to configure these extensions. Both APC's file upload status functions and uploadprogress PHP extensions have some issues and limitations that we can only get around when we find them and as users start reporting them.

The module is also relatively new and was designed to work on and tested on very specific installs - so it may not work right out of the box for all users.

#5

Anonymous (not verified) - March 7, 2008 - 11:52
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.