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

webchick’s picture

Status: Reviewed & tested by the community » Needs review

This is not reviewed.

chx’s picture

Status: Needs review » Needs work

[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

josh waihi’s picture

Status: Needs work » Needs review
StatusFileSize
new879 bytes

ok cool, turns out format was purposely being created as an empty string so I replaced it with FILTER_FORMAT_DEFAULT FTW.

chx’s picture

Status: Needs review » Reviewed & tested by the community

That's a LOT more pretty.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed to HEAD! Yay! :D

dries’s picture

Committed to CVS HEAD. Thanks a lot!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.