iliaa           Tue Aug 30 21:19:41 2005 EDT

  Modified files:              
    /php-src/ext/standard       http.c php_http.h 
    /php-src    NEWS 
  Log:
  Added optional parameter to http_build_query() to allow specification of 
  string separator.
  
  
http://cvs.php.net/diff.php/php-src/ext/standard/http.c?r1=1.15&r2=1.16&ty=u
Index: php-src/ext/standard/http.c
diff -u php-src/ext/standard/http.c:1.15 php-src/ext/standard/http.c:1.16
--- php-src/ext/standard/http.c:1.15    Fri Aug 19 06:55:05 2005
+++ php-src/ext/standard/http.c Tue Aug 30 21:19:38 2005
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: http.c,v 1.15 2005/08/19 10:55:05 dmitry Exp $ */
+/* $Id: http.c,v 1.16 2005/08/31 01:19:38 iliaa Exp $ */
 
 #include "php_http.h"
 #include "php_ini.h"
@@ -29,9 +29,9 @@
                                const char *num_prefix, int num_prefix_len,
                                const char *key_prefix, int key_prefix_len,
                                const char *key_suffix, int key_suffix_len,
-                               zval *type TSRMLS_DC)
+                               zval *type, char *arg_sep TSRMLS_DC)
 {
-       char *arg_sep = NULL, *key = NULL, *ekey, *newprefix, *p;
+       char *key = NULL, *ekey, *newprefix, *p;
        int arg_sep_len, key_len, ekey_len, key_type, newprefix_len;
        ulong idx;
        zval **zdata = NULL, *copyzval;
@@ -45,9 +45,11 @@
                return SUCCESS;
        }
 
-       arg_sep = INI_STR("arg_separator.output");
-       if (!arg_sep || !strlen(arg_sep)) {
-               arg_sep = URL_DEFAULT_ARG_SEP;
+       if (!arg_sep) {
+               arg_sep = INI_STR("arg_separator.output");
+               if (!arg_sep || !strlen(arg_sep)) {
+                       arg_sep = URL_DEFAULT_ARG_SEP;
+               }
        }
        arg_sep_len = strlen(arg_sep);
 
@@ -127,7 +129,7 @@
                                *p = '\0';
                        }
                        ht->nApplyCount++;
-                       php_url_encode_hash_ex(HASH_OF(*zdata), formstr, NULL, 
0, newprefix, newprefix_len, "]", 1, (Z_TYPE_PP(zdata) == IS_OBJECT ? *zdata : 
NULL) TSRMLS_CC);
+                       php_url_encode_hash_ex(HASH_OF(*zdata), formstr, NULL, 
0, newprefix, newprefix_len, "]", 1, (Z_TYPE_PP(zdata) == IS_OBJECT ? *zdata : 
NULL), arg_sep TSRMLS_CC);
                        ht->nApplyCount--;
                        efree(newprefix);
                } else if (Z_TYPE_PP(zdata) == IS_NULL || Z_TYPE_PP(zdata) == 
IS_RESOURCE) {
@@ -183,16 +185,17 @@
 }
 /* }}} */
 
-/* {{{ proto string http_build_query(mixed formdata [, string prefix])
+/* {{{ proto string http_build_query(mixed formdata [, string prefix [, string 
arg_separator]])
    Generates a form-encoded query string from an associative array or object. 
*/
 PHP_FUNCTION(http_build_query)
 {
        zval *formdata;
-       char *prefix = NULL;
-       int prefix_len = 0;
+       char *prefix = NULL, *arg_sep=NULL;
+       int arg_sep_len, prefix_len = 0;
        smart_str formstr = {0};
+       
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|s", &formdata, 
&prefix, &prefix_len) != SUCCESS) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|ss", &formdata, 
&prefix, &prefix_len, &arg_sep, &arg_sep_len) != SUCCESS) {
                RETURN_FALSE;
        }
 
@@ -201,7 +204,7 @@
                RETURN_FALSE;
        }
 
-       if (php_url_encode_hash_ex(HASH_OF(formdata), &formstr, prefix, 
prefix_len, NULL, 0, NULL, 0, (Z_TYPE_P(formdata) == IS_OBJECT ? formdata : 
NULL) TSRMLS_CC) == FAILURE) {
+       if (php_url_encode_hash_ex(HASH_OF(formdata), &formstr, prefix, 
prefix_len, NULL, 0, NULL, 0, (Z_TYPE_P(formdata) == IS_OBJECT ? formdata : 
NULL), arg_sep TSRMLS_CC) == FAILURE) {
                if (formstr.c) {
                        efree(formstr.c);
                }
http://cvs.php.net/diff.php/php-src/ext/standard/php_http.h?r1=1.5&r2=1.6&ty=u
Index: php-src/ext/standard/php_http.h
diff -u php-src/ext/standard/php_http.h:1.5 php-src/ext/standard/php_http.h:1.6
--- php-src/ext/standard/php_http.h:1.5 Wed Aug  3 10:08:10 2005
+++ php-src/ext/standard/php_http.h     Tue Aug 30 21:19:38 2005
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: php_http.h,v 1.5 2005/08/03 14:08:10 sniper Exp $ */
+/* $Id: php_http.h,v 1.6 2005/08/31 01:19:38 iliaa Exp $ */
 
 #ifndef PHP_HTTP_H
 #define PHP_HTTP_H
@@ -28,7 +28,7 @@
                                const char *num_prefix, int num_prefix_len,
                                const char *key_prefix, int key_prefix_len,
                                const char *key_suffix, int key_suffix_len, 
-                               zval *type TSRMLS_DC);
+                               zval *type, char *arg_sep TSRMLS_DC);
 #define php_url_encode_hash(ht, formstr)       php_url_encode_hash_ex((ht), 
(formstr), NULL, 0, NULL, 0, NULL, 0, NULL TSRMLS_CC)
 
 PHP_FUNCTION(http_build_query);
http://cvs.php.net/diff.php/php-src/NEWS?r1=1.2049&r2=1.2050&ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2049 php-src/NEWS:1.2050
--- php-src/NEWS:1.2049 Tue Aug 30 16:02:47 2005
+++ php-src/NEWS        Tue Aug 30 21:19:40 2005
@@ -4,6 +4,8 @@
 - Unicode support. (Andrei, Dmitriy, et al)
 - Changed "instanceof" operator, is_a() and is_subclass_of() functions to not
   call __autoload(). (Dmitry)
+- Added optional parameter to http_build_query() to allow specification of 
+  string separator.
 - cURL improvements: (Ilia)
   . Added curl_setopt_array() which allows setting of multiple cURL options.
   . Added CURLINFO_HEADER_OUT to facilitate request retrieval.

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to