php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59453 RFC1867_DATA(prev_bytes_processed) isn't cleared
Submitted: 2010-10-08 18:15 UTC Modified: 2010-10-15 13:52 UTC
From: myang at facebook dot com Assigned:
Status: Closed Package: APC (PECL)
PHP Version: 5.2.5 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: myang at facebook dot com
New email:
PHP Version: OS:

 

 [2010-10-08 18:15 UTC] myang at facebook dot com
Description:
------------
From APC-3.1.4/apc_rfc1867.c:
        case MULTIPART_EVENT_START:
            {
                multipart_event_start *data = (multipart_event_start *) event_d
ata;

                RFC1867_DATA(content_length)    = data->content_length;
                RFC1867_DATA(tracking_key)[0]   = '\0';
                RFC1867_DATA(name)[0]           = '\0';
                RFC1867_DATA(cancel_upload)     = 0;
                RFC1867_DATA(temp_filename)     = NULL;
                RFC1867_DATA(filename)[0]       = '\0';
                RFC1867_DATA(key_length)        = 0;
                RFC1867_DATA(start_time)        = my_time();
                RFC1867_DATA(bytes_processed)   = 0;
                RFC1867_DATA(rate)              = 0;
                RFC1867_DATA(update_freq)       = (int) APCG(rfc1867_freq);
                RFC1867_DATA(started)           = 0;

                if(RFC1867_DATA(update_freq) < 0) {  // frequency is a percenta
ge, not bytes
                    RFC1867_DATA(update_freq) = (int) (RFC1867_DATA(content_len
gth) * APCG(rfc1867_freq) / 100);
                }
            }
            break;

Notice that RFC1867_DATA(prev_bytes_processed) isn't set to 0. This means that the small array representing upload progress (stored in APC) may not get updated because the following condition evaluates to false:
                if(RFC1867_DATA(bytes_processed) - RFC1867_DATA(prev_bytes_processed) > (uint) RFC1867_DATA(update_freq)) {


The end result is that sometimes user may not see the progress bar moving. For example, if the previous uploaded file resulted in a large value of RFC1867_DATA(prev_bytes_processed).


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-10-15 08:06 UTC] gopalv82 at yahoo dot com
http://news.php.net/php.pecl.cvs/14801

Nice catch. Please confirm fix.
 [2010-10-15 13:52 UTC] myang at facebook dot com
Thanks for the fix!
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 12 10:01:33 2025 UTC