Bug #53548 [Com]: post failled when '@' is the first character
| From: | wangyi6854 at sohu dot com | Date: | Wed, 15 Dec 2010 08:29:28 +0000 |
| Subject: | Bug #53548 [Com]: post failled when '@' is the first character | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-157009@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=53548&edit=1
ID: 53548
Comment by: wangyi6854 at sohu dot com
Reported by: wangyi6854 at sohu dot com
Summary: post failled when '@' is the first character
Status: Bogus
Type: Bug
Package: cURL related
Operating System: FreeBSD 8.1
PHP Version: 5.3.4
Block user comment: N
Private report: N
New Comment:
Yes.
But curl should provide a option to turn it off. The project I involve
limits the length of post field. So add some char into the front of the
string is not possible.
I check the curl's manual(command line version). it has a global option
to turn it off. But I can't found the way to turn off some particular
fields.
Any suggestion?
Thanks!
Previous Comments:
------------------------------------------------------------------------
[2010-12-15 09:19:00] aharvey@php.net
As documented on the curl_setopt() manual page, CURLOPT_POSTFIELDS will
assume that a value starting with @ is the location of a file to use as
the post data, and not the literal post data itself.
------------------------------------------------------------------------
[2010-12-15 09:04:59] wangyi6854 at sohu dot com
Description:
------------
curl post will failed when post field's first char is '@'.
the ip address in the following code is www.example.com's. You can
replace it with any address.
Test script:
---------------
<?php
$msg = '';
if ( !empty( $_POST ) ) {
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, "http://192.0.32.10/" );
curl_setopt( $ch, CURLOPT_POST, 1 );
curl_setopt( $ch, CURLOPT_POSTFIELDS, array( 'test' => '@aaaa' ) );
if ( false === curl_exec( $ch ) ) {
$msg .= 'curl error: ' . curl_errno( $ch ) . ".\nmessage: " .
curl_error( $ch ) . PHP_EOL;
}
else {
$msg .= 'OK!';
}
curl_close( $ch );
}
?>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head></head>
<body>
<pre><?php echo $msg; ?></pre>
<form method="post" action="">
<input type="submit" name="test" value="test!" />
</form>
</body></html>
Expected result:
----------------
curl should work whatever the content is.
Actual result:
--------------
curl will failed when post field's first char is '@'.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=53548&edit=1