After code reviewing, this should be moved to where partial is actually set at line 40, where the if statement should probably be:
~~~
if(is_array($fields)&&$fields!==array())
    partial=true;
else
    $fields=array();
~~~