[development] hook_comment() php5 issues
gordon at heydon.com.au
Wed Nov 23 23:10:51 UTC 2005
I have had a problem with the hook_comment() which is that the $comment
var is not consistent.
If it is called with the insert or update operation then the $comment is
passed as an array(), where as the delete operation is an object.
For php4 this doesn't matter so much, but in php5 you cannot treat an
object as an array without getting a fatal error.
Also from my quick investigation this is also going to be an issue with
4.7 as the edits are passing array's and the delete is an object.
My question is, which way should it be so that I can roll a patch for
both 4.6 and 4.7.
Looking at the api, and other implementations of the hook_comment() I
think it should be an array, but I think this is a little inconsistent
with other parts of drupal such as nodes which are always objects.
However making it an array means that it is a very small patch (change
db_fetch_object() t db_fetch_array())
Thanks for any input.
More information about the development