From Drupal 4.6 onward node_submit() imports the current $user in its first line, but never makes use of it. I'm new to Drupal, but this doesn't make any sense to me. Furthermore the function (at least in D6>=) fails to use the user variable, when it actually would be feasible. Eg. in this line "$node->uid = 0;" instead of "$node->uid = $user->uid". If no $node->name is supplied, it would be perfectly fine to just rely on the fact that the current user submitted the form/node.

Files: 
CommentFileSizeAuthor
#15 813146-15-node_submit_cruft_d6.patch442 bytespfrenssen
PASSED: [[SimpleTest]]: [MySQL] 190 pass(es).
[ View ]
#10 813146.patch520 bytesbleen18
PASSED: [[SimpleTest]]: [MySQL] 39,055 pass(es).
[ View ]
#7 813146-7-node-node_submit.patch547 bytespfrenssen
FAILED: [[SimpleTest]]: [MySQL] 36,291 pass(es), 0 fail(s), and 44 exception(s).
[ View ]
#6 node-submit-813146-6.patch501 bytesoddbit
PASSED: [[SimpleTest]]: [MySQL] 190 pass(es).
[ View ]
#4 node-submit-813146-4.patch475 bytesoddbit
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch node-submit-813146-4.patch.
[ View ]
#3 813146.oddbit.2.patch475 bytesoddbit
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 813146.oddbit.2.patch.
[ View ]
#1 813146.oddbit.patch548 bytesoddbit
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 813146.oddbit.patch.
[ View ]

Comments

Status:Active» Needs review
StatusFileSize
new548 bytes
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 813146.oddbit.patch.
[ View ]

This one has a number of related issues on this topic already. For example:
#659962: Nodes with a $node->uid assigned can not have author changed
#398110: node_submit resets $node->uid

The issue is also present in 7.x so I have added an issue for that (with a suggested patch): #1028000: Clarify the behavior of node_submit()

Status:Needs review» Needs work

The last submitted patch, 813146.oddbit.patch, failed testing.

StatusFileSize
new475 bytes
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 813146.oddbit.2.patch.
[ View ]

New try with v6.20

Status:Needs work» Needs review
StatusFileSize
new475 bytes
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch node-submit-813146-4.patch.
[ View ]

Status:Needs review» Needs work

The last submitted patch, node-submit-813146-4.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new501 bytes
PASSED: [[SimpleTest]]: [MySQL] 190 pass(es).
[ View ]

Version:6.x-dev» 8.x-dev
Status:Needs review» Reviewed & tested by the community
StatusFileSize
new547 bytes
FAILED: [[SimpleTest]]: [MySQL] 36,291 pass(es), 0 fail(s), and 44 exception(s).
[ View ]

Patch looks good, but the problem still exists in 8.x and should be fixed there first. This is the same patch rerolled against 8.x-dev.

Status:Reviewed & tested by the community» Needs work

The last submitted patch, 813146-7-node-node_submit.patch, failed testing.

Version:8.x-dev» 7.x-dev

$user is used in d8 so it needs to move back to d7.

Status:Needs work» Needs review
StatusFileSize
new520 bytes
PASSED: [[SimpleTest]]: [MySQL] 39,055 pass(es).
[ View ]

this is a patch against D7

Issue tags:+Novice

now that I think of it ... tagging

Status:Needs review» Reviewed & tested by the community

As the summary says: Not even f8526cb5 that added node_submit() initially used $user. It's not used, so whatever happens - it's safe to remove it.
I also re-verified that D8 doesn't have the same issue.

Issue tags:+coding standards

Adding coding standards tag.

Version:7.x-dev» 6.x-dev
Status:Reviewed & tested by the community» Patch (to be ported)

Ignoring patches in comments #1-8 above, because they seem to be doing something other than the simple patch in #10 (which matches the issue that was actually submitted) and they also seem to be taken care of on other issues... the patch in #10 is a no-brainer cruft removal, and I committed it to Drupal 7.

It appears that $user is not used in 6.x either, so moving to their for backport consideration.

Status:Patch (to be ported)» Needs review
StatusFileSize
new442 bytes
PASSED: [[SimpleTest]]: [MySQL] 190 pass(es).
[ View ]

Rolled patch for D6.

Status:Needs review» Reviewed & tested by the community

Thank you, pfrenssen.

(Obviously http://api.drupal.org/api/drupal/modules%21node%21node.module/function/n... indeed doesn't use that variable.)

Issue tags:-Novice

Nothing more for a novice to do here…