Closed (fixed)
Project:
Profile
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
9 Sep 2019 at 06:02 UTC
Updated:
17 Oct 2022 at 11:29 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
ajitsComment #3
ajitsComment #4
ajitsComment #5
ajitsThe patch is no longer applicable.
Comment #6
bojanz commentedUpdating status. There's also postSave() to think about.
Comment #7
neelam_wadhwani commentedHello,
For current profile check in postsave() and assigned it as default for current profile.
Attach is patch.
Comment #8
neelam_wadhwani commentedComment #9
abrammThis is actually a bug since this code in
preSavechecks for profile owner existence by callinggetOwnerId()and assuming thatgetOwner()would return non-null value as well:However, this is not the case since
getOwnerId()returns an ID of referenced user which may not exist (i.e. the user was deleted).On the other hand,
getOwnerId()may return0(meaning user is anonymous) so the correct approach would be checking bothgetOwnerId()(i.e. profile references some non-anonymous user) andgetOwner()(profile references existing user).Comment #10
abrammUnfortunately I don't have working PHPUnit environment at the moment so I've added test changes relying on Drupal.org CI.
Attaching two patches, one having test only (expected to fail, demonstrates the bug) and the second one with test + fix.
Comment #12
abrammComment #13
keerthana13 commentedGetting null in loadMultipleByUser() as well. so rerolled patch #10
Comment #14
abrammHi @keerthana13 ,
Can you please post an interdiff as well as two patches (test only which should fail and test+fix which should pass)?
That would help adopting the patch.
Thanks!
Comment #16
jsacksick commentedCommitted the patch from #13, thanks everyone!