From f539f435b38c43d2561cec6ac2a587db6ceeb5e6 Mon Sep 17 00:00:00 2001 From: Chris Kleeschulte Date: Thu, 28 Jan 2016 12:44:59 -0500 Subject: [PATCH 1/2] Updated package for use with Symfony 3.0 or 2.3 - Please note that the integration tests won't work with Symfony 3 due to Behat not supporting this version yet. - Unit tests are function with both Symfony 2.x or 3.0 --- Makefile | 2 +- VERSION | 2 +- composer.json | 12 ++++++------ src/Bitpay/DependencyInjection/services.xml | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index c3d61c37..696d737e 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ setup: - composer.phar install + ./composer.phar install npm install test: diff --git a/VERSION b/VERSION index 21bb5e15..0d3ad67a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.2.5 +2.2.10 diff --git a/composer.json b/composer.json index c554a0fc..06033dff 100644 --- a/composer.json +++ b/composer.json @@ -29,17 +29,17 @@ "ext-json": "*", "ext-openssl": "*", "ext-mcrypt": "*", - "symfony/config": "2.5.*", - "symfony/dependency-injection": "2.5.*" + "symfony/config": "^2.3 || ^3.0", + "symfony/dependency-injection": "^2.3 || ^3.0" }, "require-dev": { - "behat/behat": "2.5.*@stable", - "behat/mink": "1.6.1", - "behat/mink-extension": "1.3.*", + "behat/behat": "master-dev", + "behat/mink": "master-dev", + "behat/mink-extension": "master-dev", "behat/mink-selenium2-driver": "1.2.0", "fabpot/goutte": "~1.0.4", "behat/mink-goutte-driver": "1.*", - "phpmd/phpmd": "~2.1.3", + "phpmd/phpmd": "master-dev", "phpunit/phpunit": "~4.3.1", "fzaninotto/faker": "~1.4.0", "mikey179/vfsStream": "~1.4.0", diff --git a/src/Bitpay/DependencyInjection/services.xml b/src/Bitpay/DependencyInjection/services.xml index a38e440d..36e81995 100644 --- a/src/Bitpay/DependencyInjection/services.xml +++ b/src/Bitpay/DependencyInjection/services.xml @@ -1,7 +1,7 @@ @@ -31,7 +31,7 @@ - + %bitpay.key_storage_password% @@ -39,11 +39,11 @@ - + %bitpay.public_key% - + %bitpay.private_key% From b6b12087d5579b9476c6b9f5328e242ab2117ae7 Mon Sep 17 00:00:00 2001 From: Chris Kleeschulte Date: Fri, 12 Feb 2016 13:52:20 -0500 Subject: [PATCH 2/2] Invoice class mutator type-checking - Model classes will/should test types on mutators, a sane model is calling is_numeric followed by floatval for float types Rationale: Instantiators of models should take care to construct fields of the appropriate type, but model's should have a bit of checking as well for safety. --- src/Bitpay/Invoice.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/Bitpay/Invoice.php b/src/Bitpay/Invoice.php index fcb18c89..a660cb42 100644 --- a/src/Bitpay/Invoice.php +++ b/src/Bitpay/Invoice.php @@ -151,8 +151,8 @@ public function getPrice() */ public function setPrice($price) { - if (is_float($price)) { - $this->getItem()->setPrice($price); + if (is_numeric($price)) { + $this->getItem()->setPrice(floatval($price)); } return $this; @@ -438,9 +438,7 @@ public function getBtcPrice() */ public function setBtcPrice($btcPrice) { - if (is_float($btcPrice)) { - $this->btcPrice = $btcPrice; - } else if (is_numeric($btcPrice)) { + if (is_numeric($btcPrice)) { $this->btcPrice = floatval($btcPrice); } @@ -677,7 +675,7 @@ public function getBtcPaid() */ public function setBtcPaid($btcPaid) { - if (is_float($btcPaid)) { + if (is_numeric($btcPaid)) { $this->btcPaid = $btcPaid; } @@ -699,8 +697,8 @@ public function getRate() */ public function setRate($rate) { - if (is_float($rate)) { - $this->rate = $rate; + if (is_numeric($rate)) { + $this->rate = floatval($rate); } return $this;