Problem/Motivation

Accessing (as admin) a non-existing event details at admin/reports/dblog/event/ returns an empty page, it should return the 404 error page.

Proposed resolution

Throw NotFoundHttpException at the dblog controller for non-existing events.

Remaining tasks

Review path.

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

TBD.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

manuel.adan created an issue. See original summary.

manuel.adan’s picture

The last submitted patch, 2: drupal-dblog_event_not_found-3101108-2-tests.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Krzysztof Domański’s picture

Fixed coding standards and re-rolled. Tested manually. RTBC +1.

Not-existing log event page.

dagmar’s picture

Status: Needs review » Needs work
FileSize
93.74 KB

Thanks for working on this. I see the opportunity to simplify the nesting of the eventDetails method if we check first if the log record exists and throw the exception early. The else there is really far away from the if so is hard to read. Also this approach simplifies the entire method because removes a lot of indentation.

code nesting

Krzysztof Domański’s picture

Status: Needs work » Needs review
FileSize
4.06 KB
5.54 KB
Hardik_Patel_12’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
96.64 KB
113.11 KB

patch at #6 look good to me and it is working properly.

catch’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/modules/dblog/tests/src/Functional/DbLogTest.php
@@ -136,6 +136,24 @@ public function testLogEventPage() {
+
+    // Random (not existing) event ID.
+    $connection = Database::getConnection();
+    $wid = $connection->query('SELECT MAX(wid) FROM {watchdog}')->fetchField();
+    $wid += rand(100, 999);
+

I think this should be non-random - can we just make it 999999 or something?

Krzysztof Domański’s picture

Status: Needs work » Needs review
FileSize
849 bytes
5.35 KB
dagmar’s picture

Status: Needs review » Reviewed & tested by the community

Thanks @Krzysztof Domański

  • catch committed 08582f7 on 9.0.x
    Issue #3101108 by Krzysztof Domański, manuel.adan, Hardik_Patel_12,...

  • catch committed e31698a on 8.9.x
    Issue #3101108 by Krzysztof Domański, manuel.adan, Hardik_Patel_12,...
daffie’s picture

Status: Reviewed & tested by the community » Fixed

So the issue is fixed then.

catch’s picture

Committed 08582f7 and pushed to 9.0.x. Backported to 8.9.x Thanks!

Status: Fixed » Closed (fixed)

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