From bdec39bd6e1ec01d5db17bead4b6f636a3dae162 Mon Sep 17 00:00:00 2001 From: "Edward F Long, Jr" Date: Wed, 19 Sep 2012 14:56:49 -0400 Subject: [PATCH] fix update on fields with initially null values fix updates on fields with initially null values. we were using isset() instead of array_key_exists() replace usage of isset with array_key_exists --- README.md | 4 ++++ aweber_api/aweber.php | 2 +- aweber_api/aweber_collection.php | 2 +- aweber_api/aweber_entry.php | 2 +- aweber_api/aweber_response.php | 2 +- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index fab74d2..593640b 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,10 @@ subscriber information. Changelog: ---------- +2012-09-19: v1.1.6 + * Fixed a bug that prevented resource attributes from being saved when the initial value of the resource attribute was null. + * used array_key_exists instead of isset for evaluation of associative arrays. Requires PHP >= 4.0.7 + 2012-07-05: v1.1.5 * Fixed a bug were a utf8_encode notice was raised when updating subscriber custom field values. diff --git a/aweber_api/aweber.php b/aweber_api/aweber.php index cad360f..792dc89 100644 --- a/aweber_api/aweber.php +++ b/aweber_api/aweber.php @@ -122,7 +122,7 @@ protected function readResponse($response, $url) { $this->adapter->parseAsError($response); if (!empty($response['id'])) { return new AWeberEntry($response, $url, $this->adapter); - } else if (isset($response['entries'])) { + } else if (array_key_exists('entries', $response)) { return new AWeberCollection($response, $url, $this->adapter); } return false; diff --git a/aweber_api/aweber_collection.php b/aweber_api/aweber_collection.php index 0becab3..9f65f19 100644 --- a/aweber_api/aweber_collection.php +++ b/aweber_api/aweber_collection.php @@ -151,7 +151,7 @@ protected function _type() { * @return integer */ protected function _calculatePageSize() { - if (isset($this->data['next_collection_link'])) { + if (array_key_exists('next_collection_link', $this->data)) { $url = $this->data['next_collection_link']; $urlParts = parse_url($url); if (empty($urlParts['query'])) return $this->pageSize; diff --git a/aweber_api/aweber_entry.php b/aweber_api/aweber_entry.php index c89c578..3492f38 100644 --- a/aweber_api/aweber_entry.php +++ b/aweber_api/aweber_entry.php @@ -159,7 +159,7 @@ public function __get($value) { * @access public */ public function __set($key, $value) { - if (isset($this->data[$key])) { + if (array_key_exists($key, $this->data)) { $this->_localDiff[$key] = $value; return $this->data[$key] = $value; } else { diff --git a/aweber_api/aweber_response.php b/aweber_api/aweber_response.php index a688e3f..5d021a2 100644 --- a/aweber_api/aweber_response.php +++ b/aweber_api/aweber_response.php @@ -62,7 +62,7 @@ public function __get($value) { if (in_array($value, $this->_privateData)) { return null; } - if (isset($this->data[$value])) { + if (array_key_exists($value, $this->data)) { return $this->data[$value]; } if ($value == 'type') return $this->_type();