LSform/LSformRule: Handle rule without options or message

This commit is contained in:
Benjamin Renard 2021-07-19 16:47:20 +02:00
parent 3298320b3d
commit 531991a1e5

View file

@ -253,6 +253,11 @@ class LSattribute extends LSlog_staticLoggerClass {
$check_data = $this -> getConfig('check_data', array()); $check_data = $this -> getConfig('check_data', array());
if(is_array($check_data)) { if(is_array($check_data)) {
foreach ($check_data as $rule => $rule_options) { foreach ($check_data as $rule => $rule_options) {
// Handle rule without options or message
if (is_int($rule) && is_string($rule_options)) {
$rule = $rule_options;
$rule_options = array();
}
// Check rule // Check rule
if(!is_empty($rule) && !$form -> isRuleRegistered($rule)) { if(!is_empty($rule) && !$form -> isRuleRegistered($rule)) {
LSerror :: addErrorCode('LSattribute_03', array('attr' => $this->name, 'rule' => $rule)); LSerror :: addErrorCode('LSattribute_03', array('attr' => $this->name, 'rule' => $rule));