#43222 [Opn->Fbk]: stream_context_create bugs
| From: | jani@php.net | Date: | Sun, 26 Oct 2008 23:45:27 +0000 |
| Subject: | #43222 [Opn->Fbk]: stream_context_create bugs | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-130165@lists.php.net to get a copy of this message | ||
ID: 43222
Updated by: jani@php.net
Reported By: lihonggang at 100 dot cn
-Status: Open
+Status: Feedback
Bug Type: URL related
Operating System: *
PHP Version: 5.2CVS-2007-11-09 (CVS)
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
Previous Comments:
------------------------------------------------------------------------
[2007-11-09 03:32:52] lihonggang at 100 dot cn
Description:
------------
stream_context_create post content bug.
sometime the post data is excessive four bytes than 'content'
Reproduce code:
---------------
$url="http://192.168.0.110:6633/1.php";
$log_str="a=b&c=d";
$ret=micat_post($url,$log_str);
function micat_post($url,$content) {
$content_length = strlen($content);
$options = array(
'http'=>array(
'method' => 'POST',
'header' =>"Content-type:
application/x-www-form-urlencoded\r\n" .
"Content-length: $content_length\r\n".
"Command-length: $content_length\r\n",
'content' => $content
)
);
$context = stream_context_create($options);
$response = file_get_contents($url, false, $context);
}
Expected result:
----------------
the send data should be "a=b&c=d" but by using snort ,i found the send
data is ""a=b&c=d\r\n\r\n"
Actual result:
--------------
more foue bytes than content
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=43222&edit=1