phpstr_init(&new_prefix);
if (prefix && prefix_len) {
phpstr_append(&new_prefix, prefix, prefix_len);
- phpstr_appends(&new_prefix, "[");
+ phpstr_appends(&new_prefix, "%5B");
}
phpstr_append(&new_prefix, encoded_key, encoded_len);
efree(encoded_key);
if (prefix && prefix_len) {
- phpstr_appends(&new_prefix, "]");
+ phpstr_appends(&new_prefix, "%5D");
}
phpstr_fix(&new_prefix);
}
<?php
echo "-TEST\n";
-parse_str($s = "a=b", $q);
-var_dump($s === http_build_str($q, null, "&"));
+parse_str("a=b", $q);
+echo http_build_str($q, null, "&"), "\n";
-parse_str($s = "a=b&c[0]=1", $q);
-var_dump($s === http_build_str($q, null, "&"));
+parse_str("a=b&c[0]=1", $q);
+echo http_build_str($q, null, "&"), "\n";
-parse_str($s = "a=b&c[0]=1&d[e]=f", $q);
-var_dump($s === http_build_str($q, null, "&"));
+parse_str("a=b&c[0]=1&d[e]=f", $q);
+echo http_build_str($q, null, "&"), "\n";
-var_dump("foo[0]=1&foo[1]=2&foo[2][0]=3" === http_build_str(array(1,2,array(3)), "foo", "&"));
+echo http_build_str(array(1,2,array(3)), "foo", "&"), "\n";
echo "Done\n";
?>
--EXPECTF--
%sTEST
-bool(true)
-bool(true)
-bool(true)
-bool(true)
+a=b
+a=b&c%5B0%5D=1
+a=b&c%5B0%5D=1&d%5Be%5D=f
+foo%5B0%5D=1&foo%5B1%5D=2&foo%5B2%5D%5B0%5D=3
Done