Closed (fixed)
Project:
Drupal core
Version:
5.2
Component:
profile.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
4 Jun 2007 at 15:39 UTC
Updated:
24 Dec 2007 at 16:17 UTC
After an upgrade to PHP 5.2.3, Apache 2.2.4, APC 3.0.14 and Drupal 4.7.6, we started seeing hundreds of these nag notes in the watchdog: "Attempt to assign property of non-object in /web/blufftontoday.com/htdocs/modules/profile.module on line 498." Buddylist and /profile views seem to trigger the error.
Adding a quick check for a null UID at the top of profile_load_profile makes the problem go away:
if(!$user->uid) return;
This seems benign but I am baffled as to the root cause. AFAIK this function has not been changed in any recent versions.
Comments
Comment #1
haus commentedI have the same Problem:
- it happens if someone uses a link an the profile page which is supposed to show a list of users with the same profile item
- The page is correctly displayed but watchdog fills up with error message:
- It happens if in profile settings a profile field's page title is set to "%value" as suggested.
- But the error did not appear until today - it might be connected to deleting a user?
I added this hack (which I don't like): "if(!$user->uid) return;" to the function profile_load_profile() and it works.
But it would be very nice to get an advice how to fix this bug correctly
Comment #2
haus commentedFinally I found my beginners error (actually I found it somewhere else in a snippet):
function profile_load_profile($user) waits for $user - objekt, not for $user->uid which I used.
After I corrected this in a custom profile_listing.tpl.php it works correctly.
Sorry for this.
Comment #3
(not verified) commentedComment #4
sudhii9999 commentedI am not able to display the profile field information as i am used to with 5.1 version using the following code.please help me out
the above script used to work in the desired way but its now not working with the 5.2 version please help me out as soon as possible.
Comment #5
yelvington commentedAs noted above, this is not a Drupal bug, but rather an error in your code. The profile_load_profile function takes a user object as an arg, not a UID, so remove the "->uid" part of the argument in your example.
Closing.