mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-08-30 04:01:47 +00:00
Fix #725: Encode keys for post data with numeric keys
This commit is contained in:
+1
-1
@@ -207,7 +207,7 @@ class Curl
|
||||
// php_raw_url_encode()
|
||||
// php_url_encode()
|
||||
// https://github.com/php/php-src/blob/master/ext/standard/http.c
|
||||
return urlencode($k) . '=' . urlencode(strval($v));
|
||||
return urlencode(strval($k)) . '=' . urlencode(strval($v));
|
||||
}, array_keys($data), array_values($data)));
|
||||
}
|
||||
|
||||
|
||||
@@ -72,6 +72,15 @@ class CurlTest extends \PHPUnit\Framework\TestCase
|
||||
}
|
||||
}
|
||||
|
||||
public function testBuildPostDataIntegerKey()
|
||||
{
|
||||
$curl = new Curl();
|
||||
$this->assertEquals('abc=foo&123=bar', $curl->buildPostData([
|
||||
'abc' => 'foo',
|
||||
'123' => 'bar',
|
||||
]));
|
||||
}
|
||||
|
||||
public function testUserAgent()
|
||||
{
|
||||
$php_version = preg_replace('/([\.\+\?\*\(\)\[\]\^\$\/])/', '\\\\\1', 'PHP/' . PHP_VERSION);
|
||||
|
||||
Reference in New Issue
Block a user