Skip to content

Fix/log fatal error - #2521

Open
Daniel-KM wants to merge 3 commits into
omeka:developfrom
Daniel-KM:fix/log_fatal_error
Open

Daniel-KM wants to merge 3 commits into
omeka:developfrom
Daniel-KM:fix/log_fatal_error

Conversation

@Daniel-KM

Copy link
Copy Markdown
Contributor

There are some errors that are displayed only on the user screen or via the error page, but not logged, so hard to fix.

Copilot AI review requested due to automatic review settings June 22, 2026 12:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves diagnosability by ensuring fatal/unhandled errors are more consistently recorded in logs across the MVC app, error pages, and synchronous jobs.

Changes:

  • Trigger view events on error/404 pages by falling back to an error identifier in the Trigger view helper.
  • Expand fatal error detection in synchronous job shutdown handling to include additional fatal error types.
  • Register a global shutdown handler during bootstrap to log uncaught fatal PHP errors via the standard logger.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
application/src/View/Helper/Trigger.php Triggers view events even without a route match, with special handling for error pages.
application/src/Job/DispatchStrategy/Synchronous.php Broadens fatal error detection logic during shutdown for synchronous jobs.
application/Module.php Adds bootstrap shutdown logging for uncaught fatal PHP errors.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +58 to +61
try {
$this->events->triggerEvent($event);
} catch (\Throwable $e) {
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Comment thread application/Module.php
Comment on lines +54 to +57
// Log uncaught fatal php errors through the standard logger.
// Unlike mvc exceptions handled by Omeka\Mvc\ExceptionListener), fatal
// errors don't go through mvc layer, so they are only displayed and
// never recorded.
Comment on lines +52 to +56
// Fall back to the error identifier when no route matched (404, error
// page), so modules attached to "view.layout" can still observe event.
$isError = !$routeMatch;
$this->events->setIdentifiers($ids ?: [$isError ? 'Omeka\Controller\Error' : $routeMatch->getParam('controller')]);
// Avoid cascaded error or blank page hiding original failure above.
@Daniel-KM
Daniel-KM force-pushed the fix/log_fatal_error branch from 831f5ad to e6afffc Compare June 22, 2026 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants