#45915 [NEW]: xmlrpc_encode_request does not encode numeric keys properly

[email protected] ("matt at waggoner dot com")
Newsgroups php.bugs
Message-ID <[email protected]>
From:             matt at waggoner dot com
Operating system: All
PHP version:      5.2.6
PHP Bug Type:     XMLRPC-EPI related
Bug description:  xmlrpc_encode_request does not encode numeric keys properly

Description:
------------
This issue has been marked as bogus or wontfix before, but I believe this
is a bad idea and that this issue should be fixed.

Bug #21949 ends with this comment:

"Not a bug, XML-RPC is ambigous as to the value that the <name> field can
contain.  However, all indications point to it being a string value, in XML
this represents a value that is non-numeric."

This is false; XML's string type is not restricted to "non-numeric"
values.  http://www.w3.org/TR/xmlschema-2/#string says that a string's
value space is "the set of finite-length sequences of characters (as
defined in [XML 1.0 (Second Edition)]) that match the Char production". 
The "Char production" is the following grammar:

char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] |
[#x10000-#x10FFFF]

The characters 0-9 are within the [#x20-#xD7FF] range, ergo the string XML
datatype can validly contain a set of only numeric characters such as
"123", which eliminates that objection.

The XML-RPC spec does indeed not specify what value a <name> element may
contain, but it seems fairly useless to simply drop numeric keys; a string
is a string regardless of whether it contains letters or not.  

Re bug #37746: "It has been this way for a long time" is not a valid
reason to avoid fixing this (see any number of longstanding bugs in PHP's
history); "this might break existing code" is also not a valid reason (see
any number of backward-incompatible changes in PHP's history).

Please fix this bug.

Reproduce code:
---------------
See bugs #21949 and #37746.


-- 
Edit bug report at http://bugs.php.net/?id=45915&edit=1
-- 
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45915&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45915&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45915&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=45915&r=fixedcvs
Fixed in release:             http://bugs.php.net/fix.php?id=45915&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=45915&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=45915&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=45915&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=45915&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=45915&r=notwrong
Not enough info:              http://bugs.php.net/fix.php?id=45915&r=notenoughinfo
Submitted twice:              http://bugs.php.net/fix.php?id=45915&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=45915&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=45915&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=45915&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=45915&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=45915&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=45915&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=45915&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=45915&r=mysqlcfg
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.