Should test that $object is a an object before using it as NULL may be passed to this function.