Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

入力が無い場合にも SC_CheckError::MIN_LENGTH_CHECK() がエラー検出してしまう。 #115

Open
seasoftjapan opened this issue Jan 31, 2017 · 0 comments · May be fixed by #1112
Assignees
Labels
Milestone

Comments

@seasoftjapan
Copy link
Contributor

任意入力項目に対応できない。必須入力チエックは EXIST_CHECK で行える。

     public function MIN_LENGTH_CHECK($value)
     {
         $disp_name = $value[0];
         $keyname = $value[1];
         $min_str_len = $value[2];
 
         if (isset($this->arrErr[$keyname])) {
             return;
         }
 
         $this->createParam($value);
 
         // 文字数の取得
-        if (mb_strlen($this->arrParam[$keyname]) < $min_str_len) {
+        $len = mb_strlen($this->arrParam[$keyname]);
+
+        if ($len == 0) {
+            return;
+        }
+
+        if ($len < $min_str_len) {
             $this->arrErr[$keyname] = sprintf(
                 '※ %sは%d字以上で入力してください。<br />',
                 $disp_name,
                 $min_str_len
             );
         }
     }
@Yangsin Yangsin added this to the eccube-2.13.6 milestone Feb 10, 2017
@nanasess nanasess modified the milestones: 2.13.6, 2.18(仮) Dec 16, 2024
@nanasess nanasess self-assigned this Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants