Problem/Motivation

Creating or editing a "Change the author of content" action (which is provided by the Node module) results in a PHP error on form submission. The cause of the error is an invalid parameter in a database query in the action's validation method.

To reproduce:

  • On the actions administration page (admin/config/system/actions), choose "Change the author of content…" in the "Create an advanced action" section
  • On the resulting configuration page, enter an action label and choose a username
  • Submit the form by clicking "Save"

Proposed resolution

  • Fix the database query in the validation method so that it uses the correct parameter
  • Write tests for administrative configuration of this action
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rlhawk created an issue. See original summary.

rlhawk’s picture

Status: Active » Needs review
FileSize
4.98 KB

Here's a patch that fixes the database query in validation and creates tests for configuring this action.

rlhawk’s picture

Version: 8.0.x-dev » 8.2.x-dev

Changing version to 8.2.x-dev. Also changing priority to major, since this is core functionality that is completely broken. The "Change the author of content" action cannot be used at all in its current state.

rlhawk’s picture

Priority: Normal » Major
Anonymous’s picture

Issue tags: +DrupalBCDays

I can confirm this error using commit c9252d07afecbd1704eaf38fd9f47860ea891875.

After applying patch in #2 the created action is created and appears in the list of available actions.

hauruck’s picture

I can also confirm that the patch from #2 resolves the problem on 8.2.x

lokapujya’s picture

Status: Needs review » Reviewed & tested by the community
alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Adding a test-only patch is nice so that we can all see that the test is testing what we expect. I've run the test locally without the fix and it fails with the expected error. Nice work.

Committed d93768e and pushed to 8.1.x and 8.2.x. Thanks! This is eligible for 8.1.x as it is a simple bugfix with no BC implications.

diff --git a/core/modules/node/src/Tests/NodeActionsConfigurationTest.php b/core/modules/node/src/Tests/NodeActionsConfigurationTest.php
index 632ece1..7a732c6 100644
--- a/core/modules/node/src/Tests/NodeActionsConfigurationTest.php
+++ b/core/modules/node/src/Tests/NodeActionsConfigurationTest.php
@@ -1,10 +1,5 @@
 <?php
 
-/**
- * @file
- * Contains \Drupal\node\Tests\NodeActionsConfigurationTest.
- */
-
 namespace Drupal\node\Tests;
 
 use Drupal\Component\Utility\Crypt;
@@ -28,7 +23,7 @@ class NodeActionsConfigurationTest extends WebTestBase {
   /**
    * Tests configuration of the node_assign_owner_action action.
    */
-  function testAssignOwnerNodeActionConfiguration() {
+  public function testAssignOwnerNodeActionConfiguration() {
     // Create a user with permission to view the actions administration pages.
     $user = $this->drupalCreateUser(['administer actions']);
     $this->drupalLogin($user);

I fixed a couple nits on commit.

  • alexpott committed 31f0c06 on 8.2.x
    Issue #2667224 by rlhawk: Adding or editing "Change the author of...

  • alexpott committed d93768e on 8.1.x
    Issue #2667224 by rlhawk: Adding or editing "Change the author of...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.