[phpxmlrpc] Undefined index: ac in xmlrpc.inc
Kevin Woolley
kevin@geomantics.com
Wed, 9 Oct 2002 21:00:02 +0100
I've been developing a system using the xmlrpc libraries on linux for a
couple of weeks now, and everything is looking good on my code. However
we've a requirement to run the system under windows, so I've just spent the
last day trying to achieve this - without success.
using the standard testsuite.php in the included 1.02 distribution I see the
following error
<br />
<b>Notice</b>: Undefined index: ac in
<b>c:\inetpub\wwwroot\projects\xmlrpc\xmlrpc.inc</b> on line <b>333</b><br
/>
<br />
Which translates to this statement
$_xh[$parser]['ac'].=str_replace('$', '\$',
str_replace('"', '\"', str_replace(chr(92),
$xmlrpc_backslash, $data)));
I'm running php Version 4.2.2 installed on a windows 2000 advanced server
system. Everything else appears to run fine. The error occurs on the first
call to xmlrpc and is completely reproducable - everything I try gives the
same error even if I cut the system down to a 'bare bones' file.
Obviously the error occurs because $_xh[$parser]['ac'] is unitialized at
this point, so I tried adding code of the form
if (array_key_exists('ac',$_xh[$parser])) {
around the statement. This threw up a similar error further up the code
case "METHODNAME":
if (array_key_exists('ac',$_xh[$parser])) { // kjw
$_xh[$parser]['method']=ereg_replace("^[\n\r\t ]+", "",
$_xh[$parser]['ac']);
}
break;
which I tried adding a an if test around too. If I do this I then get
<?xml version="1.0"?>
<methodResponse>
<fault>
<value>
<struct>
<member>
<name>faultCode</name>
<value><int>1</int></value>
</member>
<member>
<name>faultString</name>
<value><string>Unknown method</string></value>
</member>
</struct>
</value>
</fault>
</methodResponse>
---END---
---EVALING---[129 chars]---
new xmlrpcval(array('faultCode' => new xmlrpcval(1, 'int'),'faultString' =>
new xmlrpcval("Unknown method", 'string')), 'struct');
---END---
Fatal error: Call to a member function on a non-object in
c:\inetpub\wwwroot\projects\xmlrpc\testsuite.php on line 33
using the standard testsuite.php code again.
I see this error seems to have been reported on several occassions further
down this board. Has anyone managed to solve it? Looks like a problem with
the xml parser to me - the results suggest the $_xh[$parser]['ac'] value
should be defined at the point where it is called so something is going
wrong with the initialization of this value.
kevin woolley
geomantics