From fd1cab568f6b0f31c8d670478e65afd390ec12e4 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Wed, 8 Mar 2006 21:52:55 +0000 Subject: [PATCH] - fix http_build_str(): urlencode [] brackets --- http_url_api.c | 4 ++-- package2.xml | 1 + tests/build_str_001.phpt | 22 +++++++++++----------- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/http_url_api.c b/http_url_api.c index cac64ec..cb0aeb5 100644 --- a/http_url_api.c +++ b/http_url_api.c @@ -385,14 +385,14 @@ PHP_HTTP_API STATUS _http_urlencode_hash_recursive(HashTable *ht, phpstr *str, c 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); } diff --git a/package2.xml b/package2.xml index 499d790..a62cff8 100644 --- a/package2.xml +++ b/package2.xml @@ -47,6 +47,7 @@ HttpResponse BSD, revised diff --git a/tests/build_str_001.phpt b/tests/build_str_001.phpt index 9bd0f40..8aeafcc 100644 --- a/tests/build_str_001.phpt +++ b/tests/build_str_001.phpt @@ -8,23 +8,23 @@ include 'skip.inc'; --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 -- 2.30.2