diff --git a/.gitignore b/.gitignore index f92a8e4..e3ac13b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ .idea/* library/Vmwarephp/.wsdl_class_map.cache library/Vmwarephp/.clone_ticket.cache -/nbproject/private/ \ No newline at end of file +/nbproject/private/ +vendor +composer.lock diff --git a/composer.json b/composer.json index b8d032b..71b0fb7 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "require-dev":{ "mockery/mockery":"dev-master" }, - "autoload": { - "psr-0": { "Vmwarephp": "library" } - } + "autoload": { + "psr-0": { "Vmwarephp": "library" } + } } diff --git a/library/Vmwarephp/Exception/Soap.php b/library/Vmwarephp/Exception/Soap.php index 6f357ca..5018629 100644 --- a/library/Vmwarephp/Exception/Soap.php +++ b/library/Vmwarephp/Exception/Soap.php @@ -22,11 +22,16 @@ private function makeMessageHeader($soapFault) { return "{$soapFault->faultcode}: {$soapFault->faultstring}. "; } - private function makeFaultDetailsString($soapFault) { + private function makeFaultDetailsString(\SoapFault $soapFault) { $faults = array(); - foreach ($soapFault->detail as $fault) { - $faults[] = "{$fault->enc_stype}: " . print_r($fault->enc_value, true); - } - return count($faults) ? implode(', ', $faults) : ''; + // \SoapFault::$detail property can be unexistent + // @link https://bugs.php.net/bug.php?id=46792 + if (isset($soapFault->detail)) { + foreach ($soapFault->detail as $fault) { + $faults[] = "{$fault->enc_stype}: " . print_r($fault->enc_value, true); + } + } + + return implode(', ', $faults); } } diff --git a/library/Vmwarephp/Factory/SoapClient.php b/library/Vmwarephp/Factory/SoapClient.php index 81fa0bb..ea561f2 100644 --- a/library/Vmwarephp/Factory/SoapClient.php +++ b/library/Vmwarephp/Factory/SoapClient.php @@ -11,15 +11,23 @@ function __construct(\Vmwarephp\WsdlClassMapper $mapper = null, $wsdlFilePath = $this->wsdlFilePath = $wsdlFilePath ? : $this->getWsdlFilePath(); } - function make(\Vmwarephp\Vhost $vhost, $useExceptions = 1, $trace = 1) { - $options = array( - 'trace' => $trace, - 'location' => $this->makeRequestsLocation($vhost), - 'exceptions' => $useExceptions, - 'connection_timeout' => 10, - 'classmap' => $this->wsdlClassMapper->getClassMap(), - 'features' => SOAP_SINGLE_ELEMENT_ARRAYS + SOAP_USE_XSI_ARRAY_TYPE - ); + function make(\Vmwarephp\Vhost $vhost, $useExceptions = 1, $trace = 1) { + $options = array( + 'trace' => $trace, + 'location' => $this->makeRequestsLocation($vhost), + 'exceptions' => $useExceptions, + 'connection_timeout' => 10, + 'classmap' => $this->wsdlClassMapper->getClassMap(), + 'features' => SOAP_SINGLE_ELEMENT_ARRAYS + SOAP_USE_XSI_ARRAY_TYPE, + 'stream_context' => stream_context_create( + array( + 'ssl' => array( + 'verify_peer' => false, + 'verify_peer_name' => false, + ) + ) + ) + ); $soapClient = $this->makeDefaultSoapClient($this->wsdlFilePath, $options); if (!$soapClient) throw new Ex\CannotCreateSoapClient(); return $soapClient;