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] [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? */

------------------------------------------------------------------------

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

Reply via email to