diff --git a/app/code/community/Bitpay/Core/Model/Method/Bitcoin.php b/app/code/community/Bitpay/Core/Model/Method/Bitcoin.php index ccf9f06..5c543fe 100644 --- a/app/code/community/Bitpay/Core/Model/Method/Bitcoin.php +++ b/app/code/community/Bitpay/Core/Model/Method/Bitcoin.php @@ -322,7 +322,7 @@ class Bitpay_Core_Model_Method_Bitcoin extends Mage_Payment_Model_Method_Abstrac $address = $quote->getBillingAddress(); } - if (!empty($address->getStreet1())) { + if (!$this->is_empty($address->getStreet1())) { $buyer->setAddress( array( $address->getStreet1(), @@ -333,29 +333,29 @@ class Bitpay_Core_Model_Method_Bitcoin extends Mage_Payment_Model_Method_Abstrac ); } - if (!empty($address->getRegionCode())) { + if (!$this->is_empty($address->getRegionCode())) { $buyer->setState($address->getRegionCode()); - } else if (!empty($address->getRegion())) { + } else if (!$this->is_empty($address->getRegion())) { $buyer->setState($address->getRegion()); } - if (!empty($address->getCountry())) { + if (!$this->is_empty($address->getCountry())) { $buyer->setCountry($address->getCountry()); } - if (!empty($address->getCity())) { + if (!$this->is_empty($address->getCity())) { $buyer->setCity($address->getCity()); } - if (!empty($address->getPostcode())) { + if (!$this->is_empty($address->getPostcode())) { $buyer->setZip($address->getPostcode()); } - if (!empty($address->getEmail())) { + if (!$this->is_empty($address->getEmail())) { $buyer->setEmail($address->getEmail()); } - if (!empty($address->getTelephone())) { + if (!$this->is_empty($address->getTelephone())) { $buyer->setPhone($address->getTelephone()); } @@ -364,6 +364,16 @@ class Bitpay_Core_Model_Method_Bitcoin extends Mage_Payment_Model_Method_Abstrac return $invoice; } + /** + * Checks if string is empty - fix for PHP 5.4 + * + * @param $str + * @return boolean + */ + private function is_empty($str){ + return empty($str); + } + /** * Adds currency information to the invoice *