This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
Fabien Potencier 559fa8c214 merged branch Koc/critical-errors-logging (PR #5863)
This PR was merged into the master branch.

Commits
-------

acfc750 #2042 initial implementation of fatal error handler

Discussion
----------

Display traces for fatal errors

Bug fix: no
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: looks like yes
Fixes the following tickets: #2042 (partly)
License of the code: MIT

Output looks like on screen http://easycaptures.com/fs/uploaded/737/1191436899.png . I've added one line to css to prevent displaying standard xdebug trace http://easycaptures.com/fs/uploaded/737/5939488074.png

---------------------------------------------------------------------------

by Koc at 2012-11-08T21:55:41Z

So, community please advice me, how can I trigger `KernelEvents::EXCEPTION` event in `ErrorHandler` or `ExceptionHandler`? Or should I provide other event for this?

---------------------------------------------------------------------------

by stof at 2012-11-08T22:03:23Z

@Koc Don't. the exception handler is there to be the safe guard when developing, and does not depend on the kernel (which would be required to trigger the event). If you were triggering the listener again, it would mean that any exception thrown in a listener would lead to a loop.
And if it is for the fatal error handling, you simply cannot be sure the kernel is still available (and even less in a wokring state) at this point.

---------------------------------------------------------------------------

by Koc at 2012-11-08T22:06:31Z

But how can I notify logger (which will send me mail or just log this situation)?

---------------------------------------------------------------------------

by fabpot at 2012-11-09T07:33:41Z

The error handler is only registered when in debug mode in the Kernel and can be triggered very early in the handling of a request (even before we have access to the dispatcher or anything else). So, the current PR looks fine to me (apart from the typo and the lack of unit tests).

---------------------------------------------------------------------------

by Koc at 2012-11-09T09:13:03Z

> The error handler is only registered when in debug mode

Ooh! I haven't see that before. But the goal - be notified about errors by email or log-file. Like now exceptions with traces from site emails to me.

---------------------------------------------------------------------------

by fabpot at 2012-11-09T09:20:54Z

I think there are two goals. The first one being to have nice pages in the development environment when a fatal error occurs. And this PR addresses that feature quite nicely. The second can be addressed in another PR.

---------------------------------------------------------------------------

by henrikbjorn at 2012-11-14T11:50:22Z

I have some questions about the ErrorHandler. Is there a reason for it only to be registered in an debug environment (which prod is not). Would assume that if i enable the ErrorHandler in productions aswell Monolog would log thoose instead of them just vanishing?

---------------------------------------------------------------------------

by Koc at 2012-11-14T12:01:50Z

I am thinking about it too. But as Fabien says it will another PR

---------------------------------------------------------------------------

by GromNaN at 2012-11-18T10:38:09Z

You should add a memory reserve to be able to handle "Out of memory" errors.
An example is here :
513d628966/lib/Raven/ErrorHandler.php (L91)
513d628966/lib/Raven/ErrorHandler.php (L62)

---------------------------------------------------------------------------

by fabpot at 2012-11-28T11:35:21Z

@Koc can you finish this PR (probably by integrating the memory reserve as explained by @GromNaN)?

---------------------------------------------------------------------------

by Koc at 2012-11-28T11:46:12Z

of course, on this weekend

---------------------------------------------------------------------------

by Koc at 2012-12-02T17:44:44Z

@fabpot done
2012-12-05 11:50:34 +01:00
src/Symfony merged branch Koc/critical-errors-logging (PR #5863) 2012-12-05 11:50:34 +01:00
tests/Symfony/Tests/Component/Security/Http/Firewall replaced magic strings by proper constants 2012-11-29 12:23:09 +01:00
.editorconfig Add EditorConfig File 2012-06-16 14:08:15 +02:00
.gitignore ignore composer.phar 2012-04-20 14:10:06 +01:00
.travis.yml [travis-ci] Zend Garbage Collection only for PHP5.4 2012-11-19 15:21:43 +01:00
CHANGELOG-2.0.md updated CHANGELOG for 2.0.19 2012-11-29 12:35:10 +01:00
CHANGELOG-2.1.md updated CHANGELOG for 2.1.4 2012-11-29 12:55:41 +01:00
CONTRIBUTING.md Create CONTRIBUTING.md file for auto-linking in PR's 2012-09-17 14:40:53 -04:00
CONTRIBUTORS.md update CONTRIBUTORS for 2.0.19 2012-11-29 12:35:34 +01:00
LICENSE Updated LICENSE files copyright 2012-02-22 10:10:37 +01:00
README.md Point to information on how to run the test suite. (closes #5405) 2012-09-01 08:52:18 +02:00
UPGRADE-2.1.md Merge branch '2.1' 2012-11-29 11:32:45 +01:00
UPGRADE-2.2.md [HttpFoundation] disabled Request _method feature by default (should now be explicitely enabled via a call to enableHttpMethodOverride()) 2012-11-28 15:06:57 +01:00
autoload.php.dist [travis-ci] Zend Garbage Collection only for PHP5.4 2012-11-19 15:21:43 +01:00
composer.json Add missing symfony/stopwatch in the replace section of composer.json 2012-11-10 18:59:49 +01:00
phpunit.xml.dist [travis-ci] Zend Garbage Collection only for PHP5.4 2012-11-19 15:21:43 +01:00

README.md

README

Build Status

What is Symfony2?

Symfony2 is a PHP 5.3 full-stack web framework. It is written with speed and flexibility in mind. It allows developers to build better and easy to maintain websites with PHP.

Symfony can be used to develop all kind of websites, from your personal blog to high traffic ones like Dailymotion or Yahoo! Answers.

Requirements

Symfony2 is only supported on PHP 5.3.3 and up.

Be warned that PHP versions before 5.3.8 are known to be buggy and might not work for you:

Installation

The best way to install Symfony2 is to download the Symfony Standard Edition available at http://symfony.com/download.

Documentation

The "Quick Tour" tutorial gives you a first feeling of the framework. If, like us, you think that Symfony2 can help speed up your development and take the quality of your work to the next level, read the official Symfony2 documentation.

Contributing

Symfony2 is an open source, community-driven project. If you'd like to contribute, please read the Contributing Code part of the documentation. If you're submitting a pull request, please follow the guidelines in the Submitting a Patch section.

Running Symfony2 Tests

Information on how to run the Symfony2 test suite can be found in the Running Symfony2 Tests section.