r75822 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r75821‎ | r75822 | r75823 >
Date:20:11, 1 November 2010
Author:awjrichards
Status:deferred
Tags:
Comment:
PaypalRedirect throws exception on curl error
Modified paths:
  • /trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php
@@ -1180,14 +1180,17 @@
11811181 $this->updateContributionTracking( $data, true );
11821182
11831183 $wgPayflowGatewayPaypalURL .= "/" . $data[ 'language' ] . "?gateway=paypal";
1184 -
11851184 // submit the data to the paypal redirect URL
11861185 // @fixme add some error checking!!!
11871186 $ch = curl_init();
11881187 curl_setopt( $ch, CURLOPT_URL, $wgPayflowGatewayPaypalURL );
11891188 curl_setopt( $ch, CURLOPT_POST, count( $data ) );
11901189 curl_setopt( $ch, CURLOPT_POSTFIELDS, http_build_query( $data ) );
1191 - curl_exec( $ch );
 1190+ $curl_result = curl_exec( $ch );
11921191 curl_close( $ch );
 1192+ // throw an exception if there was a curl error
 1193+ if ( !$curl_result ) {
 1194+ throw new MWException( 'There was a cURL error submitting information to ' . $wgPayflowGatewayPaypalURL . ': ' . curl_error( $ch ) );
 1195+ }
11931196 }
11941197 } // end class
\ No newline at end of file

Status & tagging log