'METHODNAME' => array('METHODCALL'),\r
'PARAMS' => array('METHODCALL', 'METHODRESPONSE'),\r
'FAULT' => array('METHODRESPONSE'),\r
- 'NIL' => array('VALUE') // only used when extension activated\r
+ 'NIL' => array('VALUE'), // only used when extension activated\r
+ 'EX:NIL' => array('VALUE') // only used when extension activated\r
);\r
\r
// define extra types for supporting NULL (useful for json or <NIL/>)\r
/// @deprecated\r
$GLOBALS['xmlrpc_backslash']=chr(92).chr(92);\r
\r
- // set to TRUE to enable correct decoding of <NIL/> values\r
+ // set to TRUE to enable correct decoding of <NIL/> and <EX:NIL/> values\r
$GLOBALS['xmlrpc_null_extension']=false;\r
\r
+ // set to TRUE to enable encoding of php NULL values to <EX:NIL/> instead of <NIL/>\r
+ $GLOBALS['xmlrpc_null_apache_encoding']=false;\r
+\r
// used to store state during parsing\r
// quick explanation of components:\r
// ac - used to accumulate values\r
$GLOBALS['_xh']['vt']=null;\r
break;\r
case 'NIL':\r
+ case 'EX:NIL':\r
if ($GLOBALS['xmlrpc_null_extension'])\r
{\r
if ($GLOBALS['_xh']['vt']!='value')\r
$GLOBALS['_xh']['method']=preg_replace('/^[\n\r\t ]+/', '', $GLOBALS['_xh']['ac']);\r
break;\r
case 'NIL':\r
+ case 'EX:NIL':\r
if ($GLOBALS['xmlrpc_null_extension'])\r
{\r
$GLOBALS['_xh']['vt']='null';\r
}\r
}\r
// be tolerant to line endings, and extra empty lines\r
- $ar = split("\r?\n", trim(substr($data, 0, $pos)));\r
+ $ar = preg_split("/\r?\n/", trim(substr($data, 0, $pos)));\r
while(list(,$line) = @each($ar))\r
{\r
// take care of multi-line headers and cookies\r
$rs.="<${typ}>".preg_replace('/\\.?0+$/','',number_format((double)$val, 128, '.', ''))."</${typ}>";\r
break;\r
case $GLOBALS['xmlrpcNull']:\r
- $rs.="<nil/>";\r
+ if ($GLOBALS['xmlrpc_null_apache_encoding'])\r
+ {\r
+ $rs.="<ex:nil/>";\r
+ }\r
+ else\r
+ {\r
+ $rs.="<nil/>";\r
+ }\r
break;\r
default:\r
// no standard type value should arrive here, but provide a possibility\r
{\r
$xmlrpc_val = new xmlrpcval('', $GLOBALS['xmlrpcString']);\r
}\r
- if (in_array('null_extension', $options))\r
+ else if (in_array('null_extension', $options))\r
{\r
$xmlrpc_val = new xmlrpcval('', $GLOBALS['xmlrpcNull']);\r
}\r