[owncloud-devel] Boolean no longer allowed in user preferences for 9.1+

Joas Schilling nickvergessen at owncloud.com
Wed Jun 8 08:42:13 GMT 2016


Hi Devs,

we merged a patch for 9.1 which throws an exception, when you try to 
store anything
but a string, integer or float in the user preferences. The problem is, 
that not all dbs
behave the same with e.g. boolean values. Postgres stores them as string 
'f' and 't',
so when you later grab the value and make a boolean comparison, even 
false will be true.

To prevent more developers from running into the issue, we went the save 
way.
In order to fix your app, you can follow the example of the activity app 
and cast your
value to integer, before setting, and casting the int to bool when getting:
https://github.com/owncloud/activity/pull/499/files

cheers nickvergessen



More information about the Devel mailing list