Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I get the mentioned error when i enable Google Analytics module. I believe the problem is PHP5.3.1 which i have running the website.
At this point module is unusable, so i had to take it off as its unacceptable to have such message displayed to users.
Im looking forward to solution.
Comment | File | Size | Author |
---|---|---|---|
#78 | googleanalytics.2.2.patch | 593 bytes | kenorb |
#76 | googleanalytics.patch | 0 bytes | kenorb |
#27 | ga_hook_user_load3_6x.patch | 3.63 KB | hass |
#26 | ga_hook_user_load3.patch | 2.96 KB | hass |
#25 | ga_hook_user_load2_6x.patch | 1.23 KB | hass |
Comments
Comment #1
hass CreditAttribution: hass commentedThis seems not to be the complete error message. Write down how to repro, please.
Comment #2
culturehub CreditAttribution: culturehub commentedI see the same problem. As soon as the module is enabled, I get the following error message on every page.
No choice but to disable the module. Running PHP 5.3.0 and Drupal 6.15.
Comment #3
culturehub CreditAttribution: culturehub commentedI did what this guy did, http://drup.org/drupal-and-php-53
Change
$p = module_invoke('profile', 'load_profile', $user);
to
$p = call_user_func('profile_load_profile', $user);
Worked for me.
Comment #4
hass CreditAttribution: hass commentedSounds like a core bug
Comment #5
iva.dcc CreditAttribution: iva.dcc commentedcool, i did similar thing, except that i changed
$p = module_invoke('profile', 'load_profile', $user);
to
$p = module_invoke('profile', '_load_profile', $user);
and the error went away, but i still disabled it, because i am not sure about the repercussions of the change.
Comment #6
jamuraa CreditAttribution: jamuraa commentedYou cannot use module_invoke to pass by reference, which is what the profile_load_profile needs in order to work (it modifies the $user argument). This isn't going to be fixed any time soon - see http://drupal.org/node/353494 scheduled for Drupal 8.x.
The entire error message is:
warning: Parameter 1 to profile_load_profile() expected to be a reference, value given in /var/www/test-site3/includes/module.inc on line 450.
Repro is easy:
1. Set up drupal on a site running PHP 5.3
2. Enable Google Analytics module.
I've fixed it by using profile_load_profile directly like so:
$p = profile_load_profile($user)
There is a secondary bug, which is that this profile_load_profile is loaded even when you don't have segmentation turned on for any user profiles. If there aren't any profiles checked, you could avoid the call alltogether by checking the size of the $profile_fields array before loading up the profile - if it is 0, then no need to load the profile to check the values.
@5: I think modifying it in that way disables the profile loading alltogether, so if you were using user profile segmentation, it would be disabled by the code change.
Comment #7
Catx CreditAttribution: Catx commentedSame problem since 3 days. Actualy why warning occur. Which module i'll have to disable? Adsense, or which? Please tell me in easy way. If above code to use then where i write and page located. In details please.
Comment #8
jamuraa CreditAttribution: jamuraa commentedPatch attached to fix this bug.
Comment #9
hass CreditAttribution: hass commentedSounds more and more like a core bug to me. Module invoke schould invoke all modules that have profile load hooks and not only the profile module. As module invoke is a core api function, this is a bug in core.
Comment #10
hass CreditAttribution: hass commentedCross linked #360605: PHP 5.3 Compatibility
Comment #11
hass CreditAttribution: hass commentedTagging
Comment #12
BerdirYou can't use module_invoke_all() or module_invoke() for functions that contain by reference arguments, instead, you have to call the function directly or with $function. This is not a Drupal core issue since the argument needs to be by reference but a PHP problem related to call_user_func_array().
You're not using module_invoke_all() so I don't understand your comment in #9, you only call profile.module. The only thing that module_invoke() does more than the direct call is check of the function is available.
If you want to call all load_profile() "hooks", you need to use a custom foreach loop with module_implements:
But again, you're not doing that currently either.
Comment #13
BerdirCrosspost...
Comment #14
hass CreditAttribution: hass commentedLooks like you have found a bug :-). Never tested it as there was no other module that provided the profile_load hook, but we need this for #214560: Extend user object like profile module does or #654632: Compatibility with Google Analytics' advanced segmentation - whatever get's in earlier.
Comment #15
iva2k CreditAttribution: iva2k commentedsubscribe
Comment #16
Catx CreditAttribution: Catx commentedI try everything. And search everything in drupal. I apply patch too. At last i remove analytic from module. That many bug so error. Plz reply if anyone has good working site of analytic module for php 5.3. I wait.
Comment #17
b3liev3 CreditAttribution: b3liev3 commentedI've applied that pach and it seems to work fine.
Comment #18
jackbravo CreditAttribution: jackbravo commentedYup, I applied the patch too and seems to work ok.
Comment #19
hass CreditAttribution: hass commented@culturehub: #3. I cannot test this now as I do not have PHP 5.3 dev environment yet, but if it solves the issue it may be the fix here. May be broken if the profile module is disabled.
@jamuraa: #8. Needs work as it should break the site if the profile module is disabled.
@Berdir: #12. As I understood this line of code taken over from very very old code... was to execute one function that populates the $user object and than only use the user object and do not fill another variable with the same content... I need to think more about this...
Comment #20
kwinters CreditAttribution: kwinters commentedThe patch #8 isn't quite complete because it doesn't validate that the module is enabled / the function exists. However it's the right general idea. is_callable maybe?
Berdir in #12 is correct about this not being a core issue (not that it even matters, since a workaround is still required before that core change would even be possible to make in D8+).
Comment #21
bryanb229 CreditAttribution: bryanb229 commentedSubscribing.
Comment #22
hass CreditAttribution: hass commentedI tried to use the code in #12, but it seems to do something that was not the intention of the current code and only returns NULL.
Now updated the D7 version and added some comments. I have not tested this under PHP 5.3, but it works well for me under 5.2.
Comment #23
hass CreditAttribution: hass commentedOptimized version.
Comment #24
hass CreditAttribution: hass commentedAlso a bit cleanup for D6
Comment #25
hass CreditAttribution: hass commentedagain
Comment #26
hass CreditAttribution: hass commented@jamuraa: Patch stops now running the module invoke if there are no profile fields selected for tracking.
Comment #27
hass CreditAttribution: hass commentedComment #28
hass CreditAttribution: hass commentedCommited
Comment #29
hass CreditAttribution: hass commentedComment #30
hass CreditAttribution: hass commentedAlso commited D6 code to 2.x and 3.x
Comment #31
hass CreditAttribution: hass commentedI guess this code changes may not fixed the warning issue the case was opened for... not sure. You need profile module enabled and at least one field to track and PHP 5.3. But I cannot remove a reference in the core hook
profile_load_profile(&$user)
and I do not see why I'm responsible for this... not sure if we need to write a special function likeuser_module_invoke('load', $array, $user);
to get rid of the warning.Comment #32
hass CreditAttribution: hass commentedCannot repro the warnings. Please try again with latest DEV.
I have tested this with xampp 1.7.3 with PHP 5.3.1 and
if ($errno & (E_ALL)) {
in common.inc with the latest 3.x I'm not able to see any warnings if 'User roles' are enabled for tracking.Comment #34
DarrellDuane CreditAttribution: DarrellDuane commentedI was getting these warnings and Patch 27 fixed my site. Drupal 6.17, Google Analytics 6.x-2.2, PHP: php-5.3.2-2.fc13.x86_64
Comment #35
mari3.14 CreditAttribution: mari3.14 commentedSorry, just got Google Analytics installed and I am getting the same warning:
warning: Parameter 1 to profile_load_profile() expected to be a reference, value given in /includes/module.inc on line 483.
If I unable Profile in Core and leave Google Analytics on, the warning doesn't appear. Or the other way around, Profile enable and Google Analytics off, the warning is not there. But with both enabled the warning appears.
Running:
Drupal 6.17
Google Analytics 6.x.3.x-dev (which has patch 27 on it already)
PHP 5.3
Wondering...
Comment #36
hass CreditAttribution: hass commentedCannot repro... Are you really using the latest dev?
Comment #37
mari3.14 CreditAttribution: mari3.14 commentedthanks for coming back to me so quickly hass.
Yes, I just checked again and I got version 6.x-3.x-dev.
I have a testing server where I have just reproduced the error. How strange. I would be very happy to give you User 1 Access to that site if you have a private email I can send the details to. I am happy for you to play around with it if that helps.
Cheerio,
Maria
Comment #38
hass CreditAttribution: hass commentedI guess it's more a php settings difference...
Comment #39
mari3.14 CreditAttribution: mari3.14 commentedMaybe..., nobody else seems to have the same problem so I wonder.
At home I have just upgraded my MAMP to the latest free version available which runs PHP 5.3.2. My hosting service is also running 5.3.2. The warning shows in both.
I will keep an eye on this post to see if anybody has any suggestions. Puzzeling! ;o)
Thanks
Maria
Comment #40
greg.harveyIt's difficult to follow what's going on here. Did anyone post a 6.x-2.2 patch? 6.x-3.x is all very well, but the recommended version is 6.x-2.2 and I need to patch that...
Edit: I see #8 *is* against 6.x-2.2, works for me. =)
Comment #41
a5342346 CreditAttribution: a5342346 commentedi seem to be getting this error, as well (which is how I ended up here):
Warning: Parameter 1 to profile_load_profile() expected to be a reference, value given in module_invoke() (line 462 of /path/to/includes/module.inc).
however, I do NOT have GoogleAnalytics module installed!
is there a known other/additional cause?
Comment #42
greg.harveySearch your code for
module_invoke('profile', 'load_profile', $user)
- you'll probably find some other module you have installed has the same bug.Edit: It might also be a
module_invoke_all()
causing the problem, so it might be good just to look for'load_profile'
.Comment #43
grub3 CreditAttribution: grub3 commentedIMHO a new stable release should be made.
I had a lot of error messages before I realized I had to upgrade to google analytics dev.
Comment #44
grub3 CreditAttribution: grub3 commentedSetting priority to critical.
I will not reopen this bug, but I would like to ... just to have a stable release.
Comment #45
hass CreditAttribution: hass commentedA wrong php config is no reason for making anything critical
Comment #46
markhalliwellI am not reopening this, but I figured that if anyone else is having issues, it might be because you also have the WYSIWYG module as well. It took me weeks to try and track down why I kept seeing this error:
Parameter 1 to profile_load_profile() expected to be a reference, value given in /Volumes/Disk2/jsd/includes/module.inc on line 483.
Which I then realized it's because #12 is right. So I used his code to replace the "accepted" patch, but ran into:
Illegal offset type in isset or empty in /Volumes/Disk2/jsd/sites/all/modules/wysiwyg/wysiwyg.module on line 596.
It turns out, that the WYSIWYG module implements an internal function named: wysiwyg_profile_load($format). Obviously the foreach method in #12 works just fine, but because we're passing the $user object, we get the above error because arrays and objects cannot be keys.
So, for those who need a working solution, even if it is temporary, use the following:
I will be creating a ticket for WYSIWYG to inform them to either convert their function to a private one or rename it so it doesn't conflict with this module.
Comment #51
hass CreditAttribution: hass commented#891514: Namespace collision with hook_profile_load()
Comment #52
ayalsule CreditAttribution: ayalsule commentedsubscribe
Comment #53
fm CreditAttribution: fm commentedWas a patch for 6.x-2.2 ever committed?
Comment #54
mari3.14 CreditAttribution: mari3.14 commentedFollowing my post number 35 a little above:
I have been fiddling around with the Google Analytics module Configuration page and in my case the error appeared/disappeared as follows:
Error display:
- When I had selected under "Add segmentation information to tracking code" the first line called 'User Roles'
Error gone:
- Well, as you can image, when I do not select 'User Roles'.
Cheerio,
Maria
Comment #55
Brian Tastic CreditAttribution: Brian Tastic commentedI'm adding my voice to this problem. I started getting the error message as stated above, after installing this module. de-activating the module, removes the issue.
I am developing this on a Linux machine, localhost.
I downloaded the latest stable version of the module; v6.2.2
shame, after watching the video intro, I was looking forward to the modules' statistical goodness.
(don't ask me any technical q's, I'm a lightweight at developing, I just install and switch modules on and off - don't laugh!!)
Comment #56
greg.harveyI think this is the real problem:
http://drupal.org/node/891514#comment-3441820
Though either this post or that one are probably a dupe. Not sure how WYSIWYG ever ended up in the spotlight... =/
Comment #57
Brian Tastic CreditAttribution: Brian Tastic commentedThanks for your work Greg. I'll be happy to wait for the module to be updated to 6.2.3 before giving it another go. I'm not too much in a rush as still developing the site and initial content.
Thanks also to the module's developer(s) and maintainer(s), as I'm sure it will be an excellent module.
(PS. just to confirm and inform, my LAMP stack is loaded with PHP 5.3)
Comment #58
hass CreditAttribution: hass commentedIt IS, but it will be excellent if You fix Your Drupal incompatible php 5.3 configuration.
Comment #59
greg.harvey@hass, did you read http://drupal.org/node/891514#comment-3441820 ?
I don't think it is PHP settings. You shouldn't be 'invoking'
profile_load_profile()
, as TwoD said here:http://drupal.org/node/891514#comment-3384366
Comment #60
JimiOBrien CreditAttribution: JimiOBrien commentedI'm not running Google Analytics or WYSIWYG and still get the error:
Warning: Parameter 1 to profile_load_profile() expected to be a reference, value given in /var/www/vhosts/site.co.uk/subdomains/sitename/httpdocs/includes/module.inc on line 462
D6.19, php 5.3.3
Comment #61
greg.harvey@Jimmy0, then some other module you installed is likely to be making the same mistake and invoking a 'load_profile' hook.Your problem does not belong in this issue. You'll have to work out which module is causing it and raise a bug report there. See #42. ^^
Comment #62
Brian Tastic CreditAttribution: Brian Tastic commented@hass, this seems rather harsh. I have read the comments of greg.harvey and his supplied link for further reading and he suggests whilst php5.3 is implicated, it's only because of PHP's namespace implementation and a variable name collision within this module's code.
If this is not the case and you think Greg is wrong, please can you tell me why that would be, and provide details on how I can fix my PHP 5.3 installation.
thanks
Comment #63
fm CreditAttribution: fm commentedSeems harsh? No, hass's remark was harsh; the tone was impolite and offensive. Moreover, it was materially wrong.
Drupal's System requirements page states:
PHP 5.3 has been a "Drupal compatible" configuration since v6.14, released September 16, 2009 -- almost exactly a year ago.
In its current state spewing umpteen lines of warning messages, the Google Analytics module is decidedly not excellent. Though, as Ascenti0n expressed, it can be excellent if this PHP compatibility issue is resolved and the Google Analytics module brought up to date and into line with Drupal's core.
Comment #64
greg.harveyIt would probably be constructive *not* to turn this in to 'flame a maintainer' day... ;-)
Can someone make a patch for the 6.x-3.x-dev branch so hass can review it?
Comment #65
fm CreditAttribution: fm commentedNo one is flaming the maintainer. If he doesn't have the time or inclination to fix the issue, he should just say so; but saying PHP 5.3 is incompatible with Drupal just isn't true. A civil tone is also desirable.
"Can someone make a patch for the 6.x-3.x-dev branch so hass can review it?"
Seconded.
Comment #66
hass CreditAttribution: hass commentedDoes one of the complainer's really understand the difference between a warning and an error? The answer must be NO.
* Do not complain if you do not understand the difference between warnings (no technical problem, no malfunction) and errors (malfunction).
* Code may give such a PHP warning under PHP 5.3, but is NOT broken!!!
* This module is very very very stable.
* Never use DEV versions if you are not a developer.
Comment #67
BerdirThat statement ("warnings (no technical problem") is just plain wrong.
It *is* broken and it must be fixed in your module.
It is also not just broken in PHP 5.3, it never worked correctly. Older PHP versions just tried to be nice and assumed that you want to pass the argument by value. However, any changes to the argument are *not* kept. (Unless it's an object in PHP 5, because that is already passed by value (something similar at least) but that is still broken in PHP4).
Comment #68
hass CreditAttribution: hass commentedThis warning doesn't break functionality. Never reopen this case again, please.
Comment #70
OliverColeman CreditAttribution: OliverColeman commentedThis is the stupidest stand-off I've seen on d.o. I wrote a treatise on why this should be considered as breaking the module, but Firefox (you know, that really stable browser...) crashed before I could send it. So the short version: this module produces warning messages on what should be a supported environment (PHP 5.3). A system that produces warning messages tends to make its users think it's broken. I would argue a system that makes its users think it might be broken is not meeting its desired functionality (whether or not it also performs the operations it was intended to perform).
I marked this as "closed (won't fix)" as that seems more accurate than the automatically applied "closed (fixed)". ;)
Comment #71
kenorb CreditAttribution: kenorb commentedI've the same error.
I've PHP 5.3 (MAMP). Using 6.x-2.2
I've massive amount of that warning in watchdog.
Comment #72
kenorb CreditAttribution: kenorb commentedComment #73
hass CreditAttribution: hass commentedComment #74
kenorb CreditAttribution: kenorb commentedThere was similar issue with RealName: #626350: Real Name problem with php 5.3
They fixed it.
See as well: #360605: PHP 5.3 Compatibility
Comment #75
hass CreditAttribution: hass commentedNo patch
Comment #76
kenorb CreditAttribution: kenorb commentedI was using 2.2, it looks like it's fixed in 2.x
http://drupalcode.org/project/google_analytics.git/blobdiff/9c65b6d1ce9d...
I wonder, why nobody mention that.
Comment #77
hass CreditAttribution: hass commentedComment #78
kenorb CreditAttribution: kenorb commentedMy patch was as attached, but I see already the same code in dev 6 months ago.
So I'm confused now, why this issue was about.
Comment #79
greg.harvey@kenorb: the issue is best described here: http://drupal.org/node/891514#comment-3441820
Comment #80
chefarov CreditAttribution: chefarov commentedProblem continues to exist in 5.3 version.
I have:
PHP Version 5.3.3-7+squeeze14
My exact log output is:
Parameter 1 to profile_load_profile() expected to be a reference, value given in /.../includes/module.inc on line 476.
Comment #81
chefarov CreditAttribution: chefarov commentedWrong post (it was advanced user management module)
sorry! closing again...
Comment #82
kenorb CreditAttribution: kenorb commentedAnother one was caused by loopfusestatistics module:
http://drupalcode.org/project/loopfuse.git/blame/4a9e3e3c3d020f047112e98...
To see which module causing this, you may try to add the following debug:
to dump the backtrace on the screen.
In most of the cases, patch like #78 in other modules should fix the problem.