In debug mode, the ```Kernel::init()``` method is incompatible with ```Kernel:unserialize()``` #6834

Closed
bamarni opened this Issue Jan 22, 2013 · 5 comments

Comments

Projects
None yet
4 participants
@bamarni
Contributor

bamarni commented Jan 22, 2013

Related to #6254.

What about a static flag on it so that it gets intialized only once in a process?

@fabpot

This comment has been minimized.

Show comment
Hide comment
@fabpot

fabpot Feb 15, 2013

Member

I think that the Kernel::init() method should be removed altogether and the code moved to the front controllers (like is done in fabpot/Silex-Skeleton). I will do that for 2.3.

It is also related to #6828 as it will allow for a better decoupling.

Member

fabpot commented Feb 15, 2013

I think that the Kernel::init() method should be removed altogether and the code moved to the front controllers (like is done in fabpot/Silex-Skeleton). I will do that for 2.3.

It is also related to #6828 as it will allow for a better decoupling.

@bamarni

This comment has been minimized.

Show comment
Hide comment
@bamarni

bamarni Feb 15, 2013

Contributor

imo the method shouldn't be removed , only its call being moved:

<?php
// ...
$kernel = new AppKernel('dev', true);
$kernel->init();
$kernel->loadClassCache();
// ...

About the decoupling between Debug and HttpKernel, I don't think removing this method would add any value, while the yet-to-come Debug component wouldn't be tied to the Kernel, the opposite isn't true apparently, if we just look at the constructor's second argument.

Contributor

bamarni commented Feb 15, 2013

imo the method shouldn't be removed , only its call being moved:

<?php
// ...
$kernel = new AppKernel('dev', true);
$kernel->init();
$kernel->loadClassCache();
// ...

About the decoupling between Debug and HttpKernel, I don't think removing this method would add any value, while the yet-to-come Debug component wouldn't be tied to the Kernel, the opposite isn't true apparently, if we just look at the constructor's second argument.

@stof

This comment has been minimized.

Show comment
Hide comment
@stof

stof Feb 15, 2013

Member

@bamarni the debug mode of the kernel is about controlling whether the cache should be reloaded automatically, and such other things. Registering an error handler and an exception handler in dev is better done by the front controller than the kernel IMO.

Member

stof commented Feb 15, 2013

@bamarni the debug mode of the kernel is about controlling whether the cache should be reloaded automatically, and such other things. Registering an error handler and an exception handler in dev is better done by the front controller than the kernel IMO.

@bamarni

This comment has been minimized.

Show comment
Hide comment
@bamarni

bamarni Feb 15, 2013

Contributor

@stof : The debug mode of the kernel is also about controlling what we're currently considering to move (https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpKernel/Kernel.php#L101), I don't think it is related to the dev environment, currently all those things are registered when I switch debug to true in my prod front controller too.

Contributor

bamarni commented Feb 15, 2013

@stof : The debug mode of the kernel is also about controlling what we're currently considering to move (https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpKernel/Kernel.php#L101), I don't think it is related to the dev environment, currently all those things are registered when I switch debug to true in my prod front controller too.

@mpdude

This comment has been minimized.

Show comment
Hide comment
@mpdude

mpdude Mar 1, 2013

Contributor

Does it make sense at all for the kernel to be serialized?

Contributor

mpdude commented Mar 1, 2013

Does it make sense at all for the kernel to be serialized?

@fabpot fabpot closed this in 2ff0927 Apr 7, 2013

fabpot added a commit that referenced this issue Apr 7, 2013

merged branch fabpot/debug-component (PR #7441)
This PR was merged into the master branch.

Discussion
----------

[Debug] added the component (closes #6828, closes #6834, closes #7330)

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | yes
| Fixed tickets | #6828, #6834, #7330
| License       | MIT
| Doc PR        | symfony/symfony-docs#2479

You can use the individual tools, or register them all:

```php
use Symfony\Component\Debug\Debug;

Debug::enable();
```

Changes in Symfony SE: symfony/symfony-standard#523

Commits
-------

f693128 fixed typos
1ab1146 [Debug] fixed minor bugs
daa3a3c [Debug] changed composer to accept more versions
e455269 [Debug] ensured that the Debug tools can only be registered once
946bfb2 [Debug] made the exception handler independant of HttpFoundation
2b305c2 added a main Debug class to ease integration
2ff0927 [Debug] added the component (closes #6828, closes #6834, closes #7330)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment