Menu

#241 Use count function when checking for existence of user setting

open
nobody
None
5
2014-08-09
2014-08-09
MD Support
No

library/user.inc currently uses empty(row) to detect an user setting. If the setting value is 0, this causes PHP to return empty even though the setting exists. Two patches here use COUNT function to fix this.

Ideally the check should be number of rows rather than empty(row).

Patch 1
Patch 2

Discussion

  • Brady Miller

    Brady Miller - 2014-08-09

    Have you confirmed this bug? Very odd, since $result is not the actual value, but is the returned array from the query (so should be array($setting_label['0']) when set to 0) which should not be true for empty() call of $result).

    (Removed my getUserSetting() comment since not correct)

     

    Last edit: Brady Miller 2014-08-09
  • Brady Miller

    Brady Miller - 2014-08-09

    Note that the sql_query function returns a FALSE when the query returns nothing. And I can't see when a return value will be 0 in those queries for a query that catches something?

     

    Last edit: Brady Miller 2014-08-09

Log in to post a comment.