From 34c01e21bbd2ba42b16a64aa4ce46636d48eab87 Mon Sep 17 00:00:00 2001 From: Brian Clark Date: Fri, 28 Jul 2017 19:50:16 -0400 Subject: [PATCH] PHP7 compatibility fixes. (preg_replace_callback, __constructor usage). --- Sample_Code/PHP/BluePayPayment_BP10Emu.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Sample_Code/PHP/BluePayPayment_BP10Emu.php b/Sample_Code/PHP/BluePayPayment_BP10Emu.php index 569a00d..44cd2f0 100644 --- a/Sample_Code/PHP/BluePayPayment_BP10Emu.php +++ b/Sample_Code/PHP/BluePayPayment_BP10Emu.php @@ -83,7 +83,7 @@ class BluePayPayment_BP10Emu { // $accID : Merchant's Account ID // $secretKey : Merchant's Secret Key // $mode : Transaction mode of either LIVE or TEST (default) - public function BluePayPayment_BP10Emu($accID, $secretKey, $mode) { + public function __construct($accID, $secretKey, $mode) { $this->accountID = $accID; $this->secretKey = $secretKey; $this->mode = $mode; @@ -360,7 +360,9 @@ public function http_parse_headers($header) { $fields = explode("\r\n", preg_replace('/\x0D\x0A[\x09\x20]+/', ' ', $header)); foreach( $fields as $field ) { if( preg_match('/([^:]+): (.+)/m', $field, $match) ) { - $match[1] = preg_replace('/(?<=^|[\x09\x20\x2D])./e', 'strtoupper("\0")', strtolower(trim($match[1]))); + $match[1] = preg_replace_callback('/(?<=^|[\x09\x20\x2D])./', function ($match) { + return strtoupper($match[0]); + }, strtolower(trim($match[1]))); if( isset($retVal[$match[1]]) ) { if (!is_array($retVal[$match[1]])) { $retVal[$match[1]] = array($retVal[$match[1]]);