filter_list_format uses db_select to select a filter based on a format given by a numeric field:
$result = db_select('filter', 'filter')
->fields('filter')
->condition('format', $format)
->condition('status', 1)
->orderBy('weight')
->orderBy('module')
->orderBy('name')
->execute();
$format is a string (but is numeric) and when $format = '0', php passes the value as an empty string. PostgreSQL chokes and provides a invalid text representation of a numeric field error message. This is an easy fix, $format needs to be type casted to a number before passing as an argument to db_select.
- ->condition('format', $format)
+ ->condition('format', (int) $format)
This fixes 20+ fails on PostgreSQL
Comments
Comment #1
webchickThis is not reviewed.
Comment #2
chx commented[05:15] <fiasco> chx: that would make sense as form data comes in strings right?
[05:15] <chx> i cant really see what's going on here
[05:15] <chx> form data might but form API data?
[05:15] <chx> isnt it pullijng from array keys?
[05:16] <chx> this is much deeper than it looks
[05:16] <chx> i would like to see more research on
[05:16] <chx> a) why is this a string
[05:16] <chx> b) if it is a string what else is affected? if all radios produce this crap?
[05:16] <chx> how format can be 0 also?
[05:16] <chx> i thought checkboxes with a 0 index are not supported
[05:16] <chx> or maybe this is not checkbxoes?
[05:16] <chx> many questions
Comment #3
josh waihi commentedok cool, turns out format was purposely being created as an empty string so I replaced it with FILTER_FORMAT_DEFAULT FTW.
Comment #4
chx commentedThat's a LOT more pretty.
Comment #5
webchickCommitted to HEAD! Yay! :D
Comment #6
dries commentedCommitted to CVS HEAD. Thanks a lot!