Skip to content

LoggerInterface::error() has unexpected side-effects in admin #1634

Open
@GuySartorelli

Description

@GuySartorelli

Found while fixing silverstripe/silverstripe-framework#11034

If you log an error while saving a record, even though the record is successfully saved, the toast message turns red (as though it was a failure), and the form doesn't reload.

The toast message is unaffected - it's still the success message. The record still gets saved. The problem is specifically that the wrong type of toast is used, and the form doesn't reload.

Notes

  • This was specifically tested using this code - it's not clear whether the specific .errorhandler service affects it, but probably not
    /** @var LoggerInterface $logger */
    $logger = Injector::inst()->get(LoggerInterface::class . '.errorhandler');
    $logger->error('Error sending email in ' . __FILE__ . ' line ' . __LINE__ . ": {$e->getMessage()}");
  • using warning() instead of error() does not exhibit this buggy behaviour. It is specifically when logging an error that this occurs.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions