Boolean no longer allowed in user preferences for 9.1+

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Boolean no longer allowed in user preferences for 9.1+

Joas Schilling
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

_______________________________________________
Devel mailing list
[hidden email]
http://mailman.owncloud.org/mailman/listinfo/devel