Just noticed with the new permissions that there is a access_create little bug throwing
Recoverable fatal error: Object of class stdClass could not be converted to string in domain_node_access_create() (line 2113 of /sites/all/modules/domain/domain.module).
$permission = "$op $node content on assigned domains";
Send a patch in a sec
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | 1370244-node-access-type.patch | 2.39 KB | agentrickard |
| #3 | domain.module-1370244-5361784.patch | 1.56 KB | joelpittet |
| #1 | domain.module-1370244.patch | 591 bytes | joelpittet |
Comments
Comment #1
joelpittetProbably didn't need a patch for this one but there you go, nonetheless
Joel
Comment #2
joelpittetWell that patch doesn't solve the problem but it reduces it from a Fatal Error to a notice:
Notice: Trying to get property of non-object in domain_node_access_create() (line 2113 of /sites/all/modules/domain/domain.module).'
I will dig a little deeper for where the args are being passed in.
Comment #3
joelpittetOk this is a better patch, based on the hook_node_access
Comment #4
agentrickardI cannot replicate this error under normal circumstances. (e.g. a user tries to add content at node/add/article.
The 'create' operation for node access is supposed to pass $node as a string, not an object. Core is very clear about this.
What are you doing when this happens? What module is passing an object?
Comment #5
agentrickardProper status. Please set patches to 'needs review' when you post them.
Comment #6
skizzo commentedI am seeing the same error on Domain 7.x-3.1
The error shows up when previewing an Article before submission.
If I submit the article without previewing no error is reported.
Comment #7
joelpittetThat is exactly where I was seeing there too. I couldn't pin point the cause but it is possibly an issue in core. Although the hook doesn't tell you if it's an object or a type string as its param and makes note to test this in the example. This was the reason and solution for my patch.
Comment #8
agentrickardIt's a problem with the preview phase that we need to account for. We should check for core issues, too.
Comment #9
joelpittetI was reading through the code and they are very liberal with what they toss into that node_access('create', $node/$type) call on the second param.
book_node_view_link has string $child_type #94 book.module
_node_add_access() has $type->type string #1854 node.module
forum_menu_local_tasks_alter() has node object #176 forum.module
node_preview() has node object #330 node.pages.inc
translation_node_overview() has node object #56 translation.pages.inc
comment_notify_form_alter() has string $type #334 comment_notify.module
ctools_node_access_ctools_access_check() has string $node_context->data->type #61 node_access.inc
pathauto_blog_update_alias has string 'blog' #749 pathauto.module
Their implementation of the hook does what I have in that patch.
node_node_access #2931 node.module
Comment #10
agentrickardYes, the problem with the original report is just that it did include seps to reproduce the error. I never hit the Preview button.
Comment #11
joelpittetYeah sorry, didn't spot when it was occurring because I got the message passed from a client and only saw it infrequently myself so it was hard to include where it came from in the original post. The code was the only thing I had to go on.
Comment #12
agentrickardAnd a patch that reduces some code duplication.
Comment #13
joelpittetI like that refactor. Maybe also consider changing the param name $node to $node_type or just $type to alleviate any confusion to what it's getting?
Comment #14
agentrickard$node is the node object or string passed by node_access(). $type might be renamed to $node_type, but I find it clear now.
Comment #15
joelpittetOh I see what you did there now, looks good.
Comment #16
agentrickardCommitted. Only affects 7.x.3.