PHP 5.2 SOAPClient fun

In PHP certification tests you frequently get questions like "what will this code output?": (some code...) 

Answer Options: NULL, and Exception or a Warning

Now i also have one. What will this code produce:

class c {
function __construct() {
$sc = new SoapClient('http://unreachabledomain.com/wsdl', array('exceptions'=>true));
}
}
try {
$cc = new c();
}
catch (Exception $e) {
echo "hkjkj";
}
echo "TEST";

The answer?

3 WARNINGS, one FATAL ERROR in the Error Log plus an Exception of type SOAPFault that produces the output "hkjkj". And then "TEST". I now know: The WSDL file could really not be loaded...

Auf Facebook teilen

« iphone and CISCO VPN - Guess what it does II: PHP code experiments »