Edit report at https://bugs.php.net/bug.php?id=60928&edit=1

 ID:                 60928
 Updated by:         paj...@php.net
 Reported by:        bardobakker at gmail dot com
 Summary:            php crash after http post without content type
                     header set
-Status:             Open
+Status:             Feedback
 Type:               Bug
 Package:            Apache2 related
 Operating System:   Linux
 PHP Version:        5.3.9
 Block user comment: N
 Private report:     N

 New Comment:

Can you post a link to the data you use to upload?

Please try to do a tcpdump as well on the client side to see what you send 
actually and post a link to the dump here as well.

We still cannot reproduce it, even with large data.


Previous Comments:
------------------------------------------------------------------------
[2012-01-30 20:04:01] bardobakker at gmail dot com

1 - Forgot to mention, I need to post a big file. For example a image larger 
than 5MB. If I post for example a small xml file everything works fine.

2 - I tried to reproduce with the following php script, but everything seems to 
work here; strange. Maybe the feature is in Qt, which I can rule out since 
everything used to work, and after upgrade to php 5.3.9 the behaviour started.

<?php
// Get contents of a file into a string
$filename = "./image.jpg";
$handle = fopen($filename, "r");
$contents = fread($handle, filesize($filename));
fclose($handle);

// Make post request params
$params = array('http' => array(
        'method' => 'POST',
        'content' => $data
));

// Create a streams context
$ctx = stream_context_create($params);

// Do post
$url = "http://www.server.com/post.php";;
$fp = @fopen($url, 'rb', false, $ctx);
if(!$fp) echo "Problem with $url, $php_errormsg";

// Read response
$response = @stream_get_contents($fp);
if($response === false) echo "Problem reading data from $url, $php_errormsg";

// Echo response
echo $response;
?>

------------------------------------------------------------------------
[2012-01-30 12:46:07] paj...@php.net

hi

Could you post a link to the file you use to upload please? We connot reproduce 
this problem.

------------------------------------------------------------------------
[2012-01-30 08:31:22] paj...@php.net

That's what I mean by "reproduce script", what crashes is not the client (your 
QT 
app) but the server side (php), so we need a reproduce script to know how it 
crases :)

------------------------------------------------------------------------
[2012-01-30 06:46:45] bardobakker at gmail dot com

I already posted the c++ code (Qt) I use to do the post without content type 
header. I do not know a second way to do a similar post.
One can use a empty php file to post to, even than it will crash:

<?php
?>

But the lines i use to read the raw post data:

<?php
//load raw post
$data = file_get_contents("php://input");
//(current dir is writable) 
$handle = fopen("./file.jpg", "w");
fwrite($handle, $data);
fclose($handle);
?>

------------------------------------------------------------------------
[2012-01-29 23:48:34] paj...@php.net

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.



------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=60928


-- 
Edit this bug report at https://bugs.php.net/bug.php?id=60928&edit=1

Reply via email to