File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -1094,7 +1094,7 @@ private function __get_totalTime() {
1094
1094
*/
1095
1095
private function buildURL ($ url , $ data = array ())
1096
1096
{
1097
- return $ url . (empty ($ data ) ? '' : '? ' . http_build_query ($ data ));
1097
+ return $ url . (empty ($ data ) ? '' : '? ' . http_build_query ($ data, '' , ' & ' ));
1098
1098
}
1099
1099
1100
1100
/**
Original file line number Diff line number Diff line change @@ -2807,4 +2807,29 @@ public function testOptionSet()
2807
2807
2808
2808
$ this ->assertFalse (isset ($ options [CURLOPT_COOKIE ]));
2809
2809
}
2810
+
2811
+ public function testBuildUrlArgSeparator ()
2812
+ {
2813
+ $ base_url = 'https://www.example.com/path ' ;
2814
+ $ data = array (
2815
+ 'arg ' => 'value ' ,
2816
+ 'another ' => 'one ' ,
2817
+ );
2818
+ $ expected_url = $ base_url . '?arg=value&another=one ' ;
2819
+
2820
+ foreach (array (false , '& ' , '& ' ) as $ arg_separator ) {
2821
+ if ($ arg_separator ) {
2822
+ ini_set ('arg_separator.output ' , $ arg_separator );
2823
+ }
2824
+
2825
+ $ curl = new Curl ();
2826
+
2827
+ $ reflector = new ReflectionObject ($ curl );
2828
+ $ method = $ reflector ->getMethod ('buildURL ' );
2829
+ $ method ->setAccessible (true );
2830
+
2831
+ $ actual_url = $ method ->invoke ($ curl , $ base_url , $ data );
2832
+ $ this ->assertEquals ($ expected_url , $ actual_url );
2833
+ }
2834
+ }
2810
2835
}
You can’t perform that action at this time.
0 commit comments