Xmlrpc problem: Call-time pass-by-reference has been deprecated

Hi all,

Firstly, forgive me here if I’m doing anything dumb because I’m just taking my first, faltering steps with xmlrpc…

I’ve just tried taking Harry Fuecks’ article for a spin:

Build your own Web Service with PHP and XML-RPC

…but when I went to run the client.php script, this is what I got in return:

Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of xml_parse_into_struct(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer. in /home/itomicc/public_html/kd_xmlrpc/kd_xmlrpc.php on line 136

I can’t say that any of the above makes much sense to me at this stage.

Here’s the link to the script on my site (can’t promise it will stay here forever):

http://www.itomic.com/kd_xmlrpc/client.php

I thought to myself that it must be some old code somewhere in there which is stuffing this up. Rather than try to debug it (coward that I am), I thought I’d cut to the chase and download xmlrpc direct from sourceforge and see if their client.php fares any better. Answer: nope!

http://www.itomic.com/xmlrpc/client.php

Same error again.

OK, so I might be completely out of my depth here, but can anyone put me back on course by, perhaps, suggesting how I should modify the fsockopen() declaration?

It’s always a bit frustrating when ones first experience of a ‘new’ technology is in trying to get it to work at all, as opposed to having a simple example up and running in no time, giving me the confidence to play around with it a bit to see how/why it does work.

Thanks. :slight_smile:

Reckon the problem is in you’re PHP configuration. Look for the following in php.ini

allow_call_time_pass_reference = Off

This needs to be ‘On’

You’ll be be able to see it using the phpinfo() function, if the server isn’t yours. You should be able to switch it on with a .htaccess file containing;


php_flag allow_call_time_pass_reference On

Any more problems, say the word - if you can post a link to a script with phpinfo that would help.

Doh!

I should try reading and comprehending the error messages in my face.

Thanks Harry. And I just noticed that the client.php script in Kev’s article is yours :slight_smile:

OK, so we’re over that hurdle (I used the .htaccess method even though the server is ours).

Now I’m getting this error:

Warning: Variable passed to each() is not an array or object in /home/itomicc/public_html/kd_xmlrpc/client.php on line 83

Strange, because the code in client.php looks like this:


...
79 /* On success, display the list as HTML table */
80 if ($success) {
81  echo ( "<table align=\\"center\\" width=\\"600\\">\
" );
82  $count = 0;
83  while ( list ( $key, $val ) = each ( $response ) ) {
...
?>

So the $success flag is good (implying a good response from server.php I assume), but no data in the form of an array is being supplied to $response.

I can confirm that the table kd_xmlrpc_news definitely exists and is populated exactly as per the script supplied in the article's zip file: kd_xmlrpc_new.sql.

Any suggestions, Harry? If I knew more about xmlrpc then I'd probably feel more confident debugging it myself, so I'm guilt of hoping that you (or anyone else) can save me hours of mucking around.

Thanks :)

My guess there is the following settings mak not be correct in client.php;


$site = "www.itomic.com";
$location = "/kd_xmlrpc/server.php";

One thing you can do to help yourself is switching on the debugging in the client, so you can see what the server is doing.

Place the following at the top of the script;


/* Include the library */
include ( "kd_xmlrpc.php" );

define("XMLRPC_DEBUG", 1);

Then somewhere at the end;


XMLRPC_debug_print();

That should help you see what’s going on.

Hey i had the same problem … if anyone else has it scroll down for the solution:

On page web_service_api.php and on line 7,8 and 9 put the function name in ’ ’

$xmlrpc_methods[‘news.getNewsList’] = ‘news_getNewsList’;
$xmlrpc_methods[‘news.viewNewsItem’] = ‘news_viewNewsItem’;
$xmlrpc_methods[‘method_not_found’] = ‘XMLRPC_method_not_found’;

Hey Kevin Yank,

How about adjusting your splendid article mentioned above?

Here the missing quotes mentioned by Sumaiya are still missing:

$xmlrpc_methods[‘news.getNewsList’] = news_getNewsList;
$xmlrpc_methods[‘news.viewNewsItem’] = news_viewNewsItem;
$xmlrpc_methods[‘method_not_found’] = XMLRPC_method_not_found;

Cheerio, Willem