i want working with SoapClient in yii2 project. but i need manage error with try-catch. but that not work !
yii2 code example :
class SiteController extends Controller
{
public function actionIndex()
{
try{
new \SoapClient('a',['cache_wsdl' => WSDL_CACHE_MEMORY]);
}catch(\SoapFault $e){
echo '***************';
}
}
}
yii framework output :
PHP Fatal Error – yii\base\ErrorException SOAP-ERROR: Parsing WSDL: Couldn't load from 'a' : failed to load external entity "a"
but in test.php(no yii framework) :
try{
new SoapClient('a',['cache_wsdl' => WSDL_CACHE_MEMORY]);
}catch(SoapFault $e){
echo '***************';
}
output
***************
why catch SoapFault not working ? but in single php script works and printed stars.