Skip to content

Commit

Permalink
minor #20115 [Config] avoid loaded non-needed class in prod (fabpot)
Browse files Browse the repository at this point in the history
This PR was merged into the 3.2-dev branch.

Discussion
----------

[Config] avoid loaded non-needed class in prod

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

Commits
-------

16489d6 [HttpKernel] avoid loading a class that's not-needed when doing HTTP
8371b50 [Config] avoid loaded non-needed class in prod
  • Loading branch information
fabpot committed Oct 1, 2016
2 parents a1d0136 + 16489d6 commit 5228424
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/Symfony/Component/Config/ConfigCache.php
Expand Up @@ -33,10 +33,14 @@ class ConfigCache extends ResourceCheckerConfigCache
*/
public function __construct($file, $debug)
{
parent::__construct($file, array(
new SelfCheckingResourceChecker(),
));
$this->debug = (bool) $debug;

$checkers = array();
if (true === $this->debug) {
$checkers = array(new SelfCheckingResourceChecker());
}

parent::__construct($file, $checkers);
}

/**
Expand Down
Expand Up @@ -137,7 +137,7 @@ public static function getSubscribedEvents()
{
$events = array(KernelEvents::REQUEST => array('configure', 2048));

if (defined('Symfony\Component\Console\ConsoleEvents::COMMAND')) {
if ('cli' === php_sapi_name() && defined('Symfony\Component\Console\ConsoleEvents::COMMAND')) {
$events[ConsoleEvents::COMMAND] = array('configure', 2048);
}

Expand Down

0 comments on commit 5228424

Please sign in to comment.