From dd3905ef0a218a4ff2a7a7029c4477967c11d5e2 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Thu, 27 Nov 2025 15:25:28 +0900 Subject: [PATCH 1/2] =?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/RegistrationAnswerTextBehavior.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Model/Behavior/RegistrationAnswerTextBehavior.php b/Model/Behavior/RegistrationAnswerTextBehavior.php index d2cf5b6..2a47566 100644 --- a/Model/Behavior/RegistrationAnswerTextBehavior.php +++ b/Model/Behavior/RegistrationAnswerTextBehavior.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)) { @@ -77,7 +78,7 @@ public function answerTextValidation($model, $data, $question, $allAnswers) { $ret = true; // 数値型登録を望まれている場合 if ($question['question_type_option'] == RegistrationsComponent::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('registrations', 'Number required'); } @@ -86,7 +87,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'][] = sprintf( __d('registrations', 'Please enter the answer between %s and %s.'), From d3456fc6dd5a74c0c24c6ab1e92806fa18c0346c Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Thu, 27 Nov 2025 15:26:56 +0900 Subject: [PATCH 2/2] =?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 eb2068b..577445c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -32,8 +32,8 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php: [ '7.1', '7.2', '7.3', '7.4' ] - mysql: [ '5.7', '8.0' ] + php: [ '7.4' ] + mysql: [ '8.0' ] env: NC3_BUILD_DIR: "/opt/nc3"