woocommerce/woocommerce
Fieldset verification is incorrect if the value does not exist in the field array.
クローズ
#30,897 opened on 2021/10/07
CheckoutEnhancementGood First IssueRubikplugin: woocommerce
Repository metrics
- Stars
- (10,294 個のスター)
- PR merge metrics
- (平均マージ 9d 12h) (30d で 423 merged PRs)
説明
If you request a non-existent field with the function, it throws an "Undefined index" notice. Since $this->fields is not null, but the $fieldset parameter is not an empty string, e.g. 'foo', then the first condition would return $this->fields['foo'], but it may not exist.
Suggestion for improvement.
return array_key_exists($fieldset, $this->fieldset) ? $this->fields[ $fieldset ] : $this->fields;
or
return isset($this->fieldset[$fieldset]) ? $this->fields[ $fieldset ] : $this->fields;