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] [email protected] 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.c Fri 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 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/src/web/php/php4/Zend/zend_execute_API.c:445 445 if (function_name->type==IS_ARRAY) { /* assume array($obj, $name) couple */ (gdb) (gdb) bt #0 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/src/web/php/php4/Zend/zend_execute_API.c:445 #1 0x404b9d7e in call_user_function (function_table=0x80b8868, object_pp=0x0, function_name=0x0, retval_ptr=0x8219d0c, param_count=3, params=0xbfffc990) at /usr/src/web/php/php4/Zend/zend_execute_API.c:409 #2 0x404774b0 in php_xmlrpc_callback (server=0x821b008, xRequest=0x8219fa8, data=0xbfffcae0) at /usr/src/web/php/php4/ext/xmlrpc/xmlrpc-epi-php.c:882 #3 0x404800fc in XMLRPC_ServerCallMethod (server=0x821b008, request=0x8219fa8, userData=0xbfffcae0) at /usr/src/web/php/php4/ext/xmlrpc/libxmlrpc/xmlrpc.c:2522 #4 0x4047b147 in xsm_system_multicall_cb (server=0x821b008, input=0x8219f48, userData=0xbfffcae0) at /usr/src/web/php/php4/ext/xmlrpc/libxmlrpc/system_methods.c:337 #5 0x404800fc in XMLRPC_ServerCallMethod (server=0x821b008, request=0x8219f48, userData=0xbfffcae0) at /usr/src/web/php/php4/ext/xmlrpc/libxmlrpc/xmlrpc.c:2522 #6 0x40477b5d in zif_xmlrpc_server_call_method (ht=3, return_value=0x8219c0c, this_ptr=0x0, return_value_used=1) at /usr/src/web/php/php4/ext/xmlrpc/xmlrpc-epi-php.c:1103 #7 0x404d59a8 in execute (op_array=0x8214f1c) at /usr/src/web/php/php4/Zend/zend_execute.c:1621 ------------------------------------------------------------------------ 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/27446 -- Edit this bug report at http://bugs.php.net/?id=27446&edit=1
