stas Tue, 18 Aug 2009 00:41:43 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=287434
Log:
cleanup parameter parsing
Changed paths:
U php/php-src/branches/PHP_5_3/ext/xmlrpc/tests/001.phpt
U php/php-src/branches/PHP_5_3/ext/xmlrpc/tests/002.phpt
U php/php-src/branches/PHP_5_3/ext/xmlrpc/tests/bug42189.phpt
U php/php-src/branches/PHP_5_3/ext/xmlrpc/xmlrpc-epi-php.c
U php/php-src/trunk/ext/xmlrpc/tests/001.phpt
U php/php-src/trunk/ext/xmlrpc/tests/002.phpt
U php/php-src/trunk/ext/xmlrpc/tests/bug42189.phpt
U php/php-src/trunk/ext/xmlrpc/xmlrpc-epi-php.c
Modified: php/php-src/branches/PHP_5_3/ext/xmlrpc/tests/001.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/xmlrpc/tests/001.phpt 2009-08-17 23:51:49 UTC (rev 287433)
+++ php/php-src/branches/PHP_5_3/ext/xmlrpc/tests/001.phpt 2009-08-18 00:41:43 UTC (rev 287434)
@@ -38,19 +38,8 @@
</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>
Modified: php/php-src/branches/PHP_5_3/ext/xmlrpc/tests/002.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/xmlrpc/tests/002.phpt 2009-08-17 23:51:49 UTC (rev 287433)
+++ php/php-src/branches/PHP_5_3/ext/xmlrpc/tests/002.phpt 2009-08-18 00:41:43 UTC (rev 287434)
@@ -47,10 +47,7 @@
}
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
Modified: php/php-src/branches/PHP_5_3/ext/xmlrpc/tests/bug42189.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/xmlrpc/tests/bug42189.phpt 2009-08-17 23:51:49 UTC (rev 287433)
+++ php/php-src/branches/PHP_5_3/ext/xmlrpc/tests/bug42189.phpt 2009-08-18 00:41:43 UTC (rev 287434)
@@ -11,5 +11,5 @@
echo "Done\n";
?>
--EXPECT--
-bool(true)
+bool(false)
Done
Modified: php/php-src/branches/PHP_5_3/ext/xmlrpc/xmlrpc-epi-php.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/xmlrpc/xmlrpc-epi-php.c 2009-08-17 23:51:49 UTC (rev 287433)
+++ php/php-src/branches/PHP_5_3/ext/xmlrpc/xmlrpc-epi-php.c 2009-08-18 00:41:43 UTC (rev 287434)
@@ -682,10 +682,12 @@
{
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;
}
@@ -696,15 +698,14 @@
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);
@@ -794,7 +795,6 @@
return;
}
- convert_to_string_ex(method);
if (return_value_used) {
zval* retval = decode_request_worker(xml, xml_len, encoding_len ? encoding : NULL, *method);
@@ -1055,20 +1055,20 @@
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);
Modified: php/php-src/trunk/ext/xmlrpc/tests/001.phpt
===================================================================
--- php/php-src/trunk/ext/xmlrpc/tests/001.phpt 2009-08-17 23:51:49 UTC (rev 287433)
+++ php/php-src/trunk/ext/xmlrpc/tests/001.phpt 2009-08-18 00:41:43 UTC (rev 287434)
@@ -38,19 +38,8 @@
</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>
Modified: php/php-src/trunk/ext/xmlrpc/tests/002.phpt
===================================================================
--- php/php-src/trunk/ext/xmlrpc/tests/002.phpt 2009-08-17 23:51:49 UTC (rev 287433)
+++ php/php-src/trunk/ext/xmlrpc/tests/002.phpt 2009-08-18 00:41:43 UTC (rev 287434)
@@ -47,10 +47,7 @@
}
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
Modified: php/php-src/trunk/ext/xmlrpc/tests/bug42189.phpt
===================================================================
--- php/php-src/trunk/ext/xmlrpc/tests/bug42189.phpt 2009-08-17 23:51:49 UTC (rev 287433)
+++ php/php-src/trunk/ext/xmlrpc/tests/bug42189.phpt 2009-08-18 00:41:43 UTC (rev 287434)
@@ -11,5 +11,5 @@
echo "Done\n";
?>
--EXPECT--
-bool(true)
+bool(false)
Done
Modified: php/php-src/trunk/ext/xmlrpc/xmlrpc-epi-php.c
===================================================================
--- php/php-src/trunk/ext/xmlrpc/xmlrpc-epi-php.c 2009-08-17 23:51:49 UTC (rev 287433)
+++ php/php-src/trunk/ext/xmlrpc/xmlrpc-epi-php.c 2009-08-18 00:41:43 UTC (rev 287434)
@@ -688,10 +688,12 @@
{
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 @@
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 @@
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 @@
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);
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php