Edit report at https://bugs.php.net/bug.php?id=60928&edit=1
ID: 60928
User updated by: bardobakker at gmail dot com
Reported by: bardobakker at gmail dot com
Summary: php crash after http post without content type
header set
-Status: Feedback
+Status: Open
Type: Bug
Package: Apache2 related
Operating System: Linux
PHP Version: 5.3.9
Block user comment: N
Private report: N
New Comment:
php.ini has the default mbstring options = everything commented out
mbstring.ini has only the line:
extension=mbstring.so
In a local .htaccess file I added:
php_value mbstring.http_input pass
php_value mbstring.http_output pass
php_value mbstring.encoding_translation 0
which doesn't change anything in the output of phpinfo()
How would you disable mbstring?
Can it have something to do with mime type stuff or so?
Output phpinfo: http://www.mymoza.com/tup/info.php
Previous Comments:
------------------------------------------------------------------------
[2012-01-31 21:54:31] [email protected]
I can't reproduce the error. Could you try disabling mbstring? And if, after
disabling mbstring, there's no segfault, please tell us your configuration for
mbstring.* ini options (those active for the script that receives the POST
request).
------------------------------------------------------------------------
[2012-01-31 21:04:01] bardobakker at gmail dot com
Hi,
First of all, a surprising header in tcp dump (for me), I thought content type
was not set, but:
POST /tup/up.php HTTP/1.1
Content-Length: 1038349
Connection: Keep-Alive
Accept-Encoding: gzip
Accept-Language: nl-NL,en,*
User-Agent: Mozilla/5.0
Host: www.mymoza.com
Content-Type: application/x-www-form-urlencoded
URL of tcpdump (libpcap format): http://www.mymoza.com/tup/tcpdump.data
URL of test image: http://www.mymoza.com/tup/image.jpg
With the following headers set no seg. fault will occur:
POST /tup/up.php HTTP/1.1
Content-Type: image/jpeg
Content-Length: 1038349
Connection: Keep-Alive
Accept-Encoding: gzip
Accept-Language: nl-NL,en,*
User-Agent: Mozilla/5.0
Host: www.mymoza.com
------------------------------------------------------------------------
[2012-01-31 06:36:10] [email protected]
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.
------------------------------------------------------------------------
[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] [email protected]
hi
Could you post a link to the file you use to upload please? We connot reproduce
this problem.
------------------------------------------------------------------------
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