#40793 [Bgs->Opn]: xmlrpc_is_fault shows warning if parameter is not an array

From: Date: Tue, 13 Mar 2007 13:41:05 +0000
Subject: #40793 [Bgs->Opn]: xmlrpc_is_fault shows warning if parameter is not an array
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-110293@lists.php.net to get a copy of this message
ID: 40793 User updated by: camka at email dot ee Reported By: camka at email dot ee -Status: Bogus +Status: Open Bug Type: XMLRPC-EPI related Operating System: windows PHP Version: 5.2.1 New Comment: Sory, but I slightly disagree. In current implementation I must implicitly check, if decoded xml response is array or not before passing it to xmlrpc_is_fault(), otherwise it gives me a notice. This is just unnecessary additional confusing check to do, which makes a code dirty and unclear. If this check would be inside is_fault function the implementation would be more incapsulated and simple for developer using xmlrpc ext. Or may be there is another way to check whether the response contains a fault or not? thank you Previous Comments: ------------------------------------------------------------------------ [2007-03-13 12:51:54] tony2001@php.net The function is supposed to accept only arrays by design. ------------------------------------------------------------------------ [2007-03-13 12:41:37] 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) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=40793&edit=1

« previous php.bugs (#110293) next »