Skip to content

Conversation

engcom-Kilo
Copy link
Contributor

Description (*)

Fixed Issues (if relevant)

  1. Configuration cannot be saved in scope that is different from Default Config #127: Configuration cannot be saved in scope that is different from Default Config

Manual testing scenarios (*)

  1. ...
  2. ...

Questions or comments

Contribution checklist (*)

  • Author has signed the Adobe CLA
  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds are green)

@engcom-Kilo engcom-Kilo force-pushed the security-package/issues/127 branch from 1d31b7d to 582fd09 Compare March 13, 2020 12:16
Comment on lines 122 to 126
$contactWebPage = '';

if ($this->existDataValue($contactWebPageFieldData)) {
$contactWebPage = $this->getDataValue($contactWebPageFieldData);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$contactWebPage = '';
if ($this->existDataValue($contactWebPageFieldData)) {
$contactWebPage = $this->getDataValue($contactWebPageFieldData);
}
if ($this->existDataValue($contactWebPageFieldData)) {
$contactWebPage = $this->getDataValue($contactWebPageFieldData);
} else {
$contactWebPage = '';
}

Comment on lines 159 to 164
$result = '';
if (isset($fieldData['value'])) {
$result = $fieldData['value'];
}

return $result;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$result = '';
if (isset($fieldData['value'])) {
$result = $fieldData['value'];
}
return $result;
return $fieldData['value'] ?: '';

Copy link
Contributor Author

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'] : '';

Comment on lines 175 to 181
if (isset($fieldData['value'])) {
if ($fieldData['value'] !== '' || empty($fieldData['value'])) {
return true;
}
}

return false;
Copy link
Contributor

@engcom-Foxtrot engcom-Foxtrot Mar 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (isset($fieldData['value'])) {
if ($fieldData['value'] !== '' || empty($fieldData['value'])) {
return true;
}
}
return false;
return isset($fieldData['value']) && $fieldData['value'] !== '';

Copy link
Contributor Author

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.

Comment on lines 193 to 197
if ($this->existDataValue($fieldData[$key]) && $this->getDataValue($fieldData[$key]) === '') {
return true;
}

return false;
Copy link
Contributor

@engcom-Foxtrot engcom-Foxtrot Mar 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if ($this->existDataValue($fieldData[$key]) && $this->getDataValue($fieldData[$key]) === '') {
return true;
}
return false;
return ($this->existDataValue($fieldData[$key]) && $this->getDataValue($fieldData[$key]) === '');

Comment on lines 208 to 214
if ($this->isEmptyValue('email', $contactInformationFields)
&& $this->isEmptyValue('phone', $contactInformationFields)
&& $this->isEmptyValue('contact_page', $contactInformationFields)) {
return true;
}

return false;
Copy link
Contributor

@engcom-Foxtrot engcom-Foxtrot Mar 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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);

Comment on lines 101 to 105
$contactEmail = '';

if ($this->existDataValue($contactEmailFieldData)) {
$contactEmail = $this->getDataValue($contactEmailFieldData);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$contactEmail = '';
if ($this->existDataValue($contactEmailFieldData)) {
$contactEmail = $this->getDataValue($contactEmailFieldData);
}
if ($this->existDataValue($contactEmailFieldData)) {
$contactEmail = $this->getDataValue($contactEmailFieldData);
} else {
$contactEmail = '';
}

Copy link
Contributor Author

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']);
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

@lenaorobei
Copy link
Contributor

Need to change to showInStore="0" in system.xml and try to get rid of Validator. Use default magento functionality instead (depends on).

@lenaorobei lenaorobei changed the base branch from 1.0-develop to 1.0.0-develop May 20, 2020 19:45
@lenaorobei lenaorobei added this to the 1.0.0 milestone May 20, 2020
@lenaorobei
Copy link
Contributor

Closing in favor of #226

@lenaorobei lenaorobei closed this May 21, 2020
@lenaorobei lenaorobei deleted the security-package/issues/127 branch June 10, 2020 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Configuration cannot be saved in scope that is different from Default Config
4 participants