Changeset 18503 for branches


Ignore:
Timestamp:
2010/01/22 17:59:00 (14 years ago)
Author:
nanasess
bzr:base-revision:
ohkouchi@loop-az.jp-20100122032023-cncvgr1b1u1t0u2s
bzr:committer:
Kentaro Ohkouchi <ohkouchi@loop-az.jp>
bzr:file-ids:

data/class/SC_Initial.php 16506@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2FSC_Initial.php
bzr:mapping-version:
v4
bzr:repository-uuid:
1e3b908f-19a9-db11-a64c-001125224ba8
bzr:revision-id:
ohkouchi@loop-az.jp-20100122085858-swz18up2y28i1zlm
bzr:revno:
1912
bzr:revprop:branch-nick:
branches/version-2_4-dev
bzr:root:
branches/version-2_4-dev
bzr:text-parents:

data/class/SC_Initial.php svn-v4:1e3b908f-19a9-db11-a64c-001125224ba8:branches/version-2_4:18431
bzr:timestamp:
2010-01-22 17:58:58.144999981 +0900
bzr:user-agent:
bzr2.0.1+bzr-svn1.0.1
svn:original-date:
2010-01-22T08:58:58.145000Z
Message:

POST or GET された値と, DB の文字エンコーディングの不一致で, DBエラーとなる不具合の修正(#488)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_4-dev/data/class/SC_Initial.php

    r18431 r18503  
    5656        $this->defineConstants(); 
    5757        $this->mbstringInit(); 
     58        $this->checkConvertEncodingAll(); 
    5859        $this->createCacheDir(); 
    5960    } 
     
    124125 
    125126    /** 
     127     * 文字エンコーディングをチェックし, CHAR_CODE に変換する. 
     128     * 
     129     * $_GET, $_POST, $_REQUEST の文字エンコーディングをチェックし, CHAR_CODE と 
     130     * 一致しない場合は, CHAR_CODE へ変換する. 
     131     * 
     132     * @access protected 
     133     * @return void 
     134     * @see $this->checkConvertEncoding() 
     135     */ 
     136    function checkConvertEncodingAll() { 
     137        $_GET = $this->checkConvertEncoding($_GET); 
     138        $_POST = $this->checkConvertEncoding($_POST); 
     139        $_REQUEST = $this->checkConvertEncoding($_REQUEST); 
     140    } 
     141 
     142    /** 
     143     * 配列の要素の文字エンコーディングをチェックし, CHAR_CODE に変換して返す. 
     144     * 
     145     * 引数の配列の要素の文字エンコーディングをチェックし, CHAR_CODE と一致しない 
     146     * 場合は, CHAR_CODE へ変換して返す. 
     147     * 
     148     * 文字エンコーディングの判別は, mb_detect_encoding に依存します. 
     149     * 
     150     * @access private 
     151     * @param array $arrMethod チェック対象の配列 
     152     * @return array 変換後の配列 
     153     * @see mb_detect_encoding() 
     154     * @see mb_convert_encoding() 
     155     */ 
     156    function checkConvertEncoding($arrMethod) { 
     157        $arrResult = array(); 
     158        foreach ($arrMethod as $key => $val) { 
     159            $encoding = mb_detect_encoding($val); 
     160            if (CHAR_CODE != $encoding) { 
     161                $arrResult[$key] = mb_convert_encoding($val, CHAR_CODE, $encoding); 
     162            } else { 
     163                $arrResult[$key] = $val; 
     164            } 
     165        } 
     166        return $arrResult; 
     167    } 
     168 
     169    /** 
    126170     * 定数を設定する. 
    127171     * 
Note: See TracChangeset for help on using the changeset viewer.