Open
Description
Version: 3.2.2 (still present in master)
Bug Description
If addFilter()
method is used BEFORE other rules, they are dropped and passed to HTML. Even documentation states that:
The filter is included between the validation rules and conditions and therefore depends on the order of the methods, i.e. the filter and the rule are called in the same order as is the order of the addFilter() and addRule() methods.
Steps To Reproduce
Nette fiddle ilustrating the problem.
Expected Behavior
All rules should be exported.
Possible Solution
Fix Nette\Forms\Helpers
to NOT to exit whole foreach
loop, when rule is not exportable.
namespace Nette\Forms;
use Nette;
use Nette\Utils\Html;
use Nette\Utils\Image;
use Nette\Utils\Strings;
/**
* Forms helpers.
*/
final class Helpers
public static function exportRules(Rules $rules): array
{
$payload = [];
foreach ($rules as $rule) {
if (!$rule->canExport()) {
if ($rule->branch) {
continue;
}
/**
* 👇 this is the problem, when replaced
* by continue; seems to works, but I am not sure
* it doesn't break something else
*/
break;
}
Metadata
Metadata
Assignees
Labels
No labels