Merge pull request #728 from zachborboa/master

Fix building post data with object
This commit is contained in:
Zach Borboa
2022-08-19 10:09:37 -04:00
committed by GitHub
2 changed files with 10 additions and 1 deletions
+1 -1
View File
@@ -208,7 +208,7 @@ class Curl
// php_url_encode()
// https://github.com/php/php-src/blob/master/ext/standard/http.c
return urlencode(strval($k)) . '=' . urlencode(strval($v));
}, array_keys($data), array_values($data)));
}, array_keys((array)$data), array_values((array)$data)));
}
return $data;
+9
View File
@@ -81,6 +81,15 @@ class CurlTest extends \PHPUnit\Framework\TestCase
]));
}
public function testBuildPostDataObject()
{
$data = new \stdClass();
$data->{'abc'} = 'foo';
$data->{'123'} = 'bar';
$curl = new Curl();
$curl->buildPostData($data);
}
public function testUserAgent()
{
$php_version = preg_replace('/([\.\+\?\*\(\)\[\]\^\$\/])/', '\\\\\1', 'PHP/' . PHP_VERSION);