php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57656 No headers sent when APC_UPLOAD_PROGRESS is not before an input type=file
Submitted: 2007-05-08 16:17 UTC Modified: 2009-03-22 19:40 UTC
From: dopry at thing dot net Assigned:
Status: Closed Package: APC (PECL)
PHP Version: 5.2.1 OS: RHEL 3
Private report: No CVE-ID: None
 [2007-05-08 16:17 UTC] dopry at thing dot net
Description:
------------
When experimenting with the new APC_UPLOAD_PROGRESS code, Apache doesn't send response headers when an input named
APC_UPLOAD_PROGESS is not followed by an html file input.
This results in apache trying to send the file directly to the client instead of interpreting it. 

You can test the bug using with attached example code and passing in ?bug in the url.

'./configure' '--with-apxs2=/usr/local/apache2.2/bin/apxs' '--with-mm=/usr/local/src/mm-1.4.0' '--with-mysql' '--with-pgsql' '--with-curl=/usr/local/src/curl-7.16.1' '--with-iconv' '--enable-memcache' '--prefix=/usr/local/php5.2.1' '--with-gd' '--enable-mbstring' '--with-jpeg-dir=/opt' '--with-png-dir=/usr/lib' '--with-zlib' '--with-imap' '--with-kerberos' '--with-imap-ssl'

extension="apc.so"
apc.shm_segments=1
apc.shm_size=128
apc.ttl=7200
apc.user_ttl=7200
apc.num_files_hint=1024
apc.rfc1867 = on
extension="zip.so"

upload_max_filesize = 64M
post_max_size = 128M
file_uploads = On
memory_limit = 128M

Reproduce code:
---------------
<html>
<body>
<pre>
  <?php if ($_POST && $_FILES) {   
      print_r($_POST);  print("\n\n");  print_r($_FILES); } 
  ?>  
</pre>
<form method=post enctype='multipart/form-data'>
  <? if(!isset($_GET['bug']))
   print "<input type='hidden' name='APC_UPLOAD_PROGRESS' value='2234' />"; 
  ?>  
  <input type='file' name='myfile' />
  <? if(isset($_GET['bug'])) 
    print "<input type='hidden' name='APC_UPLOAD_PROGRESS' value='2234' />"; 
  ?>  
  <input type='submit' name='Upload' />
</form>
</body>
</html>

Expected result:
----------------
That the page would load as normal and APC_UPLOAD_PROGRESS would be ignored, since it isn't followed by a file, and logging an error message or throwing a warning.

Actual result:
--------------
Apache tries to serve the test.php file, but I get a file with no contents if I instruct firefox(2.0.0.3) to open or save. 

Firebug does not display any response headers from apache.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-05-14 08:18 UTC] gopalv82 at yahoo dot com
I tried to reproduce the bug by loading

http://localhost:3128/10984/?bug

and posting a small file to it. The output was the following

Array
(
    [APC_UPLOAD_PROGRESS] => 2234
    [Upload] => Submit Query
)


Array
(
    [myfile] => Array
        (
            [name] => 8k.data
            [type] => application/octet-stream
            [tmp_name] => /tmp/phpyW1zSs
            [error] => 0
            [size] => 8192
        )

)

In apc 3.0.15-dev current CVS with PHP Version 5.2.2-dev.

Anything else I need to know about ? (no ZTS, no fastCGI from your ./configure flags). Maybe you can try with the latest cvs of APC ?
 [2009-02-18 23:01 UTC] shire@php.net
Made some corrections to the callback function, can you try out latest CVS?
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 20 03:01:32 2024 UTC