http://api.drupal.org/api/function/node_access_grants/5 does not specify what should be returned if the result set is empty.

As far as I can see, it doesn't matter for module_invoke_all(), but if someone wants to call the hook function directly, then returning an empty array would allow them to use the result in foreach().

So, is it better to return NULL or array()? Should that be specified in the API documentation?

Comments

Folkert’s picture

salvis’s picture

Yes, I meant http://api.drupal.org/api/function/hook_node_grants/5.

Should hook_node_grants return NULL or an empty array, or even a realm with an empty array (assuming "linear list" means "array"?

salvis’s picture

I've been told not to return anything if I have nothing to return.