Fix ambiguous conditions replacing empty()

This commit is contained in:
Jens Schuppe 2024-05-10 12:27:33 +02:00
parent 48c49c1814
commit 2b8ab813db
3 changed files with 8 additions and 7 deletions

View file

@ -72,8 +72,8 @@ class CRM_Twingle_Submission {
// Get the payment instrument defined within the profile, or return an error
// if none matches (i.e. an unknown payment method was submitted).
$payment_instrument_id = $profile->getAttribute('pi_' . $params['payment_method']);
if (!isset($payment_instrument_id)) {
$payment_instrument_id = $profile->getAttribute('pi_' . $params['payment_method'], '');
if ('' !== $payment_instrument_id) {
throw new CRM_Core_Exception(
E::ts('Payment method could not be matched to existing payment instrument.'),
'invalid_format'
@ -101,7 +101,7 @@ class CRM_Twingle_Submission {
// matches (i.e. an unknown gender was submitted).
if (is_string($params['user_gender'])) {
$gender_id = $profile->getAttribute('gender_' . $params['user_gender']);
if (!isset($gender_id)) {
if (!is_numeric($gender_id)) {
throw new CRM_Core_Exception(
E::ts('Gender could not be matched to existing gender.'),
'invalid_format'