From f5a05b3c06638599c75d5ff318604793d27ac42b Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Thu, 27 Nov 2025 15:24:15 +0900 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20=E3=80=8C=E3=83=86=E3=82=AD=E3=82=B9?= =?UTF-8?q?=E3=83=88=E5=9E=8B=EF=BC=8B=E5=BF=85=E9=A0=88=E3=81=A7=E3=81=AF?= =?UTF-8?q?=E3=81=AA=E3=81=84=EF=BC=8B=E6=95=B0=E5=80=A4=E5=9E=8B=E3=80=8D?= =?UTF-8?q?=E3=81=AE=E5=A0=B4=E5=90=88=E3=80=81=E6=9C=AA=E5=85=A5=E5=8A=9B?= =?UTF-8?q?=E3=81=AB=E3=81=97=E3=81=A6=E3=82=82=E6=95=B0=E5=80=A4=E3=82=92?= =?UTF-8?q?=E5=85=A5=E5=8A=9B=E3=81=97=E3=81=A6=E3=81=8F=E3=81=A0=E3=81=95?= =?UTF-8?q?=E3=81=84=E3=81=A8=E3=82=A8=E3=83=A9=E3=83=BC=E3=81=8C=E5=87=BA?= =?UTF-8?q?=E3=82=8B=E3=80=82=20https://github.com/NetCommons3/NetCommons3?= =?UTF-8?q?/issues/1730?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Model/Behavior/QuestionnaireAnswerTextBehavior.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Model/Behavior/QuestionnaireAnswerTextBehavior.php b/Model/Behavior/QuestionnaireAnswerTextBehavior.php index 996013f..73dd32d 100644 --- a/Model/Behavior/QuestionnaireAnswerTextBehavior.php +++ b/Model/Behavior/QuestionnaireAnswerTextBehavior.php @@ -77,7 +77,7 @@ public function answerTextValidation($model, $data, $question, $allAnswers) { $ret = true; // 数値型回答を望まれている場合 if ($question['question_type_option'] == QuestionnairesComponent::TYPE_OPTION_NUMERIC) { - if (!Validation::numeric($data['answer_value'])) { + if (mb_strlen($data['answer_value']) !== 0 && !Validation::numeric($data['answer_value'])) { $ret = false; $model->validationErrors['answer_value'][] = __d('questionnaires', 'Number required'); } @@ -86,7 +86,7 @@ public function answerTextValidation($model, $data, $question, $allAnswers) { $data['answer_value'], intval($question['min']), intval($question['max'])); - if (!$rangeRes) { + if (mb_strlen($data['answer_value']) !== 0 && !$rangeRes) { $ret = false; $model->validationErrors['answer_value'][] = __d('questionnaires', 'Please enter the answer between %s and %s.', From 2f73fd1b1fa93a7d358bea05c076f3fd89381468 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Thu, 27 Nov 2025 15:27:54 +0900 Subject: [PATCH 2/3] =?UTF-8?q?ci:=20phpunit=E3=81=AE=E3=83=86=E3=82=B9?= =?UTF-8?q?=E3=83=88=E3=82=B1=E3=83=BC=E3=82=B9=E3=82=92=E5=A4=89=E6=9B=B4?= =?UTF-8?q?=EF=BC=88php7.4=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 36cd2b9..f46fc05 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -30,8 +30,8 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php: [ '7.2', '7.3', '7.4' ] - mysql: [ '5.7', '8.0' ] + php: [ '7.4' ] + mysql: [ '8.0' ] env: NC3_BUILD_DIR: "/opt/nc3" From c24ca6cb450f4e48449ebd2384dd6b7a2a423a6f Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Thu, 27 Nov 2025 16:49:38 +0900 Subject: [PATCH 3/3] =?UTF-8?q?style:=20phpmd=E5=9B=9E=E9=81=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Model/Behavior/QuestionnaireAnswerTextBehavior.php | 1 + 1 file changed, 1 insertion(+) diff --git a/Model/Behavior/QuestionnaireAnswerTextBehavior.php b/Model/Behavior/QuestionnaireAnswerTextBehavior.php index 73dd32d..d7d57ab 100644 --- a/Model/Behavior/QuestionnaireAnswerTextBehavior.php +++ b/Model/Behavior/QuestionnaireAnswerTextBehavior.php @@ -69,6 +69,7 @@ public function answerMaxLength($model, $data, $question, $max) { * @param array $question 回答データに対応する質問 * @param array $allAnswers 入力された回答すべて * @return bool + * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ public function answerTextValidation($model, $data, $question, $allAnswers) { if (! in_array($question['question_type'], $this->_textValidateType)) {