note 56184 added to function.xmlrpc-encode

From: Date: Fri, 26 Aug 2005 08:54:32 +0000
Subject: note 56184 added to function.xmlrpc-encode
Groups: php.notes 
Request: Send a blank email to php-notes+get-94212@lists.php.net to get a copy of this message
Beware this quirk: when you xmlrpc_encode a hash into xmlrpc, numeric keys will not be kept. Even strings containing numbers-only will be lost. i.e.: xmlrpc_decode(xmlrpc_encode(array('123'=>456))); returns: array(0=>456); Apparently this is intentional functionality (see http://bugs.php.net/bug.php?id=21949) 2 workarounds: 1. prepend/append a string (even whitespace) to all keys, and strip them out at the other end. eg array('key_123'=>456); 2. create an array of hashes. array(array('key'=>123,'value'=>456)); I favour the second option because it's more deliberate. ... this also applies to xmlrpc_encode_request() ---- Manual Page -- http://www.php.net/manual/en/function.xmlrpc-encode.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+56184 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+56184&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+56184&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+56184&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+56184&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+56184&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+56184&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+56184&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#94212) next »