Follow-up to #1986330: When Batch ID doesn't exist, Drupal should emit a 404

Problem/Motivation

Currently if you try to go to /batch?id=123 you get redirected to the homepage with a message stating "No active batch".

Beta phase evaluation

Reference: https://www.drupal.org/core/beta-changes
Issue category Usability Bug, because the message "No active batch" is not clear, since no batch is ran and it does not exists. Response must help figure out what is going on actually.
Issue priority Normal, because this is a self-contained bug and does not impact the overall functionality of the software.
Unfrozen changes Not unfrozen because it changes automated tests and needs a bug fix.
Prioritized changes Prioritized, the main goal of this issue is a bug fix, usability and user experience improvement.
Disruption Impact on improving usability is fair. Also it doesn't disrupt core API because it is internal to batch API only.

Proposed resolution

Since the batch doesn't exist Drupal should just emit a 404 instead

User interface changes

N/A

API changes

If you try to go to /batch?id=123 Drupal emit a 404.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

nikunjkotecha created an issue. See original summary.

nikunjkotecha’s picture

Status: Needs work » Needs review
FileSize
401 bytes

Adding patch for D7.

Yago Elias’s picture

We should add a message log to the dblog system.

Yago Elias’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 3: d7_when_batch_id-2826866-3.patch, failed testing.

lomasr’s picture

lomasr’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 6: d7_when_batch_id-2826866-6.patch, failed testing.

nikunjkotecha’s picture

Assigned: Unassigned » nikunjkotecha
nikunjkotecha’s picture

nikunjkotecha’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 10: 2826866-10.patch, failed testing.

nikunjkotecha’s picture

Status: Needs work » Needs review

I'm not sure what's the error for fail as it shows nothing in error and it passed in simplytest.me for me.

nikunjkotecha’s picture

screenshot attached from simplytest.me

Status: Needs review » Needs work

The last submitted patch, 10: 2826866-10.patch, failed testing.

AjitS’s picture

+++ b/includes/batch.inc
@@ -51,8 +51,9 @@ function _batch_page() {
+      watchdog('Batch', '@batch_id is not a valid batch id.', array('@batch_id' => $_REQUEST['id']), WATCHDOG_ERROR);

Can we get a better message? This sounds very technical.
How about

Trying to execute an invalid batch. ID : @batch_id

navneet0693’s picture

Agreed with comment in #16

navneet0693’s picture

+++ b/includes/batch.inc
@@ -51,8 +51,9 @@ function _batch_page() {
+      watchdog('Batch', '@batch_id is not a valid batch id.', array('@batch_id' => $_REQUEST['id']), WATCHDOG_ERROR);

It's just a suggest if we use % instead of @

cebasqueira’s picture

Dinesh18’s picture

Verified and working as expected.

cebasqueira’s picture

Dinesh18 please change the status to RTBC

navneet0693’s picture

Status: Needs review » Reviewed & tested by the community
stefan.r’s picture

How does this work in Drupal 8? If it has the same issue, this should be fixed there first.

David_Rothstein’s picture

Status: Reviewed & tested by the community » Needs work

The Drupal 8 issue is the parent of this one (#1986330: When Batch ID doesn't exist, Drupal should emit a 404). Looks like it was just marked RTBC, but the two patches are not in sync. They use different wording, and (especially) this one is missing the automated test.