Administrator
- Join Date:
- Sep 2009
- Location:
- Stuart, FL
- Posts:
- 14,096
- Plugin Contributions:
- 56
[Done v1.6.0] shopping_cart::get_product_id_list function
The get_product_id_list function in /includes/classes/shopping_cart.php could, if called when the cart is empty, generate a PHP warning based on its call to substr:
function get_product_id_list() {
$product_id_list = '';
if (is_array($this->contents)) {
reset($this->contents);
while (list($products_id, ) = each($this->contents)) {
$product_id_list .= ', ' . zen_db_input($products_id);
}
}
[B] return substr($product_id_list, 2);[/B]
}
To prevent the PHP warning+, the code should be changed to:
function get_product_id_list() {
$product_id_list = '';
if (is_array($this->contents)) {
reset($this->contents);
while (list($products_id, ) = each($this->contents)) {
$product_id_list .= ', ' . zen_db_input($products_id);
}
}
[B] return ($product_id_list == '') ? '' : substr($product_id_list, 2);[/B]
}