第64行意外的t_catch
我必须做什么?
[10-Oct-2014 22:09:14 Europe / Bucharest] PHP Parse错误:语法错误,/home/lagramad/public_html/discounts/system/modules/gateway/mobilpay/cardConfirm.php中的意外T_CATCH在线64
if (strcasecmp( $_SERVER['REQUEST_METHOD'], 'post' ) == 0) {
if (( isset( $_POST['env_key'] ) && isset( $_POST['data'] ) )) {
$privateKeyFilePath = $_SERVER['DOCUMENT_ROOT'] . '/system/modules/gateway/mobilpay/certificate/private.key';
$objPmReq = Mobilpay_Payment_Request_Abstract::factoryfromencrypted( $_POST['env_key'], $_POST['data'], $privateKeyFilePath );
switch ($objPmReq->objPmNotify->action) {
case 'confirmed': {
$errorMessage = $objPmReq->objPmNotify->getCrc( );
break;
}
case 'confirmed_pending': {
$errorMessage = $objPmReq->objPmNotify->getCrc( );
break;
}
case 'paid_pending': {
$errorMessage = $objPmReq->objPmNotify->getCrc( );
break;
}
case 'paid': {
$errorMessage = $objPmReq->objPmNotify->getCrc( );
break;
}
case 'canceled': {
$errorMessage = $objPmReq->objPmNotify->getCrc( );
break;
}
case 'credit': {
$errorMessage = $objPmReq->objPmNotify->getCrc( );
break;
}
default: {
$errorType = CONFIRM_ERROR_TYPE_PERMANENT;
$errorCode = ERROR_CONFIRM_INVALID_ACTION;
$errorMessage = 'mobilpay_refference_action paramaters is invalid';
break;
}
}
catch ( Exception $e ) { line 64
$errorType = CONFIRM_ERROR_TYPE_TEMPORARY;
$errorCode = $e->getCode( );
$errorMessage = $e->getMessage( );
$headers = 'From: You <you@essence.com>' . '';
$headers .= 'MIME-Version: 1.0' . '';
$headers .= 'Content-type: text/html; charset=iso-8859-1' . '';
$req = '';
if (( $_REQUEST || $_POST )) {
foreach ($_REQUEST as $val) {
}
}
$get_req = '';
foreach ($_GET as $get_val) {
$get_req .= $get_val;
}
答案 0 :(得分:2)
您在代码中使用$_POST['..somevalue..']
。因此,只要_POST中不存在“somevalue”,就会出现“未定义索引”错误。
通过使用以下内容替换您的行来解决此问题:
$shippingAddress->mobilePhone = ( isset($_POST['shipping_mobile_phone']) ? $_POST['shipping_mobile_phone'] : '' );