Changeset 18273


Ignore:
Timestamp:
2009/09/01 12:31:58 (15 years ago)
Author:
Seasoft
Message:

SC_Utils#sfIsInt の改修。

  • 「0」をINT型でないと見なしてしまうバグを修正。
  • 他の問題点をコメントに記述。
Location:
branches/comu-ver2/data/class
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/comu-ver2/data/class/helper/SC_Helper_DB.php

    r18272 r18273  
    829829            $category_id = (int) $category_id; 
    830830            $product_id = (int) $product_id; 
    831             if(SC_Utils_Ex::sfIsInt($category_id) && $this->sfIsRecord("dtb_category","category_id", $category_id)) { 
     831            if (SC_Utils_Ex::sfIsInt($category_id) && $category_id != 0 && $this->sfIsRecord("dtb_category","category_id", $category_id)) { 
    832832                $this->g_category_id = array($category_id); 
    833             } else if (SC_Utils_Ex::sfIsInt($product_id) && $this->sfIsRecord("dtb_products","product_id", $product_id, $status)) { 
     833            } else if (SC_Utils_Ex::sfIsInt($product_id) && $product_id != 0 && $this->sfIsRecord("dtb_products","product_id", $product_id, $status)) { 
    834834                $objQuery = new SC_Query(); 
    835835                $where = "product_id = ?"; 
     
    16621662        } 
    16631663 
    1664         if(!$this->g_maker_on) { 
     1664        if (!$this->g_maker_on) { 
    16651665            $this->g_maker_on = true; 
    16661666            $maker_id = (int) $maker_id; 
    16671667            $product_id = (int) $product_id; 
    1668             if(SC_Utils_Ex::sfIsInt($maker_id) && $this->sfIsRecord("dtb_maker","maker_id", $maker_id)) { 
     1668            if (SC_Utils_Ex::sfIsInt($maker_id) && $maker_id != 0 && $this->sfIsRecord("dtb_maker","maker_id", $maker_id)) { 
    16691669                $this->g_maker_id = array($maker_id); 
    1670             } else if (SC_Utils_Ex::sfIsInt($product_id) && $this->sfIsRecord("dtb_products","product_id", $product_id, $status)) { 
     1670            } else if (SC_Utils_Ex::sfIsInt($product_id) && $product_id != 0 && $this->sfIsRecord("dtb_products","product_id", $product_id, $status)) { 
    16711671                $objQuery = new SC_Query(); 
    16721672                $where = "product_id = ?"; 
  • branches/comu-ver2/data/class/util/SC_Utils.php

    r18259 r18273  
    261261    } 
    262262 
    263     // INT型の数値チェック 
     263    /** 
     264     *  INT型の数値チェック 
     265     *  ・FIXME: マイナス値の扱いが不明確 
     266     *  ・XXX: INT_LENには収まるが、INT型の範囲を超えるケースに対応できないのでは? 
     267     *   
     268     *  @param mixed $value 
     269     *  @return bool 
     270     */ 
     271    //  
    264272    function sfIsInt($value) { 
    265         if($value != "" && strlen($value) <= INT_LEN && is_numeric($value)) { 
     273        if (strlen($value) >= 1 && strlen($value) <= INT_LEN && is_numeric($value)) { 
    266274            return true; 
    267275        } 
Note: See TracChangeset for help on using the changeset viewer.