From f074dff71f136860102a6042dccd3ff6db02d9f4 Mon Sep 17 00:00:00 2001 From: ThallisPHP Date: Thu, 3 May 2012 16:01:46 -0300 Subject: Update system/libraries/Cart.php - To enable integrity when using associative arrays --- system/libraries/Cart.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/libraries/Cart.php') diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php index eee123584..9f258beb3 100644 --- a/system/libraries/Cart.php +++ b/system/libraries/Cart.php @@ -244,7 +244,7 @@ class CI_Cart { // This becomes the unique "row ID" if (isset($items['options']) && count($items['options']) > 0) { - $rowid = md5($items['id'].implode('', $items['options'])); + $rowid = md5($items['id'].serialize($items['options'])); } else { -- cgit v1.2.3-24-g4f1b From d261b1e89c3d4d5191036d5a5660ef6764e593a0 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Sat, 2 Jun 2012 11:12:16 +0100 Subject: Replaced `==` with `===` and `!=` with `!==` in /system/libraries --- system/libraries/Cart.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'system/libraries/Cart.php') diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php index 827050310..87b1877c3 100644 --- a/system/libraries/Cart.php +++ b/system/libraries/Cart.php @@ -193,7 +193,7 @@ class CI_Cart { $items['qty'] = (float) $items['qty']; // If the quantity is zero or blank there's nothing for us to do - if ( ! is_numeric($items['qty']) OR $items['qty'] == 0) + if ( ! is_numeric($items['qty']) OR $items['qty'] === 0) { return FALSE; } @@ -358,7 +358,7 @@ class CI_Cart { // Is the quantity zero? If so we will remove the item from the cart. // If the quantity is greater than zero we are updating - if ($items['qty'] == 0) + if ($items['qty'] === 0) { unset($this->_cart_contents[$items['rowid']]); } @@ -520,7 +520,7 @@ class CI_Cart { */ public function format_number($n = '') { - return ($n == '') ? '' : number_format( (float) $n, 2, '.', ','); + return ($n === '') ? '' : number_format( (float) $n, 2, '.', ','); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From 5036c9caabb12f90b9533d7fb417610e02a652ff Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 4 Jun 2012 15:34:56 +0300 Subject: Revert/optimize some changes from 773ccc318f2769c9b7579630569b5d8ba47b114b and d261b1e89c3d4d5191036d5a5660ef6764e593a0 --- system/libraries/Cart.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/libraries/Cart.php') diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php index 87b1877c3..c442f88da 100644 --- a/system/libraries/Cart.php +++ b/system/libraries/Cart.php @@ -193,7 +193,7 @@ class CI_Cart { $items['qty'] = (float) $items['qty']; // If the quantity is zero or blank there's nothing for us to do - if ( ! is_numeric($items['qty']) OR $items['qty'] === 0) + if ( ! is_numeric($items['qty']) OR $items['qty'] == 0) { return FALSE; } @@ -358,7 +358,7 @@ class CI_Cart { // Is the quantity zero? If so we will remove the item from the cart. // If the quantity is greater than zero we are updating - if ($items['qty'] === 0) + if ($items['qty'] == 0) { unset($this->_cart_contents[$items['rowid']]); } -- cgit v1.2.3-24-g4f1b