Page MenuHomePhabricator

Widget validate modifier gives negative false on '0'
Closed, ResolvedPublic

Description

Author: armeagle

Description:
When testing the string '0' for validity as 'int', the modifier returns the empty string.

This is because the conditional test for simple equality to TRUE:

modifier.validate.php (Feb 10 2009) :
if (array_key_exists($type, $filters) && filter_var($string, $filters[$type]))

Since filter_var returns the filtered data, in this case 0, this test is FALSE. Instead this line should be like this:

if (array_key_exists($type, $filters) && filter_var($string, $filters[$type]) !== FALSE)


Version: unspecified
Severity: normal

Details

Reference
bz25219

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:11 PM
bzimport set Reference to bz25219.

armeagle wrote:

I just want to add that this is with the Widgets extension version 0.9f.

sergey.chernyshev wrote:

Yep, seems reasonable. Fixed in r73350. Please test and let me know if that helped.