ID:               27446
 User updated by:  tomy at envox dot hr
 Reported By:      tomy at envox dot hr
 Status:           Verified
 Bug Type:         XMLRPC-EPI related
 Operating System: *
 PHP Version:      4CVS, 5CVS (2004-03-01)
 New Comment:

Any chance it will be fixed?

It is kind of important to me :)

Anything I can do to help?



I implemented my own multicall method

in php, but this is only a workaround. :(


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/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



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

[2004-03-01 07:56:40] tomy at envox dot hr

Description:
------------
When building xmlrpc server, system.multiCall method does not work with
my method but works with "built-in" methods such as system.listMethods
or system.methodHelp.



I have tested this on latest CVS snapshots both for PHP4 and PHP5, on
Suse 8.2.



In following example I have submitted http request sent to server whose
code is presented in "Reproduce code".

I do not get nay response and HTTP connection to server is dropped.



Calling "built-in" methods such as system.listMethods or
system.methodHelp using system.multiCall works OK.

Calling my method ("contact.select") in a straight fashion (without
system.multiCall) works OK here is request and response with headers:



POST /xmlrpc_server.php HTTP/1.0

Content-Type: text/xml

Content-Length: 317



<?xml version="1.0" encoding="utf-8"?>

<methodCall>

<methodName>contact.select</methodName>

<params>

 <param>

  <value>

   <struct>

    <member>

     <name>SESSIONID</name>

     <value>

      <string>1234567890</string>

     </value>

    </member>

   </struct>

  </value>

 </param>

</params>

</methodCall>



Response received:



replyLine: HTTP/1.1 200 OK



HEADER : Date: Mon, 01 Mar 2004 12:09:59 GMT

HEADER : Server: Apache/1.3.27 (Linux/SuSE) mod_python/2.7.8
Python/2.2.2 PHP/4.3.5RC4-dev

HEADER : X-Powered-By: PHP/4.3.5RC4-dev

HEADER : Content-Length: 375

HEADER : Connection: close

HEADER : Content-Type: text/xml



<?xml version="1.0" encoding="iso-8859-1"?>

<methodResponse>

<params>

 <param>

  <value>

   <struct>

    <member>

     <name>AUTH</name>

     <value>

      <int>1</int>

     </value>

    </member>

    <member>

     <name>SESSIONID</name>

     <value>

      <string>1234567890</string>

     </value>

    </member>

   </struct>

  </value>

 </param>

</params>

</methodResponse>





Reproduce code:
---------------
<?php

function select_contact($method_name, $params, $app_data)

{

   if (count($params) == 0 || !array_key_exists("SESSIONID",
$params[0])) {

      return array("AUTH" => 0);

   } 

   

   return array("AUTH"=>1, "SESSIONID"=>$params[0]["SESSIONID"]);

} 



$xmlrpc_server = xmlrpc_server_create();

xmlrpc_server_register_method($xmlrpc_server, "contact.select",
"select_contact");

$request_xml = $HTTP_RAW_POST_DATA;



$response = xmlrpc_server_call_method($xmlrpc_server, $request_xml,
array());

header("Content-Type: text/xml");

header("Content-Length: " . strlen($response));

print $response;

xmlrpc_server_destroy($xmlrpc_server);



?>



Expected result:
----------------
XMLRPC request sent to server:



POST /xmlrpc_server.php HTTP/1.0

Content-Type: text/xml

Content-Length: 837



<?xml version="1.0" encoding="utf-8"?>

<methodCall>

<methodName>system.multiCall</methodName>

<params>

 <param>

  <value>

   <array>

    <data>

     <value>

      <struct>

       <member>

        <name>methodName</name>

        <value>

         <string>contact.select</string>

        </value>

       </member>

       <member>

        <name>params</name>

        <value>

         <array>

          <data>

           <value>

            <struct>

             <member>

              <name>SESSIONID</name>

              <value>

               <string>1234567890</string>

              </value>

             </member>

            </struct>

           </value>

          </data>

         </array>

        </value>

       </member>

      </struct>

     </value>

    </data>

   </array>

  </value>

 </param>

</params>

</methodCall>



I would expect response like this:



replyLine: HTTP/1.1 200 OK



HEADER : Date: Mon, 01 Mar 2004 12:09:59 GMT

HEADER : Server: Apache/1.3.27 (Linux/SuSE) mod_python/2.7.8
Python/2.2.2 PHP/4.3.5RC4-dev

HEADER : X-Powered-By: PHP/4.3.5RC4-dev

HEADER : Content-Length: 694

HEADER : Connection: close

HEADER : Content-Type: text/xml



<?xml version="1.0" encoding="iso-8859-1"?>

<methodResponse>

<params>

 <param>

  <value>

   <array>

    <data>

     <value>

      <array>

       <data>

        <value>

         <struct>

          <member>

           <name>AUTH</name>

           <value>

            <int>1</int>

           </value>

          </member>

          <member>

            <name>SESSIONID</name>

            <value>

            <string>1234567890</string>

           </value>

          </member>

         </struct>

        </value>

       </data>

      </array>

     </value>

    </data>

   </array>

  </value>

 </param>

</params>

</methodResponse>



Actual result:
--------------
XMLRPC request sent to server:



POST /xmlrpc_server.php HTTP/1.0

Content-Type: text/xml

Content-Length: 837



<?xml version="1.0" encoding="utf-8"?>

<methodCall>

<methodName>system.multiCall</methodName>

<params>

 <param>

  <value>

   <array>

    <data>

     <value>

      <struct>

       <member>

        <name>methodName</name>

        <value>

         <string>contact.select</string>

        </value>

       </member>

       <member>

        <name>params</name>

        <value>

         <array>

          <data>

           <value>

            <struct>

             <member>

              <name>SESSIONID</name>

              <value>

               <string>1234567890</string>

              </value>

             </member>

            </struct>

           </value>

          </data>

         </array>

        </value>

       </member>

      </struct>

     </value>

    </data>

   </array>

  </value>

 </param>

</params>

</methodCall>



After request is sent, HTTP connection is dropped and no response is
received.


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


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

Reply via email to