Skip to content

Conversation

@wutsch0
Copy link

@wutsch0 wutsch0 commented Jun 27, 2018

Due to loose comparision in in_array() unexpected results occure, i.e.:
$value = 0 results in cleaning the value to true instead of false
because in_array(0, ['true', 't', 'yes', 'y', 'on', '1']) = true since
0 == 'true' => 0 === (int)'true' => 0 === 0

To fix that enable type strict comparison in in_array() and add boolean values as well as usual integer values to 'true_values' and 'false_values' options

Use strict comparison in `in_array()` and add boolean and usual integer values
to 'true_values' and 'false_values' options
@wutsch0 wutsch0 merged commit 9e5fa52 into master Mar 19, 2020
@wutsch0 wutsch0 deleted the fix-sfValidatorBoolean branch March 19, 2020 08:46
MiguelAlcaino pushed a commit that referenced this pull request Aug 18, 2023
MiguelAlcaino pushed a commit that referenced this pull request Aug 18, 2023
ValueError: fread(): Argument #2 ($length) must be greater than 0

TypeError: count(): Argument #1 ($value) must be of type Countable|array Foo Given
Use Symfony Polyfill symfony/polyfill@d330c00

TypeError: count(): Argument #1 ($value) must be of type Countable|array, string given
Do not use Symfony pollyfill, is_array is enought
MiguelAlcaino pushed a commit that referenced this pull request Aug 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants