Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad user ID (object id) reassingment on CREATE user [SOLVED] #25884

Closed
caos30 opened this issue Sep 12, 2023 · 0 comments
Closed

Bad user ID (object id) reassingment on CREATE user [SOLVED] #25884

caos30 opened this issue Sep 12, 2023 · 0 comments
Labels
Bug This is a bug (something does not work as expected)

Comments

@caos30
Copy link

caos30 commented Sep 12, 2023

Bug

On Dolibarr 18, when creating a new user (i.e., when object=NULL), I noticed an issue at the top of the /user/card.php file where the $id value is being overwritten with:

if (empty($id)) {
	$id = $user->id;
}

While this might make sense in certain scenarios, it shouldn't reassign the value when creating a new user. In this case, this re-assignment is causing that Dolibarr LOAD EXTRAFIELDS VALUES of the logged user (me when creating a new user)!!

A more suitable condition might be:

if (empty($id) && $action!='create') {
	$id = $user->id;
}
  • Note 1: I've tested this minor change, and it worked well. @eldy, could you please incorporate this change into the code? I've checked the develop-branch, and it hasn't been fixed yet.
  • Note 2: this conditional re-assignment doesn't exist on Dolibarr 17 branch !

Environment Version

18.0

Environment OS

No response

Environment Web server

No response

Environment PHP

No response

Environment Database

No response

Environment URL(s)

No response

Expected and actual behavior

No response

Steps to reproduce the behavior

No response

Attached files

No response

@caos30 caos30 added the Bug This is a bug (something does not work as expected) label Sep 12, 2023
@eldy eldy closed this as completed in 81921b9 Sep 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This is a bug (something does not work as expected)
Projects
None yet
Development

No branches or pull requests

1 participant