]> granicus.if.org Git - php/commitdiff
cleanup parameter parsing
authorStanislav Malyshev <stas@php.net>
Tue, 18 Aug 2009 00:41:43 +0000 (00:41 +0000)
committerStanislav Malyshev <stas@php.net>
Tue, 18 Aug 2009 00:41:43 +0000 (00:41 +0000)
ext/xmlrpc/tests/001.phpt
ext/xmlrpc/tests/002.phpt
ext/xmlrpc/tests/bug42189.phpt
ext/xmlrpc/xmlrpc-epi-php.c

index 99fd958d29fcaf2a65a1a323724996debad56be5..262509671409abc847cc1b86790d1ceb0ef8f82d 100644 (file)
@@ -38,19 +38,8 @@ string(160) "<?xml version="1.0" encoding="iso-8859-1"?>
 </methodCall>
 "
 
-Notice: Array to string conversion in %s on line %d
-string(177) "<?xml version="1.0" encoding="iso-8859-1"?>
-<methodCall>
-<methodName>Array</methodName>
-<params>
- <param>
-  <value>
-   <int>1</int>
-  </value>
- </param>
-</params>
-</methodCall>
-"
+Warning: xmlrpc_encode_request() expects parameter 1 to be string, array given in %s on line %d
+NULL
 string(175) "<?xml version="1.0" encoding="iso-8859-1"?>
 <methodCall>
 <methodName>3.4</methodName>
index c8d722b808fd0b4550891416310a791d421ba099..83586464bc25d9bc00c1a635711ced6a827a983d 100644 (file)
@@ -47,10 +47,7 @@ array(1) {
 }
 string(2) "-1"
 
-Notice: Array to string conversion in %s on line %d
-array(1) {
-  [0]=>
-  int(1)
-}
-string(5) "Array"
+Warning: xmlrpc_encode_request() expects parameter 1 to be string, array given in %s on line %d
+NULL
+string(2) "-1"
 Done
index 2b4e47ade773b422e80e7e6f5a5bf5a22b152264..55e726cf68707e44fce1d8a16cc7ee1d2b84bd95 100644 (file)
@@ -11,5 +11,5 @@ var_dump($ok);
 echo "Done\n";
 ?>
 --EXPECT--     
-bool(true)
+bool(false)
 Done
index 0bbf138b97aef8568ea2a39a0d78e3421e68e03f..4234cc5d4b65448977d50919fd86c862769fe471 100644 (file)
@@ -688,10 +688,12 @@ PHP_FUNCTION(xmlrpc_encode_request)
 {
        XMLRPC_REQUEST xRequest = NULL;
        char *outBuf;
-       zval **method, **vals, *out_opts = NULL;
+       zval *vals, *out_opts = NULL;
+       char *method = NULL;
+       int method_len;
        php_output_options out;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ZZ|a", &method, &vals, &out_opts) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s!z|a", &method, &method_len, &vals, &out_opts) == FAILURE) {
                return;
        }
 
@@ -702,15 +704,14 @@ PHP_FUNCTION(xmlrpc_encode_request)
 
                if (xRequest) {
                        XMLRPC_RequestSetOutputOptions(xRequest, &out.xmlrpc_out);
-                       if (Z_TYPE_PP(method) == IS_NULL) {
+                       if (method == NULL) {
                                XMLRPC_RequestSetRequestType(xRequest, xmlrpc_request_response);
                        } else {
-                               convert_to_string_ex(method);
-                               XMLRPC_RequestSetMethodName(xRequest, Z_STRVAL_PP(method));
+                               XMLRPC_RequestSetMethodName(xRequest, method);
                                XMLRPC_RequestSetRequestType(xRequest, xmlrpc_request_call);
                        }
-                       if (Z_TYPE_PP(vals) != IS_NULL) {
-                               XMLRPC_RequestSetData(xRequest, PHP_to_XMLRPC(*vals TSRMLS_CC));
+                       if (Z_TYPE_P(vals) != IS_NULL) {
+                               XMLRPC_RequestSetData(xRequest, PHP_to_XMLRPC(vals TSRMLS_CC));
                        }
 
                        outBuf = XMLRPC_REQUEST_ToXML(xRequest, 0);
@@ -800,7 +801,6 @@ PHP_FUNCTION(xmlrpc_decode_request)
                return;
        }
 
-       convert_to_string_ex(method);
 
        if (return_value_used) {
                zval* retval = decode_request_worker(xml, xml_len, encoding_len ? encoding : NULL, *method);
@@ -1061,20 +1061,20 @@ PHP_FUNCTION(xmlrpc_server_call_method)
        XMLRPC_REQUEST xRequest;
        STRUCT_XMLRPC_REQUEST_INPUT_OPTIONS input_opts;
        xmlrpc_server_data* server;
-       zval **caller_params, *handle, **output_opts = NULL;
+       zval **caller_params, *handle, *output_opts = NULL;
        char *rawxml;
        int rawxml_len, type;
        php_output_options out;
        int argc =ZEND_NUM_ARGS();
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsZ|Z", &handle, &rawxml, &rawxml_len, &caller_params, &output_opts) != SUCCESS) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsZ|a", &handle, &rawxml, &rawxml_len, &caller_params, &output_opts) != SUCCESS) {
                return;
        }
        /* user output options */
        if (argc == 3) {
                set_output_options(&out, NULL);
        } else {
-               set_output_options(&out, *output_opts);
+               set_output_options(&out, output_opts);
        }
 
        server = zend_list_find(Z_LVAL_P(handle), &type);