fix exceptions in PHP
authorKonrad Rosenbaum <konrad@silmor.de>
Sun, 1 Jan 2017 20:36:21 +0000 (21:36 +0100)
committerKonrad Rosenbaum <konrad@silmor.de>
Sun, 1 Jan 2017 20:36:21 +0000 (21:36 +0100)
Change-Id: I97c4a27e52059e5acf2a95f7051a29bb9d2388aa

woc/php/phpclass.cpp
woc/php/phpstrans.cpp

index 71c8e75..5a2fec5 100644 (file)
@@ -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";
index 0175e2b..5749e81 100644 (file)
@@ -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