|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-03-13 12:41 UTC] camka at email dot ee
Description:
------------
xmlrpc_is_fault is supposed to accept a result returned by xmlrpc_decode.
As xmlrpc_decode can return non-array value, xmlrpc_is_fault throws a notice:
xmlrpc_is_fault() : Array argument expected
which is incorrect, as it is common to simply pass the decoded xml response directly into is_fault() function to check, whether it has been fault or not.
Reproduce code:
---------------
<?
var_dump(xmlrpc_is_fault(xmlrpc_decode('<?xml version="1.0" encoding="utf-8"?><methodResponse><params><param><value><int>2</int></value></param></params></methodResponse>', 'utf-8')));
Expected result:
----------------
bool(false)
Actual result:
--------------
Notice: PHPDocument8 line 2 - xmlrpc_is_fault()
[function.xmlrpc-is-fault]: Array argument expected
bool(false)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 01:00:02 2025 UTC |
>The function is supposed to accept only arrays by design. Than it is designed horribly and everybody, just everybody, needs to implement their own method (congrats!). And also example in documentation of xmlrpc_encode_request function (which xmlrpc_is_fault points to) should be fixed because it is like this: if ($response && xmlrpc_is_fault($response)) { trigger_error("xmlrpc: $response[faultString] ($response[faultCode])"); } else { print_r($response); } And first line just throws error for some $responses. >Actually we have simular things in many places Yes, PHP has many poorly designed functions. At least we agree on something :-D