| Newsgroups |
php.notes |
| Message-ID |
<[email protected]> |
In PHP 8.4.5, if there is only one catch block and that block is empty, the programme will not even attempt to execute the try block. This was not the case under an old version of PHP that was running the code which I am now debugging.
So for instance, the code snippet:
try
{
print "have now entered try block";
$client = new SoapClient("https://secure2.e-xact.com/vplug-in/transaction/rpc-enc/service.asmx?wsdl");
print "will now attempt soapCall";
$trxnResult = $client->__soapCall('SendAndCommit', $trxn);
print "completed soapCall attempt";
}
catch(Exception $e)
{
}
if(is_soap_fault($trxnResult))
{
// there was a fault, inform
print "<B>FAULT: Code: {$trxnResult->faultcode} <BR />";
print "String: {$trxnResult->faultstring} </B>";
$trxnResult["CTR"] = "There was an error while processing. No TRANSACTION DATA IN CTR!";
}
will not print anything but the code snippet
try
{
print "have now entered try block";
$client = new SoapClient("https://secure2.e-xact.com/vplug-in/transaction/rpc-enc/service.asmx?wsdl");
print "will now attempt soapCall";
$trxnResult = $client->__soapCall('SendAndCommit', $trxn);
print "completed soapCall attempt";
}
catch(Exception $e){
print "caught exception!!!!";
}
if(is_soap_fault($trxnResult))
{
// there was a fault, inform
print "<B>FAULT: Code: {$trxnResult->faultcode} <BR />";
print "String: {$trxnResult->faultstring} </B>";
$trxnResult["CTR"] = "There was an error while processing. No TRANSACTION DATA IN CTR!";
}
will print:
have now entered try blockcaught exception!!!!
----
Server IP: 45.112.84.4
Probable Submitter: 45.112.84.18 (proxied: 70.50.98.175)
----
Manual Page -- https://php.net/manual/en/language.exceptions.php
Edit -- https://main.php.net/note/edit/130327
Del: integrated -- https://main.php.net/note/delete/130327/integrated
Del: useless -- https://main.php.net/note/delete/130327/useless
Del: bad code -- https://main.php.net/note/delete/130327/bad+code
Del: spam -- https://main.php.net/note/delete/130327/spam
Del: non-english -- https://main.php.net/note/delete/130327/non-english
Del: in docs -- https://main.php.net/note/delete/130327/in+docs
Del: other reasons-- https://main.php.net/note/delete/130327
Reject -- https://main.php.net/note/reject/130327
Search -- https://main.php.net/manage/user-notes.php