Comments

hass’s picture

+

hass’s picture

Title: Core API Namespace collision with hook_profile_load() » API Namespace collision with hook_profile_load()

Changed topic. Unverified bugreport, but this is what has been reported in the referenced case.

hass’s picture

Title: wysiwyg_profile_load() is being hooked by googleanalytics » Core API Namespace collision with hook_profile_load()
twod’s picture

Title: API Namespace collision with hook_profile_load() » Namespace collision with hook_profile_load()
Status: Active » Postponed (maintainer needs more info)

Drupal Core (profile.module) does not provide hook_profile_load(), nor does Content profile module as far as I can tell.

hass’s picture

twod’s picture

That's not a hook implementation or a function calling a hook, it's just a regular function used to load data from profile.module's tables, called directly by profile.module itself. No other functions named MODULENAME_load_profile will be called in this process.

sun’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

Like TwoD, I fail to see 1) a proper bug report 2) an actual error message and lastly 3) evidence for the hypothetical namespace collision here.

greg.harvey’s picture

Project: Wysiwyg » Google Analytics
Version: 6.x-2.1 » 6.x-3.x-dev
Status: Closed (cannot reproduce) » Active

Quite. Rather than start a new issue, the namespace collision seems to be with the Google Analytics module. To expand:

1) Bug report:

Google Analytics provides a hook called hook_load_profile() - see line 93 of googleanalytics.module 6.x-3.x-dev or/and line 101 of googleanalytics.module 6.x-2.2. This is a problem because there is a core function in the Profile module, linked to by hass above, that is *not* in fact a hook, but Google Analytics attempts to invoke it as though it were. Causing...

2) The error message:

Parameter 1 to profile_load_profile() expected to be a reference ... etc.

3) I think it's fairly obvious now, but it's not with WYSIWYG and it took me a while to understand what was going on. ;-)

The solution is to rename the Google Analytics hook to something else that does not interfere with a core function. I'm surprised we don't see stuff like this more often, actually, given the number of lines of code being written. Edit: or if this is not supposed to be a hook at all, but merely an attempt to load profile_load_profile(), then just call it directly - the intended use - no need to 'invoke' it.

greg.harvey’s picture

And this patch against 6.x-2.2, #8 here: #679404: Warning: Parameter 1 to profile_load_profile() expected to be a reference, value given in module_invoke(), was on the right track - in fact, that probably *is* the patch for 6.x-2.2, unless the intention was to provide a hook (but I don't think it was). You just need something similar for 6.x-3.x-dev:
http://drupal.org/files/issues/google-analytics-679404.patch

hass’s picture

Status: Active » Fixed

Stopped hook'ing other module functions not officially documented as hooks.

greg.harvey’s picture

Awesome, thanks. =)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.