Skip to content
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

[BUG]: Some Custom Validators don't handle the allowEmpty #15515

Closed
quasipickle opened this issue Jun 2, 2021 · 1 comment · Fixed by #15772
Closed

[BUG]: Some Custom Validators don't handle the allowEmpty #15515

quasipickle opened this issue Jun 2, 2021 · 1 comment · Fixed by #15772
Assignees
Labels
5.0 The issues we want to solve in the 5.0 release bug A bug report status: medium Medium

Comments

@quasipickle
Copy link
Contributor

quasipickle commented Jun 2, 2021

I'm trying to use the built-in Date validator in 4.1.2, and it seems to be ignoring the "allowEmpty" option.

Something analogous to this still generates an error when payment_2_date is NULL;

$Validator->add(
	[
		'payment_1_date',
		'payment_2_date'
	],
	new Date([
		'format'=>[
			'payment_1_date'=>'Y-m-d',
			'payment_2_date'=>'Y-m-d H:i:s'
		]
		'message'=>[
			'payment_1_date'=>'Payment 1 date is not valid',
			'payment_2_date'=>'Payment 2 date is not valid'
		]
		'allowEmpty'=>[
			'payment_1_date'=>FALSE,
			'payment_2_date'=>TRUE
		]
	])
);

Looking at the Zephir source for the Date validator, it has allowEmpty() as an option in the comments for __construct(), but doesn't act on it anywhere. I also checked the Alnum and Alpha validators - same deal.

I know comments in Zephir source code aren't considered "public documentation", but there's been a mistake somewhere - either in copy-pasting the comments, or omitting this necessary functionality.

@quasipickle quasipickle added bug A bug report status: unverified Unverified labels Jun 2, 2021
@BeMySlaveDarlin BeMySlaveDarlin added 5.0 The issues we want to solve in the 5.0 release and removed status: unverified Unverified labels Nov 7, 2021
BeMySlaveDarlin pushed a commit to BeMySlaveDarlin/cphalcon that referenced this issue Nov 7, 2021
BeMySlaveDarlin pushed a commit to BeMySlaveDarlin/cphalcon that referenced this issue Nov 7, 2021
BeMySlaveDarlin pushed a commit to BeMySlaveDarlin/cphalcon that referenced this issue Nov 7, 2021
@BeMySlaveDarlin BeMySlaveDarlin linked a pull request Nov 7, 2021 that will close this issue
5 tasks
BeMySlaveDarlin pushed a commit to BeMySlaveDarlin/cphalcon that referenced this issue Nov 7, 2021
BeMySlaveDarlin pushed a commit to BeMySlaveDarlin/cphalcon that referenced this issue Nov 7, 2021
@niden niden added the status: medium Medium label Nov 7, 2021
@niden
Copy link
Member

niden commented Nov 7, 2021

Resolved in #15772

@niden niden closed this as completed Nov 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5.0 The issues we want to solve in the 5.0 release bug A bug report status: medium Medium
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants