working on this. patch upcoming

Comments

Wesley Tanaka’s picture

Status: Active » Needs review
StatusFileSize
new446 bytes

fixed (patch attached)

Wesley Tanaka’s picture

Status: Needs review » Reviewed & tested by the community

Since this is such an obvious problem, the patch is so small (1 line), and the effects are localized, I'm going to say it's ready to commit, but please disagree with me if this isn't the right fix.

dries’s picture

How can we reproduce this?

chx’s picture

$value = profile_view_field($account, $field) this may fail and then $field->value is not updated. I do not know how this could happen, so some explanation would be nice. Also, do not assign NULL but use unset.

Wesley Tanaka’s picture

StatusFileSize
new446 bytes

It was happening on: http://treehouse.ofb.net/go/en/profile
which you can look at for background.

What would happen in the userlist was something like this:

Dries

Dries Buytaert
http://www.buytaert.net/
Java, virtual machines, profiling and instrumentation, embedded systems, online communities, self-organization, politics, usability, photography, gadgets, skiing, sailing, mounties, the future

chx

Károly Négyesi
http://www.buytaert.net/
Java, virtual machines, profiling and instrumentation, embedded systems, online communities, self-organization, politics, usability, photography, gadgets, skiing, sailing, mounties, the future

someotheruser

http://www.buytaert.net/
women, beer, music

newuser

http://www.buytaert.net/
women, beer, music

spamuser

http://www.casino.website/
women, beer, music

The site was upgraded from 4.6.3 (somewhat patched up to fix issues that apparently aren't going to get committed into 4.6 branch) to CVS 2005-11-25 sometime +08:00. I used the update.php script that came with the CVS version to run all updates from update_129 to update_154. I had installed profile.module on 4.6.3 before the update, and most users had created their profiles before the update as well.

all my field ids are smaller than 15, so this bizarre check isn't the one that's failing (but that should probably get fixed too)

  if ($field->fid == 18 || $field->fid == 19 || $field->fid == 20) {

I haven't tested this theory yet, but from a peephole inspection of profile_view_field(), I'm guessing that the $user object that gets passed in does not have object fields set for profile values which are blank. That would cause this branch

if ($value = $user->{$field->name}) {

to be if (UNSET), which would fail, and the function would fall off the end.

Anyway the patch with unset instead of assignment to NULL is attached.

Wesley Tanaka’s picture

How can we reproduce this?

To answer this question, I think this might work:

  • start with install of drupal cvs head
  • create some profile fields that display in the user list.
  • create some users, but don't log them in ever, so that most of the users don't have any of those profile fields set to anything
  • create one user and put stuff in their profile
  • log in the populated profile user so that they move to the top of the user list
  • go look at url('profile')
dries’s picture

Status: Reviewed & tested by the community » Needs work

Maybe a more elegant fix is not to pass $fields by reference and to return a copy, rather than not returning anything in _profile_update_user_fields(). Care to investigate this some more?

Wesley Tanaka’s picture

Status: Needs work » Needs review
StatusFileSize
new1.66 KB

That's fine too.

That was the first approach I took, but thought that a smaller patch might be more likely to be accepted.

Patch attached implementing comment #7

dries’s picture

Status: Needs review » Fixed

Committed to HEAD. Thanks.

Status: Fixed » Closed (fixed)

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

budda’s picture

Version: » x.y.z
Status: Closed (fixed) » Active

This issue is still happening for me with the very latest profile.module from CVS
$Id: profile.module,v 1.131 2006/01/26 13:43:04 dries Exp $

My fresh Drupal 4.7b4 profile.module outputs the following on the ?q=profile page:


smannion
Stew Mannion
BDesign
HTML, Design

superuser
Stew Mannion
BDesign
HTML, Design

kharding
Kay Harding
Bdesign
Design

admin
Kay Harding
Bdesign
Design

The users 'kharding' and 'smannion' have profile fields filled in, but the other two users (superuser and admin) don't - but they inherit the profile field values from the other two users.

darius’s picture

Status: Active » Closed (duplicate)
Wesley Tanaka’s picture

Status: Closed (duplicate) » Fixed

it looks like this bug report had morphed to mean something else.

re-marking as fixed, since the problem originally reported in this bug report was indeed fixed, independent of whether or not it recurred later.

Status: Fixed » Closed (fixed)

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

cilefen’s picture

Version: 9.x-dev » 5.x-dev

Fixing after a spammer changed the version. I think this was 5?

avpaderno’s picture

Version: 5.x-dev » 4.7.x-dev
Issue tags: -online casino malaysia forum