@@ -33,8 +33,8 @@ class sfValidatorBoolean extends sfValidatorBase
3333 */
3434 protected function configure ($ options = array (), $ messages = array ())
3535 {
36- $ this ->addOption ('true_values ' , array ('true ' , 't ' , 'yes ' , 'y ' , 'on ' , '1 ' , 1 , true ));
37- $ this ->addOption ('false_values ' , array ('false ' , 'f ' , 'no ' , 'n ' , 'off ' , '0 ' , 0 , false ));
36+ $ this ->addOption ('true_values ' , array ('true ' , 't ' , 'yes ' , 'y ' , 'on ' , '1 ' ));
37+ $ this ->addOption ('false_values ' , array ('false ' , 'f ' , 'no ' , 'n ' , 'off ' , '0 ' ));
3838
3939 $ this ->setOption ('required ' , false );
4040 $ this ->setOption ('empty_value ' , false );
@@ -45,12 +45,13 @@ protected function configure($options = array(), $messages = array())
4545 */
4646 protected function doClean ($ value )
4747 {
48- if (in_array ($ value , $ this ->getOption ('true_values ' ), true ))
48+ $ stringValue = $ value !== false ? (string ) $ value : '0 ' ;
49+ if (in_array ($ stringValue , $ this ->getOption ('true_values ' )))
4950 {
5051 return true ;
5152 }
5253
53- if (in_array ($ value , $ this ->getOption ('false_values ' ), true ))
54+ if (in_array ($ stringValue , $ this ->getOption ('false_values ' )))
5455 {
5556 return false ;
5657 }
0 commit comments