Closed (fixed)
Project:
Domain
Version:
2.0.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
17 Nov 2024 at 15:02 UTC
Updated:
25 Apr 2025 at 17:19 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
medusa43 commentedComment #3
medusa43 commentedComment #4
redzeufI have exactly the same error message when trying to access a add content page in the admin with a user having specific role (for admin it works well).
Here is a patch. It looks like the is_null logic is_numeric are the opposite that needed.
I also take care of the non object that is mentioned in issue https://www.drupal.org/project/domain/issues/2936697
Comment #5
redzeufoups here is the applicable patch for pervious comment.
Comment #8
andreasderijckeDifferent patch as MR, because I think the base check can be simplified.
In addition, the is_numeric check should not be necessary according to the return type of getDomainId(), so either the check is obsolete, or the function doc is incomplete.
As I don't have the correct answer, have flagged it as a todo.
Comment #9
dieterholvoet commentedThe MR fixes the issue for me.
Comment #10
danrodComment #11
danrodAs mentioned in the file
domain_access/domain_acccess.modulelines 416-421, this needs to be reviewed:As far as I know this method always returns an integer, not NULL or 0, but I think we can merge this MR for now.
Comment #12
danrodComment #13
danrodComment #14
mably commentedNot sure to understand what the original problem is exactly?
Could someone mind explaining?
Comment #16
danrodMerged to the 2.0.x branch, thanks everyone for the input, if anyone is still having any problems with this, I can re-open the issue.
Comment #17
danrodComment #18
mably commented@danrod could you explain what the original problem was exactly?
Not sure to understand why the
is_nulltest was not working.Comment #19
danrod@mably some users were reporting that the variable
$active_domainbeing NULL in the filedomain_access/domain_access.moduleline 419:$id = $active_domain->getDomainId();Not sure why exactly, and I tried to reproduce it and I couldn't, so a different condition was proposed to check if
$active_domainis a valid object (of typeDomainInterface)and not empty: https://git.drupalcode.org/project/domain/-/merge_requests/134/diffsAlso, an extra condition was added:
In theory,
$active_domain->getDomainId()should always return an integer.Comment #20
mably commentedDon't see how
$active_domaincould beNULLon line 419, probably a different codebase...Anyway, the change seems ok, but it will probably not fix the original problem.
Comment #21
danrodAlright, thanks @mably , I'll let you know in advance when I try to merge an issue to the 2.0.x branch, the change seems to have fixed the issue for some users, let's see.
Comment #22
danrod@mable I'll move it to "Fixed" for now (since it's already committed to the 2.0.x branch), we can re-open it if the issue re-appears again.