Odd Division By Zero Error

So I have

$dataProvider = new CActiveDataProvider('Objects');

in my controller that is then passed into a view where it is used by a CListView as the dataProvider, where $data is used in a JCollapsibleFieldset, where

array('data'=>$data->stagesx, 'bname'=>'Stages') //$data->stagesx is a relation in the Objects model

is passed into another view. I don’t believe any of the above to be a contributing factor but then again I am the one with the error.

Now in this last view I have

$t = count($data);

which returns 3 "five ways to Sunday!". The following three snippets

$r = 1/$t;

$r = 1/(int)$t;

$r = 1/($t+1-1);

all return ‘Division by zero’ but

$r = 1/($t+.000001);

returns 0.33333322222

As I stated the variable $t definitely appears to hold the value of 3. What am I missing here??