#27446 [Com]: [PATCH] system.multiCall does not work

2009-02-26 Thread kawai at apache dot org
 ID:   27446
 Comment by:   kawai at apache dot org
 Reported By:  tomy at envox dot hr
 Status:   No Feedback
 Bug Type: XMLRPC-EPI related
 Operating System: *
 PHP Version:  5CVS, 6CVS (2008-07-21)
 New Comment:

I downloaded php5.2-200902270530, and tested. This issue was not 
fixed.


Previous Comments:


[2009-02-17 01:00:00] php-bugs at lists dot php dot net

No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to Open.



[2009-02-09 14:37:00] il...@php.net

Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/





[2008-05-28 05:53:13] kawai at apache dot org

Now, you can download patched version of xmlrpc extension from:
http://mp.i-revo.jp/user.php/kcvcrlkq/entry/309.html

I hope this patch to be applied in the next PHP release.



[2008-05-02 13:52:41] kawai at apache dot org

I also hit this bug in my own server. I analyzed the bug, and created a
patch for this:


--- php-5.2.6/ext/xmlrpc/xmlrpc-epi-php.c   Mon Dec 31 16:20:14 2007
+++ xmlrpc-epi-php.cFri May  2 22:41:30 2008
@@ -859,6 +859,20 @@
zval* callback_params[3];
TSRMLS_FETCH();

+   const char* methodname = XMLRPC_RequestGetMethodName(xRequest);
+   zval **php_function;
+   if (!methodname) { methodname = ; }
+   Z_STRVAL_P(pData-xmlrpc_method) = estrdup(methodname);
+   Z_STRLEN_P(pData-xmlrpc_method) = strlen(methodname);
+   Z_TYPE_P(pData-xmlrpc_method) = IS_STRING;
+   pData-php_executed = 0;
+   if(zend_hash_find(Z_ARRVAL_P(pData-server-method_map),
+  Z_STRVAL_P(pData-xmlrpc_method), 
+  Z_STRLEN_P(pData-xmlrpc_method) + 1, 
+  (void**)php_function) == SUCCESS) {
+   pData-php_function = *php_function;
+   }
+   
/* convert xmlrpc to native php types */
xmlrpc_params = XMLRPC_to_PHP(XMLRPC_RequestGetData(xRequest));
 
@@ -876,7 +890,7 @@
 
zval_ptr_dtor(xmlrpc_params);
 
-   return NULL;
+   return PHP_to_XMLRPC(pData-return_data TSRMLS_CC);
 }
 
 /* called by the C server when it first receives an introspection
request.  We pass this on to
@@ -1017,7 +1031,6 @@
Parses XML requests and call methods */
 PHP_FUNCTION(xmlrpc_server_call_method)
 {
-   xmlrpc_callback_data data = {0};
XMLRPC_REQUEST xRequest;
STRUCT_XMLRPC_REQUEST_INPUT_OPTIONS input_opts;
xmlrpc_server_data* server;
@@ -1048,8 +1061,8 @@
 
if(xRequest) {
const char* methodname = 
XMLRPC_RequestGetMethodName(xRequest);
-   zval **php_function;
-   XMLRPC_VALUE xAnswer = NULL;
+   
+   xmlrpc_callback_data data = {0};
MAKE_STD_ZVAL(data.xmlrpc_method); /* init. very 
important.  spent
a frustrating day finding this out. */
MAKE_STD_ZVAL(data.return_data);
Z_TYPE_P(data.return_data) = IS_NULL;  /* in case value 
is never
init'd, we don't dtor to think it is a string or something */
@@ -1060,26 +1073,15 @@
}
 
/* setup some data to pass to the callback function */
-   Z_STRVAL_P(data.xmlrpc_method) = estrdup(methodname);
-   Z_STRLEN_P(data.xmlrpc_method) = strlen(methodname);
-   Z_TYPE_P(data.xmlrpc_method) = IS_STRING;
data.caller_params = *caller_params;
data.php_executed = 0;
data.server = server;
 
-   /* check if the called method has been previous 
registered */
-   if(zend_hash_find(Z_ARRVAL_P(server-method_map),
-  Z_STRVAL_P(data.xmlrpc_method), 
-  Z_STRLEN_P(data.xmlrpc_method) + 1, 
-  (void**)php_function) == SUCCESS) {
-
-   data.php_function = *php_function;
-   }
-
/* We could just call the php method directly ourselves 
at this
point, but we do this 
 * with a C callback in case the xmlrpc library ever 
implements
some cool usage stats,
 * or somesuch.
 */
+   XMLRPC_VALUE xAnswer = NULL;
xAnswer = XMLRPC_ServerCallMethod(server

#27446 [Com]: [PATCH] system.multiCall does not work

2009-02-26 Thread kawai at apache dot org
 ID:   27446
 Comment by:   kawai at apache dot org
 Reported By:  tomy at envox dot hr
 Status:   No Feedback
 Bug Type: XMLRPC-EPI related
 Operating System: *
 PHP Version:  5CVS, 6CVS (2008-07-21)
 New Comment:

Please reopen this ticket.


Previous Comments:


[2009-02-27 07:25:35] kawai at apache dot org

I downloaded php5.2-200902270530, and tested. This issue was not 
fixed.



[2009-02-17 01:00:00] php-bugs at lists dot php dot net

No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to Open.



[2009-02-09 14:37:00] il...@php.net

Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/





[2008-05-28 05:53:13] kawai at apache dot org

Now, you can download patched version of xmlrpc extension from:
http://mp.i-revo.jp/user.php/kcvcrlkq/entry/309.html

I hope this patch to be applied in the next PHP release.



[2008-05-02 13:52:41] kawai at apache dot org

I also hit this bug in my own server. I analyzed the bug, and created a
patch for this:


--- php-5.2.6/ext/xmlrpc/xmlrpc-epi-php.c   Mon Dec 31 16:20:14 2007
+++ xmlrpc-epi-php.cFri May  2 22:41:30 2008
@@ -859,6 +859,20 @@
zval* callback_params[3];
TSRMLS_FETCH();

+   const char* methodname = XMLRPC_RequestGetMethodName(xRequest);
+   zval **php_function;
+   if (!methodname) { methodname = ; }
+   Z_STRVAL_P(pData-xmlrpc_method) = estrdup(methodname);
+   Z_STRLEN_P(pData-xmlrpc_method) = strlen(methodname);
+   Z_TYPE_P(pData-xmlrpc_method) = IS_STRING;
+   pData-php_executed = 0;
+   if(zend_hash_find(Z_ARRVAL_P(pData-server-method_map),
+  Z_STRVAL_P(pData-xmlrpc_method), 
+  Z_STRLEN_P(pData-xmlrpc_method) + 1, 
+  (void**)php_function) == SUCCESS) {
+   pData-php_function = *php_function;
+   }
+   
/* convert xmlrpc to native php types */
xmlrpc_params = XMLRPC_to_PHP(XMLRPC_RequestGetData(xRequest));
 
@@ -876,7 +890,7 @@
 
zval_ptr_dtor(xmlrpc_params);
 
-   return NULL;
+   return PHP_to_XMLRPC(pData-return_data TSRMLS_CC);
 }
 
 /* called by the C server when it first receives an introspection
request.  We pass this on to
@@ -1017,7 +1031,6 @@
Parses XML requests and call methods */
 PHP_FUNCTION(xmlrpc_server_call_method)
 {
-   xmlrpc_callback_data data = {0};
XMLRPC_REQUEST xRequest;
STRUCT_XMLRPC_REQUEST_INPUT_OPTIONS input_opts;
xmlrpc_server_data* server;
@@ -1048,8 +1061,8 @@
 
if(xRequest) {
const char* methodname = 
XMLRPC_RequestGetMethodName(xRequest);
-   zval **php_function;
-   XMLRPC_VALUE xAnswer = NULL;
+   
+   xmlrpc_callback_data data = {0};
MAKE_STD_ZVAL(data.xmlrpc_method); /* init. very 
important.  spent
a frustrating day finding this out. */
MAKE_STD_ZVAL(data.return_data);
Z_TYPE_P(data.return_data) = IS_NULL;  /* in case value 
is never
init'd, we don't dtor to think it is a string or something */
@@ -1060,26 +1073,15 @@
}
 
/* setup some data to pass to the callback function */
-   Z_STRVAL_P(data.xmlrpc_method) = estrdup(methodname);
-   Z_STRLEN_P(data.xmlrpc_method) = strlen(methodname);
-   Z_TYPE_P(data.xmlrpc_method) = IS_STRING;
data.caller_params = *caller_params;
data.php_executed = 0;
data.server = server;
 
-   /* check if the called method has been previous 
registered */
-   if(zend_hash_find(Z_ARRVAL_P(server-method_map),
-  Z_STRVAL_P(data.xmlrpc_method), 
-  Z_STRLEN_P(data.xmlrpc_method) + 1, 
-  (void**)php_function) == SUCCESS) {
-
-   data.php_function = *php_function;
-   }
-
/* We could just call the php method directly ourselves 
at this
point, but we do this 
 * with a C callback in case the xmlrpc library ever 
implements
some cool usage stats,
 * or somesuch

#44996 [Com]: xmlrpc_decode ignores time zone on iso8601.datetime

2009-01-09 Thread kawai at apache dot org
 ID:   44996
 Comment by:   kawai at apache dot org
 Reported By:  helixpip at gmail dot com
 Status:   Open
 Bug Type: XMLRPC-EPI related
 Operating System: Windows 2000
 PHP Version:  5.2.7
 New Comment:

Following is a patch for timezone problem.

The patch will fix the bug even if xmlrpc-epi did not parse timezone 
correctly. xmlrpc-epi should be patched as 
http://sourceforge.net/tracker2/?
func=detailaid=2495315group_id=23199atid=377730.

--- ext/xmlrpc/xmlrpc-epi-php.c.orig2008-07-19 02:34:07.0 
+0900
+++ ext/xmlrpc/xmlrpc-epi-php.c 2009-01-10 03:39:19.0 +0900
@@ -1300,7 +1300,7 @@
if(newtype == xmlrpc_datetime) {
XMLRPC_VALUE v = 
XMLRPC_CreateValueDateTime_ISO8601(NULL, value-value.str.val);
if(v) {
-   time_t timestamp = 
XMLRPC_GetValueDateTime(v);
+   time_t timestamp = 
(time_t)php_parse_date(XMLRPC_GetValueDateTime_ISO8601(v), NULL);
if(timestamp) {
zval* ztimestamp;


Previous Comments:


[2008-12-05 17:01:43] helixpip at gmail dot com

Just tested with 5.2.7.  The behavior has changed, but it's still not
working correctly.  The 'scalar' property now returns the original text
of the string passed in the dateTime.iso8601 tags, which is good.  The
conversion of this string to a timestamp that is stored in the
'timestamp' property still appears to be ignoring the timezone
designator, however.  Previously, it ignored the timezone designator and
assumed local time.  Now, it appears to ignore the timezone designator
and assume Zulu time.  Strtotime() still gives the correct timestamp in
all cases.  Results of tests:

ISO 8601 datetime 20010909T01:46:40Z
strtotime yields 10
xmlrpc_decode
yields stdClass Object
(
[scalar] = 20010909T01:46:40Z
[xmlrpc_type] = datetime
[timestamp] = 10
)

ISO 8601 datetime 20010909T00:46:40-01
strtotime yields 10
xmlrpc_decode
yields stdClass Object
(
[scalar] = 20010909T00:46:40-01
[xmlrpc_type] = datetime
[timestamp] = 96400
)

ISO 8601 datetime 2001-09-09T08:46:40+07:00
strtotime yields 10
xmlrpc_decode
yields stdClass Object
(
[scalar] = 2001-09-09T08:46:40+07:00
[xmlrpc_type] = datetime
[timestamp] = 125200
)

ISO 8601 datetime 2001-09-08T21:46:40-0400
strtotime yields 10
xmlrpc_decode
yields stdClass Object
(
[scalar] = 2001-09-08T21:46:40-0400
[xmlrpc_type] = datetime
[timestamp] = 85600
)



[2008-10-24 16:00:17] j...@php.net

Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/

IIRC, this was fixed..



[2008-06-05 05:28:57] kawai at apache dot org

Now, you can download patched version of xmlrpc extension from:
http://mp.i-revo.jp/user.php/kcvcrlkq/entry/313.html

I hope this patch to be applied in the next PHP release.



[2008-05-14 18:14:24] helixpip at gmail dot com

I wrote:
Ideally the scalar property should explicitly be 
a UTC ISO 8601 datetime value, ending with the 
time zone designator 'Z'.

On second thought, it might be more useful for a php script to know
what, if any, time zone designator appeared with the original iso8601
datetime value. (At the moment there's no way to find this information
without parsing the xml.) If the scalar property preserved the original
time zone designator, that would help with this.



[2008-05-14 17:47:07] helixpip at gmail dot com

Description:

The xmlrpc_decode function does not correctly interpret ISO 8601
timezone designations when interpreting XML-RPC datetime values passed
in dateTime.iso8601 tags.  It appears that the time zone designator is
completely ignored and the local time zone is assumed.  (The
xmlrpc_decode_request function shows the same behavior.)

A side effect of this bug is that the 'scalar' and 'timestamp' objects
returned for XML-RPC datetime values will disagree if the object is used
is used in a different time zone than it was created.  Ideally the
scalar property should explicitly be a UTC ISO 8601 datetime value,
ending with the time zone designator 'Z'.

Reproduce code:
---
function DecodeDatetime($datetime) {
  print \nISO 8601 datetime $datetime\n;
  print strtotime yields  . strtotime($datetime) . \nxmlrpc_decode
yields ;
  $obj = xmlrpc_decode(?xml
version=\1.0

#45187 [Com]: xmlrpc_encode_request should encode DateTime objects as datetime values

2008-06-16 Thread kawai at apache dot org
 ID:   45187
 Comment by:   kawai at apache dot org
 Reported By:  pickscrape at gmail dot com
 Status:   Open
 Bug Type: XMLRPC-EPI related
 Operating System: Linux
 PHP Version:  5.2.6
 New Comment:

IMHO, this is not a bug but may be a feature request.

By the way, if we're going to support DateTime class object, 
how do you think what the result of xmlrpc_decode_request 
should be look like (keeping backword compatibility, of cource)?


Previous Comments:


[2008-06-14 16:45:37] pickscrape at gmail dot com

Yes, that's kinda the point to this bug report.

When xmlrpc_encode_request walks the parameters array (recursively),
any DateTime objects it encounters should be encoded as XMLRPC datetime
parameters (exactly like your snippet and the latter half of my example
demonstrate) transparently.

In other words, I'd expect the output from the first part of my script
to be identical to the output from the second.



[2008-06-14 12:59:49] kawai at apache dot org

There is no statement that we can use DateTime object for 
passing to an xmlrpc function, and actually, we can't use it.
It is a limitation of current implementation of xmlrpc extension.
However, I think we MAY support DateTime object in xmlrpc extension.

Current xmlrpc extension allows you to create xmlrpc datetime 
value from an ISO-8601 format string. So you can code like this:

?php
$obj=new DateTime();
$datetime=$obj-format(DATE_ISO8601);
xmlrpc_set_type($datetime,'datetime');
var_dump(xmlrpc_encode_request('x',$datetime));
?



[2008-06-12 17:50:28] pickscrape at gmail dot com

This script reproduces it. Interestingly, this script also causes a
stack smash to happen for me on Ubuntu, for which I have raised a
separate bug (launchpad 239513). It runs fine under gentoo though and
reproduces this bug properly.

?php
$params = array(new DateTime());

print_r($params);

echo This is useless:\n;

print_r(xmlrpc_encode_request('x', $params));

echo \nThis is what I would expect to happen automatically:\n;

$params2 = array(new DateTime());

$params2[0] = $params2[0]-format(DATE_ISO8601);
xmlrpc_set_type($params2[0], 'datetime');

print_r(xmlrpc_encode_request('x', $params2));
?



[2008-06-11 22:02:11] [EMAIL PROTECTED]

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with ?php and ends with ?,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.





[2008-06-09 06:06:44] kawai at apache dot org

Please show a code that reproduces the problem.



The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/45187

-- 
Edit this bug report at http://bugs.php.net/?id=45187edit=1



#45187 [Com]: xmlrpc_encode_request should encode DateTime objects as datetime values

2008-06-14 Thread kawai at apache dot org
 ID:   45187
 Comment by:   kawai at apache dot org
 Reported By:  pickscrape at gmail dot com
 Status:   Open
 Bug Type: XMLRPC-EPI related
 Operating System: Linux
 PHP Version:  5.2.6
 New Comment:

There is no statement that we can use DateTime object for 
passing to an xmlrpc function, and actually, we can't use it.
It is a limitation of current implementation of xmlrpc extension.
However, I think we MAY support DateTime object in xmlrpc extension.

Current xmlrpc extension allows you to create xmlrpc datetime 
value from an ISO-8601 format string. So you can code like this:

?php
$obj=new DateTime();
$datetime=$obj-format(DATE_ISO8601);
xmlrpc_set_type($datetime,'datetime');
var_dump(xmlrpc_encode_request('x',$datetime));
?


Previous Comments:


[2008-06-12 17:50:28] pickscrape at gmail dot com

This script reproduces it. Interestingly, this script also causes a
stack smash to happen for me on Ubuntu, for which I have raised a
separate bug (launchpad 239513). It runs fine under gentoo though and
reproduces this bug properly.

?php
$params = array(new DateTime());

print_r($params);

echo This is useless:\n;

print_r(xmlrpc_encode_request('x', $params));

echo \nThis is what I would expect to happen automatically:\n;

$params2 = array(new DateTime());

$params2[0] = $params2[0]-format(DATE_ISO8601);
xmlrpc_set_type($params2[0], 'datetime');

print_r(xmlrpc_encode_request('x', $params2));
?



[2008-06-11 22:02:11] [EMAIL PROTECTED]

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with ?php and ends with ?,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.





[2008-06-09 06:06:44] kawai at apache dot org

Please show a code that reproduces the problem.



[2008-06-05 14:14:42] pickscrape at gmail dot com

Description:

When encoding parameters to XML-RPC object of type DateTime should be
converted into the standard XMLRPC date format instead of the empty
array that they are currently converted as.






-- 
Edit this bug report at http://bugs.php.net/?id=45187edit=1



#45187 [Com]: xmlrpc_encode_request should encode DateTime objects as datetime values

2008-06-09 Thread kawai at apache dot org
 ID:   45187
 Comment by:   kawai at apache dot org
 Reported By:  pickscrape at gmail dot com
 Status:   Open
 Bug Type: XMLRPC-EPI related
 Operating System: Linux
 PHP Version:  5.2.6
 New Comment:

Please show a code that reproduces the problem.


Previous Comments:


[2008-06-05 14:14:42] pickscrape at gmail dot com

Description:

When encoding parameters to XML-RPC object of type DateTime should be
converted into the standard XMLRPC date format instead of the empty
array that they are currently converted as.






-- 
Edit this bug report at http://bugs.php.net/?id=45187edit=1



#44996 [Com]: xmlrpc_decode ignores time zone on iso8601.datetime

2008-06-04 Thread kawai at apache dot org
 ID:   44996
 Comment by:   kawai at apache dot org
 Reported By:  helixpip at gmail dot com
 Status:   Open
 Bug Type: XMLRPC-EPI related
 Operating System: Windows 2000
 PHP Version:  5.2.6
 New Comment:

Now, you can download patched version of xmlrpc extension from:
http://mp.i-revo.jp/user.php/kcvcrlkq/entry/313.html

I hope this patch to be applied in the next PHP release.


Previous Comments:


[2008-05-14 18:14:24] helixpip at gmail dot com

I wrote:
Ideally the scalar property should explicitly be 
a UTC ISO 8601 datetime value, ending with the 
time zone designator 'Z'.

On second thought, it might be more useful for a php script to know
what, if any, time zone designator appeared with the original iso8601
datetime value. (At the moment there's no way to find this information
without parsing the xml.) If the scalar property preserved the original
time zone designator, that would help with this.



[2008-05-14 17:47:07] helixpip at gmail dot com

Description:

The xmlrpc_decode function does not correctly interpret ISO 8601
timezone designations when interpreting XML-RPC datetime values passed
in dateTime.iso8601 tags.  It appears that the time zone designator is
completely ignored and the local time zone is assumed.  (The
xmlrpc_decode_request function shows the same behavior.)

A side effect of this bug is that the 'scalar' and 'timestamp' objects
returned for XML-RPC datetime values will disagree if the object is used
is used in a different time zone than it was created.  Ideally the
scalar property should explicitly be a UTC ISO 8601 datetime value,
ending with the time zone designator 'Z'.

Reproduce code:
---
function DecodeDatetime($datetime) {
  print \nISO 8601 datetime $datetime\n;
  print strtotime yields  . strtotime($datetime) . \nxmlrpc_decode
yields ;
  $obj = xmlrpc_decode(?xml
version=\1.0\?methodResponseparamsparamvaluedateTime.iso8601$datetime/dateTime.iso8601/value/param/params/methodResponse);
  print_r($obj);
}

DecodeDatetime(20010909T01:46:40Z);
DecodeDatetime(20010909T00:46:40-01);
DecodeDatetime(2001-09-09T08:46:40+07:00);
DecodeDatetime(2001-09-08T21:46:40-0400);

Expected result:

The ISO 8601 datetime strings tested above are all valid and equivalent
  They all represent the same timestamp as the unix time 10, and
strtotime() function converts them all correctly.  I would expect that
the object returned by xml_rpc decode should, in all four test cases,
have the timestamp property = 10 and have the scalar property as
a string that would convert to 10 if fed to strtotime().

Actual result:
--
The xmlrpc_decode function gets them all wrong except for the last one,
which happens to have the same time zone as my test system:

ISO 8601 datetime 20010909T01:46:40Z
strtotime yields 10
xmlrpc_decode yields stdClass Object
(
[scalar] = 20010909T01:46:40
[xmlrpc_type] = datetime
[timestamp] = 114400
)

ISO 8601 datetime 20010909T00:46:40-01
strtotime yields 10
xmlrpc_decode yields stdClass Object
(
[scalar] = 20010909T00:46:40
[xmlrpc_type] = datetime
[timestamp] = 110800
)

ISO 8601 datetime 2001-09-09T08:46:40+07:00
strtotime yields 10
xmlrpc_decode yields stdClass Object
(
[scalar] = 20010909T08:46:40
[xmlrpc_type] = datetime
[timestamp] = 139600
)

ISO 8601 datetime 2001-09-08T21:46:40-0400
strtotime yields 10
xmlrpc_decode yields stdClass Object
(
[scalar] = 20010908T21:46:40
[xmlrpc_type] = datetime
[timestamp] = 10
)





-- 
Edit this bug report at http://bugs.php.net/?id=44996edit=1



#27446 [Com]: system.multiCall does not work

2008-05-27 Thread kawai at apache dot org
 ID:   27446
 Comment by:   kawai at apache dot org
 Reported By:  tomy at envox dot hr
 Status:   Verified
 Bug Type: XMLRPC-EPI related
 Operating System: *
 PHP Version:  5CVS, 4CVS (2004-03-01)
 New Comment:

Now, you can download patched version of xmlrpc extension from:
http://mp.i-revo.jp/user.php/kcvcrlkq/entry/309.html

I hope this patch to be applied in the next PHP release.


Previous Comments:


[2008-05-02 13:52:41] kawai at apache dot org

I also hit this bug in my own server. I analyzed the bug, and created a
patch for this:


--- php-5.2.6/ext/xmlrpc/xmlrpc-epi-php.c   Mon Dec 31 16:20:14 2007
+++ xmlrpc-epi-php.cFri May  2 22:41:30 2008
@@ -859,6 +859,20 @@
zval* callback_params[3];
TSRMLS_FETCH();

+   const char* methodname = XMLRPC_RequestGetMethodName(xRequest);
+   zval **php_function;
+   if (!methodname) { methodname = ; }
+   Z_STRVAL_P(pData-xmlrpc_method) = estrdup(methodname);
+   Z_STRLEN_P(pData-xmlrpc_method) = strlen(methodname);
+   Z_TYPE_P(pData-xmlrpc_method) = IS_STRING;
+   pData-php_executed = 0;
+   if(zend_hash_find(Z_ARRVAL_P(pData-server-method_map),
+  Z_STRVAL_P(pData-xmlrpc_method), 
+  Z_STRLEN_P(pData-xmlrpc_method) + 1, 
+  (void**)php_function) == SUCCESS) {
+   pData-php_function = *php_function;
+   }
+   
/* convert xmlrpc to native php types */
xmlrpc_params = XMLRPC_to_PHP(XMLRPC_RequestGetData(xRequest));
 
@@ -876,7 +890,7 @@
 
zval_ptr_dtor(xmlrpc_params);
 
-   return NULL;
+   return PHP_to_XMLRPC(pData-return_data TSRMLS_CC);
 }
 
 /* called by the C server when it first receives an introspection
request.  We pass this on to
@@ -1017,7 +1031,6 @@
Parses XML requests and call methods */
 PHP_FUNCTION(xmlrpc_server_call_method)
 {
-   xmlrpc_callback_data data = {0};
XMLRPC_REQUEST xRequest;
STRUCT_XMLRPC_REQUEST_INPUT_OPTIONS input_opts;
xmlrpc_server_data* server;
@@ -1048,8 +1061,8 @@
 
if(xRequest) {
const char* methodname = 
XMLRPC_RequestGetMethodName(xRequest);
-   zval **php_function;
-   XMLRPC_VALUE xAnswer = NULL;
+   
+   xmlrpc_callback_data data = {0};
MAKE_STD_ZVAL(data.xmlrpc_method); /* init. very 
important.  spent
a frustrating day finding this out. */
MAKE_STD_ZVAL(data.return_data);
Z_TYPE_P(data.return_data) = IS_NULL;  /* in case value 
is never
init'd, we don't dtor to think it is a string or something */
@@ -1060,26 +1073,15 @@
}
 
/* setup some data to pass to the callback function */
-   Z_STRVAL_P(data.xmlrpc_method) = estrdup(methodname);
-   Z_STRLEN_P(data.xmlrpc_method) = strlen(methodname);
-   Z_TYPE_P(data.xmlrpc_method) = IS_STRING;
data.caller_params = *caller_params;
data.php_executed = 0;
data.server = server;
 
-   /* check if the called method has been previous 
registered */
-   if(zend_hash_find(Z_ARRVAL_P(server-method_map),
-  Z_STRVAL_P(data.xmlrpc_method), 
-  Z_STRLEN_P(data.xmlrpc_method) + 1, 
-  (void**)php_function) == SUCCESS) {
-
-   data.php_function = *php_function;
-   }
-
/* We could just call the php method directly ourselves 
at this
point, but we do this 
 * with a C callback in case the xmlrpc library ever 
implements
some cool usage stats,
 * or somesuch.
 */
+   XMLRPC_VALUE xAnswer = NULL;
xAnswer = XMLRPC_ServerCallMethod(server-server_ptr, 
xRequest,
data);
if(xAnswer  out.b_php_out) {
zval_dtor(data.return_data);
@@ -1086,7 +1088,9 @@
FREE_ZVAL(data.return_data);
data.return_data = XMLRPC_to_PHP(xAnswer);
} else if(data.php_executed  !out.b_php_out) {
-   xAnswer = PHP_to_XMLRPC(data.return_data 
TSRMLS_CC);
+   if(!xAnswer){
+   xAnswer = 
PHP_to_XMLRPC(data.return_data TSRMLS_CC);
+   }
}
 
/* should we return data as xml? */



[2004-03-15

#27446 [Com]: system.multiCall does not work

2008-05-02 Thread kawai at apache dot org
 ID:   27446
 Comment by:   kawai at apache dot org
 Reported By:  tomy at envox dot hr
 Status:   Verified
 Bug Type: XMLRPC-EPI related
 Operating System: *
 PHP Version:  5CVS, 4CVS (2004-03-01)
 New Comment:

I also hit this bug in my own server. I analyzed the bug, and created a
patch for this:


--- php-5.2.6/ext/xmlrpc/xmlrpc-epi-php.c   Mon Dec 31 16:20:14 2007
+++ xmlrpc-epi-php.cFri May  2 22:41:30 2008
@@ -859,6 +859,20 @@
zval* callback_params[3];
TSRMLS_FETCH();

+   const char* methodname = XMLRPC_RequestGetMethodName(xRequest);
+   zval **php_function;
+   if (!methodname) { methodname = ; }
+   Z_STRVAL_P(pData-xmlrpc_method) = estrdup(methodname);
+   Z_STRLEN_P(pData-xmlrpc_method) = strlen(methodname);
+   Z_TYPE_P(pData-xmlrpc_method) = IS_STRING;
+   pData-php_executed = 0;
+   if(zend_hash_find(Z_ARRVAL_P(pData-server-method_map),
+  Z_STRVAL_P(pData-xmlrpc_method), 
+  Z_STRLEN_P(pData-xmlrpc_method) + 1, 
+  (void**)php_function) == SUCCESS) {
+   pData-php_function = *php_function;
+   }
+   
/* convert xmlrpc to native php types */
xmlrpc_params = XMLRPC_to_PHP(XMLRPC_RequestGetData(xRequest));
 
@@ -876,7 +890,7 @@
 
zval_ptr_dtor(xmlrpc_params);
 
-   return NULL;
+   return PHP_to_XMLRPC(pData-return_data TSRMLS_CC);
 }
 
 /* called by the C server when it first receives an introspection
request.  We pass this on to
@@ -1017,7 +1031,6 @@
Parses XML requests and call methods */
 PHP_FUNCTION(xmlrpc_server_call_method)
 {
-   xmlrpc_callback_data data = {0};
XMLRPC_REQUEST xRequest;
STRUCT_XMLRPC_REQUEST_INPUT_OPTIONS input_opts;
xmlrpc_server_data* server;
@@ -1048,8 +1061,8 @@
 
if(xRequest) {
const char* methodname = 
XMLRPC_RequestGetMethodName(xRequest);
-   zval **php_function;
-   XMLRPC_VALUE xAnswer = NULL;
+   
+   xmlrpc_callback_data data = {0};
MAKE_STD_ZVAL(data.xmlrpc_method); /* init. very 
important.  spent
a frustrating day finding this out. */
MAKE_STD_ZVAL(data.return_data);
Z_TYPE_P(data.return_data) = IS_NULL;  /* in case value 
is never
init'd, we don't dtor to think it is a string or something */
@@ -1060,26 +1073,15 @@
}
 
/* setup some data to pass to the callback function */
-   Z_STRVAL_P(data.xmlrpc_method) = estrdup(methodname);
-   Z_STRLEN_P(data.xmlrpc_method) = strlen(methodname);
-   Z_TYPE_P(data.xmlrpc_method) = IS_STRING;
data.caller_params = *caller_params;
data.php_executed = 0;
data.server = server;
 
-   /* check if the called method has been previous 
registered */
-   if(zend_hash_find(Z_ARRVAL_P(server-method_map),
-  Z_STRVAL_P(data.xmlrpc_method), 
-  Z_STRLEN_P(data.xmlrpc_method) + 1, 
-  (void**)php_function) == SUCCESS) {
-
-   data.php_function = *php_function;
-   }
-
/* We could just call the php method directly ourselves 
at this
point, but we do this 
 * with a C callback in case the xmlrpc library ever 
implements
some cool usage stats,
 * or somesuch.
 */
+   XMLRPC_VALUE xAnswer = NULL;
xAnswer = XMLRPC_ServerCallMethod(server-server_ptr, 
xRequest,
data);
if(xAnswer  out.b_php_out) {
zval_dtor(data.return_data);
@@ -1086,7 +1088,9 @@
FREE_ZVAL(data.return_data);
data.return_data = XMLRPC_to_PHP(xAnswer);
} else if(data.php_executed  !out.b_php_out) {
-   xAnswer = PHP_to_XMLRPC(data.return_data 
TSRMLS_CC);
+   if(!xAnswer){
+   xAnswer = 
PHP_to_XMLRPC(data.return_data TSRMLS_CC);
+   }
}
 
/* should we return data as xml? */


Previous Comments:


[2004-03-15 23:35:42] [EMAIL PROTECTED]

It crashes, here's the backtrace with latest CVS checkout:

0x404b9e8c in call_user_function_ex (function_table=0x80b8868,
object_pp=0x0, function_name=0x0,
retval_ptr_ptr=0xbfffc954, param_count=3, params=0x8218104,
no_separation=1, symbol_table=0x0)
at /usr