Validate::boolean does not appear to be working

Validate::boolean does not appear to be working

csdatumcsdatum Posts: 30Questions: 10Answers: 0

We are currently working with Editor php version 1.6.5 and the built in boolean validation function is responding with 'Please enter true or false' when any false/0 value is submitted. I did a little digging into the code and line 365 of Editor/Validate.php has the following:

if ( filter_var($val, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) === false ) {

I believe filter_var is returning false for all false/0 values and null if the value is not valid. So I false should actually be replaced with null in this line.

if ( filter_var($val, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) === null ) {

Can someone confirm that this is the case. Thanks!

Replies

  • allanallan Posts: 61,920Questions: 1Answers: 10,153 Site admin

    Completely agree. Thanks for pointing that out. I've tested it locally and that change will be in the next release of Editor.

    Regards,
    Allan

This discussion has been closed.