title: Can't handle errors in PHP's SoapServer->handle() method
body: <p>I've created a WSDL-based SOAP web service using PHP 5.3. I'm using Zend Framework to handle the service, and ZF in turn is layered atop PHP's built-in SoapServer class.</p>
  
  <p>In testing with SoapUI, I discovered that passing a parameter of invalid type (e.g., passing a string when an integer is defined by the WSDL) resulted an empty response. Digging into the code, I discovered that when ZF calls SoapServer->handle(), execution dies with this fatal error:</p>
  
  <pre><code>Fatal error: SOAP-ERROR: Encoding: Violation of encoding rules
  </code></pre>
  
  <p>The error makes sense, but for the life of me, I cannot figure out how to capture it so that I may gracefully handle it. My understanding is that handle() should throw an exception, but it's instead simply dying.</p>
  
  <p>But here's where it gets really weird....</p>
  
  <p>Running multiple tests with SoapUI, without making any code changes, produces different results. Most of the time, I get the empty response, but occasionally, I get back a SoapFault (what I'd expect!). It's not consistent, however, and I cannot figure out what triggers it either way. As far as I can tell, I have the caching features in SoapUI turned off, as well as WSDL caching. I don't know if it's something with SoapUI or PHP. As I said, weird.</p>
  
  <p>Related, I found this old PHP bug:</p>
  
  <p><a href="http://bugs.php.net/36629" rel="nofollow noreferrer">http://bugs.php.net/36629</a></p>
  
  <p>that sounds an awful like my own problem. I'm not completely convinced, though, that that's my issue, mostly because the PHP documentation covering all this, as well as the docs for ZF, are woefully incomplete. Thus, I may very well simply be doing something terribly wrong and not know it. In light of that, I'd love to see a simple shell that shows the proper way to trap and handle errors. But I'll take any help that folks out there may be able to offer.</p>