thobbs/phpcassa — Issue #55: Column name of 0 on insert causes exception
Author: akolster
Created: 2011-12-06 19:25:49+00:00
State: open

Inserting a column with the name of 0 and value of x results in

HP Fatal error: Uncaught exception 'TApplicationException' with message 'Required field 'name' was not present!

I traced this down to the following in function pack_name of columnfamily.php:

if ($value == null) {
return;

The value (column name) at this point is 0 which when compared to a null using '==' will evaluate to true and return no packed name.

The if statement should be if ( is_null($value)) or if ($value === null ) which will return the proper evaluation.
This occurs in several spots in the code.

Not sure why this wasn't found before, unless no one uses 0 for a column name, which I do for sequential columns.

Please comment.

Thanks