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
Nicolas Grekas f2200f7cad feature #19568 [Debug] Better error handling (lyrixx)
This PR was merged into the 3.2-dev branch.

Discussion
----------

[Debug] Better error handling

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | -
| Fixed tickets | -
| License       | MIT
| Doc PR        | https://github.com/symfony/symfony-docs/pull/6870

1. Send the raw exception in the log context instead of custom formatting
2. Add config option to log/throw in Symfony all PHP errors
3. Always use an exception when a PHP error occurs
4. Expand exception in the log context in the web developer toolbar
5. Use the dumper to dump log context in the web developer toolbar

---

I used the following code to produce screenshots:

```php
public function indexAction(Request $request)
    {
        $this->get('logger')->info('A log message with an exception', ['exception' => new \Exception('this exception will be logged')]);

        error_reporting(0);
        for ($i=0; $i < 15; $i++) {
            if ($i == 5) {
                error_reporting(E_ALL);
            }
            if ($i == 10) {
                error_reporting(0);
            }

            trigger_error("Trigger error avec E_USER_NOTICE", E_USER_NOTICE);
        }

        error_reporting(E_ALL);

        @trigger_error("trigger_error avec E_USER_DEPRECATED", E_USER_DEPRECATED);
        trigger_error("trigger_error avec E_USER_DEPRECATED (not silent)", E_USER_DEPRECATED);
// ...
```

![screenshot16](https://cloud.githubusercontent.com/assets/408368/17582279/2c4239b0-5fab-11e6-8428-2eaa7372cce3.png)

![screenshot17](https://cloud.githubusercontent.com/assets/408368/17582287/30cad1ea-5fab-11e6-9b0b-de0fa9f3913b.png)

![screenshot18](https://cloud.githubusercontent.com/assets/408368/17582291/348bb574-5fab-11e6-83b0-5bfaac080838.png)

Commits
-------

8f24549 [Debug] Better error handling
2016-08-17 17:35:28 +02:00
.composer Drop hirak/prestissimo 2016-05-12 07:44:15 -05:00
.github Merge branch '2.8' into 3.1 2016-08-16 07:58:24 -07:00
src/Symfony [Debug] Better error handling 2016-08-17 17:20:26 +02:00
.editorconfig Add EditorConfig File 2012-06-16 14:08:15 +02:00
.gitignore Add appveyor.yml for C.I. on Windows 2015-08-25 23:41:37 +02:00
.php_cs fixed CS 2016-06-21 07:43:49 +02:00
.travis.yml Merge branch '3.1' 2016-08-10 09:06:11 +02:00
appveyor.yml Merge branch '3.1' 2016-08-10 13:10:50 +02:00
CHANGELOG-3.0.md Merge branch '2.8' into 3.1 2016-08-05 10:37:39 +02:00
CHANGELOG-3.1.md updated CHANGELOG for 3.1.3 2016-07-30 05:30:39 -04:00
composer.json Merge branch '3.1' 2016-07-20 08:56:17 +03:00
CONTRIBUTING.md Update contributing docs 2016-02-24 15:36:06 +01:00
CONTRIBUTORS.md update CONTRIBUTORS for 2.7.16 2016-07-30 04:15:15 -04:00
LICENSE Update copyright year 2016-01-01 23:53:47 -03:00
phpunit [ci] Upgrade phpunit wrapper deps 2016-06-29 14:53:38 +02:00
phpunit.xml.dist Merge branch '3.0' 2016-03-16 18:16:29 +01:00
README.md Merge branch '2.8' 2015-06-04 22:30:47 +02:00
UPGRADE-3.0.md Merge branch '3.0' into 3.1 2016-06-21 07:59:09 +02:00
UPGRADE-3.1.md [HttpKernel] Clarify deprecation of non-scalar values in surrogate renderer 2016-07-04 13:45:05 +02:00
UPGRADE-3.2.md minor #19538 [Yaml] update changelog and upgrade files (xabbuh) 2016-08-13 11:49:42 -07:00
UPGRADE-4.0.md [Debug] Better error handling 2016-08-17 17:20:26 +02:00

README

What is Symfony?

Symfony is a PHP 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.

Installation

The best way to install Symfony is to use the official Symfony Installer. It allows you to start a new project based on the version you want.

Documentation

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

Contributing

Symfony 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 and use Pull Request Template.

Running Symfony Tests

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