Skip to content

Commit a88cd8a

Browse files
committed
Fix numeric data values not being correctly encoded
1 parent 55506c4 commit a88cd8a

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Curl.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ function http_build_multi_query($data, $key=NULL) {
8787
$is_array_assoc = is_array_assoc($data);
8888

8989
foreach ($data as $k => $value) {
90-
if (is_string($value) || is_int($value)) {
90+
if (is_string($value) || is_numeric($value)) {
9191
$brackets = $is_array_assoc ? '[' . $k . ']' : '[]';
9292
$query[] = urlencode(is_null($key) ? $k : $key . $brackets) . '=' . rawurlencode($value);
9393
}

tests/run.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,10 @@ public function testPostAssociativeArrayData() {
6868
'more_data' => array(
6969
'param1' => 'something',
7070
'param2' => 'other thing',
71-
'param3' => '123',
71+
'param3' => 123,
72+
'param4' => 3.14,
7273
),
73-
)) === 'test=post_multidimensional&username=myusername&password=mypassword&more_data%5Bparam1%5D=something&more_data%5Bparam2%5D=other%20thing&more_data%5Bparam3%5D=123');
74+
)) === 'test=post_multidimensional&username=myusername&password=mypassword&more_data%5Bparam1%5D=something&more_data%5Bparam2%5D=other%20thing&more_data%5Bparam3%5D=123&more_data%5Bparam4%5D=3.14');
7475
}
7576

7677
public function testPostMultidimensionalData() {

0 commit comments

Comments
 (0)