Menu

#15 documentation for is{field} for bools is misleading

open
1
2003-06-05
2003-06-05
Sandy Smith
No

In generated object (datatype) classes, boolean fields
get both a direct accessor that returns the stored
database value (0,1) and an is{fieldname} accessor that
returns a boolean type.

The documentation claims that is checks if the database
value is "non-zero", that is, if it is anything but
zero. However, it actually checks if it evaluates to
true, which is different than non-zero in PHP. Empty
values ('' or NULL) in the database will also evaluate
to false, not simply zero.

The docco should read "checks if it evaluates to false
(same logic as PHP's empty() function)".

Discussion


Log in to post a comment.