-
Notifications
You must be signed in to change notification settings - Fork 70
security-package/issues/127: Updated Save Config Validation class. #145
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
Conversation
…o security-package/issues/127 # Conflicts: # Securitytxt/Model/Config/Backend/Validate.php
1d31b7d
to
582fd09
Compare
$contactWebPage = ''; | ||
|
||
if ($this->existDataValue($contactWebPageFieldData)) { | ||
$contactWebPage = $this->getDataValue($contactWebPageFieldData); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$contactWebPage = ''; | |
if ($this->existDataValue($contactWebPageFieldData)) { | |
$contactWebPage = $this->getDataValue($contactWebPageFieldData); | |
} | |
if ($this->existDataValue($contactWebPageFieldData)) { | |
$contactWebPage = $this->getDataValue($contactWebPageFieldData); | |
} else { | |
$contactWebPage = ''; | |
} |
$result = ''; | ||
if (isset($fieldData['value'])) { | ||
$result = $fieldData['value']; | ||
} | ||
|
||
return $result; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$result = ''; | |
if (isset($fieldData['value'])) { | |
$result = $fieldData['value']; | |
} | |
return $result; | |
return $fieldData['value'] ?: ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems this construction not working,
if not exist array element with key - value
Updated with following construction
return isset($fieldData['value']) ? $fieldData['value'] : '';
if (isset($fieldData['value'])) { | ||
if ($fieldData['value'] !== '' || empty($fieldData['value'])) { | ||
return true; | ||
} | ||
} | ||
|
||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (isset($fieldData['value'])) { | |
if ($fieldData['value'] !== '' || empty($fieldData['value'])) { | |
return true; | |
} | |
} | |
return false; | |
return isset($fieldData['value']) && $fieldData['value'] !== ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated with following construction -
return isset($fieldData['value']) && ($fieldData['value'] !== '' || empty($fieldData['value']));
Because need also to check form data for empty value.
if ($this->existDataValue($fieldData[$key]) && $this->getDataValue($fieldData[$key]) === '') { | ||
return true; | ||
} | ||
|
||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if ($this->existDataValue($fieldData[$key]) && $this->getDataValue($fieldData[$key]) === '') { | |
return true; | |
} | |
return false; | |
return ($this->existDataValue($fieldData[$key]) && $this->getDataValue($fieldData[$key]) === ''); |
if ($this->isEmptyValue('email', $contactInformationFields) | ||
&& $this->isEmptyValue('phone', $contactInformationFields) | ||
&& $this->isEmptyValue('contact_page', $contactInformationFields)) { | ||
return true; | ||
} | ||
|
||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if ($this->isEmptyValue('email', $contactInformationFields) | |
&& $this->isEmptyValue('phone', $contactInformationFields) | |
&& $this->isEmptyValue('contact_page', $contactInformationFields)) { | |
return true; | |
} | |
return false; | |
return $this->isEmptyValue('email', $contactInformationFields) | |
&& $this->isEmptyValue('phone', $contactInformationFields) | |
&& $this->isEmptyValue('contact_page', $contactInformationFields); |
$contactEmail = ''; | ||
|
||
if ($this->existDataValue($contactEmailFieldData)) { | ||
$contactEmail = $this->getDataValue($contactEmailFieldData); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$contactEmail = ''; | |
if ($this->existDataValue($contactEmailFieldData)) { | |
$contactEmail = $this->getDataValue($contactEmailFieldData); | |
} | |
if ($this->existDataValue($contactEmailFieldData)) { | |
$contactEmail = $this->getDataValue($contactEmailFieldData); | |
} else { | |
$contactEmail = ''; | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
/** | ||
* Validate Email | ||
*/ | ||
$this->validateContactEmail($contactInformationFields['email']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will lead to PHP notice undefined key if "email" is not present. The same for the other cases.
Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
Need to change to |
Closing in favor of #226 |
Description (*)
Fixed Issues (if relevant)
Manual testing scenarios (*)
Questions or comments
Contribution checklist (*)