From f2a5d37c76272477abc5f5a1c668b7d1467be0ef Mon Sep 17 00:00:00 2001 From: Konrad Rosenbaum Date: Sun, 1 Jan 2017 21:36:21 +0100 Subject: [PATCH] fix exceptions in PHP Change-Id: I97c4a27e52059e5acf2a95f7051a29bb9d2388aa --- woc/php/phpclass.cpp | 2 +- woc/php/phpstrans.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/woc/php/phpclass.cpp b/woc/php/phpclass.cpp index 71c8e75..5a2fec5 100644 --- a/woc/php/phpclass.cpp +++ b/woc/php/phpclass.cpp @@ -413,7 +413,7 @@ QString WocPHPClass::classDeserializers(const WocClass&cls) QStringList k; code+="\nstatic public function fromString($txt){\n\t$xml=new DomDocument;\n"; code+="\tif(!$xml->loadXml(trim($txt)))"; - code+="\n\t\tthrow WobXmlException(translate(\""+abstractClassName(cls)+"\",\"Unable to deserialize object of type "+className(cls)+": invalid XML.\"));"; + code+="\n\t\tthrow new WobXmlException(translate(\""+abstractClassName(cls)+"\",\"Unable to deserialize object of type "+className(cls)+": invalid XML.\"));"; code+="\n\treturn self::fromXml($xml,$xml->documentElement);\n}\n"; code+="static public function fromXml($xml,$elem){\n\t$data=new "+className(cls)+"();\n"; code+="\tself::fromXmlHelper($data,$xml,$elem);\n\treturn $data;\n}\n"; diff --git a/woc/php/phpstrans.cpp b/woc/php/phpstrans.cpp index 0175e2b..5749e81 100644 --- a/woc/php/phpstrans.cpp +++ b/woc/php/phpstrans.cpp @@ -55,13 +55,13 @@ QString WocPHPServerTransaction::trnHandlers(const WocTransaction&trn) code+="\t$root=$xml->documentElement;\n"; if(woc->messageEncoding()==WocProcessor::Soap12Encoding){ code+="\t$list=$root->getElementsByTagName(\"Body\");\n"; - code+="\tif($list->length<1)throw WobSoapTransactionError(tr(\"SOAP: missing body\").\"soap\");\n"; + code+="\tif($list->length<1)throw new WobSoapTransactionError(tr(\"SOAP: missing body\").\"soap\");\n"; code+="\t$root=$list->item(0);\n"; code+="\t$list=$root->childNodes;$root=false;\n"; code+="\tforeach($list as $e){\n"; code+="\t\tif($e->nodeType!=XML_ELEMENT_NODE)continue;\n"; code+="\t\tif($e->localName==\"WobRequest-"+trn.name()+"\"){$root=$e;break}\n\t}\n"; - code+="\tif($root===false)throw WobSoapTransactionError(tr(\"SOAP: missing message content\").\"soap\");\n"; + code+="\tif($root===false)throw new WobSoapTransactionError(tr(\"SOAP: missing message content\").\"soap\");\n"; } //parse inputs -- 1.7.2.5