RE: Difference between Trim($HTTP_POST_VARS["sh"]) and scalarval()

"Gaetano Giunta" <[email protected]>
Newsgroups gmane.text.xml.rpc.specification
Message-ID <[email protected]>
I might be missing the point, since the description is somewhat confused, but...

$p = new xmlrpcval(Trim($HTTP_POST_VARS["sh"]), $xmlrpcInt)

will create an xmlrpcval of type int.
This means than when calling $p->serialize(), an <int> tag will be used.
The library does NOT coerce the php value passed to it to INT type, but it leaves it untouched.
This means that if Trim($HTTP_POST_VARS["sh"] is not an integer, it will be printed as it is anyway.

In the latest release of the library, only avalibale in CVS (but soon it will be posted as 2.0RC3), this has been cahnged:
$p->scalarval() will still return the original value you pass to it
$p->serialize() will coerce the value to an ineteger before creating the xml (ie '0000' will return <int>0</int>, and 'hello' will return 0 as well).

You should also take care about your code using leading zeroes...

Hope it helps
Gaetano

> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]]On Behalf
> Of erasmus_joshi
> Sent: Tuesday, January 10, 2006 1:26 PM
> To: [email protected]
> Subject: [xml-rpc] Difference between Trim($HTTP_POST_VARS["sh"]) and
> scalarval()
> 
> 
> Hello, 
> 
> I have a - maybe - really stupid question but I am new to this topic
> and don't find a way to solve it myself.
> 
> There is an existing xmlrpc client that works perfectly. I want to
> adopt this client to Typo3 and the xmlrpc communications also works
> really good. But I have on big problem with the following thing: 
> 
> The communication is step by step. First I have to connect to the
> server. This works perfect. This Server respones with an SessionID
> with a length of 10 numbers. And that is the point. I have to use this
> number as parameter in all methods. 
> 
> The new and the old code are only unequal in the type calling the
> methods. The working version is reading the variable by
> $HTTP_POST_VARS["sh"]. I use the result of the response scalarval..
> 
> ----snip----
> if ($v = rpc_call($c, $f)) {
> 			echo "Login () returns: 
> ",$v->scalarval(),"<br>";
> 			$sh = $v->scalarval();
> 
> 	$f= new xmlrpcmsg('sdb.Logout');
> 		$f->addParam(new 
> xmlrpcval(Trim($HTTP_POST_VARS["sh"]), $xmlrpcInt));
> 
> --- snap ----
> 
> The point I don't get is that in the method createPayload the 
> 		->echo
> "Payload -> param -> serialize size = " . strlen($p->serialize()).
> "<br>";<--
> serialize value send as parameter via $HTTP_POST_VARS has a strlen
> that is 6 shorter than the parameter send by scalarval. 
> 
> Could this be a problem with encoding or has someone a idea what I am
> doing wrong?
> 
> Sorry for the bad description.. but somehow I am really confused at
> the moment and hope someone understood what I wanted to tell. 
> 
> Thx in advance, Sascha
> 	
> 
> 
> 
> 
> 
> 
> 
>  
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 
> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/xml-rpc/

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.