You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying v5.0.0RC4 with PHP8.1.
In the class that extends \Phalcon\Forms\Form, we specified validation when defining the element.
$elm->addValidators([
new Validator\Digit([
'message' => 'Invalid number of reservations',
'allowEmpty' => false,
]),
new Validator\Between([
'minimum' => 0,
'maximum' => 15
])
]);
I expect it to be a number from 0 to 15, but I want to make an error for other numbers, strings, and unset (null or '').
But with the above configuration, I get this error. Deprecated: ctype_digit(): Argument of type null will be interpreted as string in the future
This is probably because the specification of ctype_*() has changed since PHP8.1, but Phalcon currently does not support it.
It would allow an unexpected value, but at the moment it's unavoidable, so even if I change it to Validator\Numericality, it won't recognize the posted value.
After trying various things, it seems that there is a problem with the name of the element.
I receive the form data in an array because it takes less time to process it after it is received.
For example:
It is often used in select/option instead of input.
(There are cases where multiple checkboxes are collectively acquired as name="cb[]")
So I write the following in form::initialize().
With this, you can get the HTML element with the name with [ ] in the view, but it doesn't seem to understand it during validation.
If you change "order[1]" to "order1", it will be processed without problems, but considering the processing after receiving it, I would like to receive it as an array.
Is it a problem that you can set it and output HTML tags, but you can't validate it?
I'm trying v5.0.0RC4 with PHP8.1.
In the class that extends \Phalcon\Forms\Form, we specified validation when defining the element.
I expect it to be a number from 0 to 15, but I want to make an error for other numbers, strings, and unset (null or '').
But with the above configuration, I get this error.
Deprecated: ctype_digit(): Argument of type null will be interpreted as string in the future
This is probably because the specification of ctype_*() has changed since PHP8.1, but Phalcon currently does not support it.
It would allow an unexpected value, but at the moment it's unavoidable, so even if I change it to Validator\Numericality, it won't recognize the posted value.
After trying various things, it seems that there is a problem with the name of the element.
I receive the form data in an array because it takes less time to process it after it is received.
For example:
It is often used in select/option instead of input.
(There are cases where multiple checkboxes are collectively acquired as
name="cb[]"
)So I write the following in form::initialize().
With this, you can get the HTML element with the name with [ ] in the view, but it doesn't seem to understand it during validation.
If you change "order[1]" to "order1", it will be processed without problems, but considering the processing after receiving it, I would like to receive it as an array.
Is it a problem that you can set it and output HTML tags, but you can't validate it?
Originally posted by @s-ohnishi in #16057
The text was updated successfully, but these errors were encountered: