comparison vendor/symfony/http-kernel/Kernel.php @ 16:c2387f117808

Routine composer update
author Chris Cannam
date Tue, 10 Jul 2018 15:07:59 +0100
parents 1fec387a4317
children 129ea1e6d783
comparison
equal deleted inserted replaced
15:e200cb7efeb3 16:c2387f117808
65 private $projectDir; 65 private $projectDir;
66 private $warmupDir; 66 private $warmupDir;
67 private $requestStackSize = 0; 67 private $requestStackSize = 0;
68 private $resetServices = false; 68 private $resetServices = false;
69 69
70 const VERSION = '3.4.8'; 70 const VERSION = '3.4.12';
71 const VERSION_ID = 30408; 71 const VERSION_ID = 30412;
72 const MAJOR_VERSION = 3; 72 const MAJOR_VERSION = 3;
73 const MINOR_VERSION = 4; 73 const MINOR_VERSION = 4;
74 const RELEASE_VERSION = 8; 74 const RELEASE_VERSION = 12;
75 const EXTRA_VERSION = ''; 75 const EXTRA_VERSION = '';
76 76
77 const END_OF_MAINTENANCE = '11/2020'; 77 const END_OF_MAINTENANCE = '11/2020';
78 const END_OF_LIFE = '11/2021'; 78 const END_OF_LIFE = '11/2021';
79 79
85 { 85 {
86 $this->environment = $environment; 86 $this->environment = $environment;
87 $this->debug = (bool) $debug; 87 $this->debug = (bool) $debug;
88 $this->rootDir = $this->getRootDir(); 88 $this->rootDir = $this->getRootDir();
89 $this->name = $this->getName(); 89 $this->name = $this->getName();
90
91 if ($this->debug) {
92 $this->startTime = microtime(true);
93 }
94 } 90 }
95 91
96 public function __clone() 92 public function __clone()
97 { 93 {
98 if ($this->debug) {
99 $this->startTime = microtime(true);
100 }
101
102 $this->booted = false; 94 $this->booted = false;
103 $this->container = null; 95 $this->container = null;
104 $this->requestStackSize = 0; 96 $this->requestStackSize = 0;
105 $this->resetServices = false; 97 $this->resetServices = false;
106 } 98 }
114 if (!$this->requestStackSize && $this->resetServices) { 106 if (!$this->requestStackSize && $this->resetServices) {
115 if ($this->container->has('services_resetter')) { 107 if ($this->container->has('services_resetter')) {
116 $this->container->get('services_resetter')->reset(); 108 $this->container->get('services_resetter')->reset();
117 } 109 }
118 $this->resetServices = false; 110 $this->resetServices = false;
111 if ($this->debug) {
112 $this->startTime = microtime(true);
113 }
119 } 114 }
120 115
121 return; 116 return;
117 }
118 if ($this->debug) {
119 $this->startTime = microtime(true);
122 } 120 }
123 if ($this->debug && !isset($_ENV['SHELL_VERBOSITY']) && !isset($_SERVER['SHELL_VERBOSITY'])) { 121 if ($this->debug && !isset($_ENV['SHELL_VERBOSITY']) && !isset($_SERVER['SHELL_VERBOSITY'])) {
124 putenv('SHELL_VERBOSITY=3'); 122 putenv('SHELL_VERBOSITY=3');
125 $_ENV['SHELL_VERBOSITY'] = 3; 123 $_ENV['SHELL_VERBOSITY'] = 3;
126 $_SERVER['SHELL_VERBOSITY'] = 3; 124 $_SERVER['SHELL_VERBOSITY'] = 3;
585 if ($fresh = $cache->isFresh()) { 583 if ($fresh = $cache->isFresh()) {
586 // Silence E_WARNING to ignore "include" failures - don't use "@" to prevent silencing fatal errors 584 // Silence E_WARNING to ignore "include" failures - don't use "@" to prevent silencing fatal errors
587 $errorLevel = error_reporting(\E_ALL ^ \E_WARNING); 585 $errorLevel = error_reporting(\E_ALL ^ \E_WARNING);
588 $fresh = $oldContainer = false; 586 $fresh = $oldContainer = false;
589 try { 587 try {
590 if (\is_object($this->container = include $cache->getPath())) { 588 if (file_exists($cache->getPath()) && \is_object($this->container = include $cache->getPath())) {
591 $this->container->set('kernel', $this); 589 $this->container->set('kernel', $this);
592 $oldContainer = $this->container; 590 $oldContainer = $this->container;
593 $fresh = true; 591 $fresh = true;
594 } 592 }
595 } catch (\Throwable $e) { 593 } catch (\Throwable $e) {
648 file_put_contents($cacheDir.'/'.$class.'Deprecations.log', serialize(array_values($collectedLogs))); 646 file_put_contents($cacheDir.'/'.$class.'Deprecations.log', serialize(array_values($collectedLogs)));
649 file_put_contents($cacheDir.'/'.$class.'Compiler.log', null !== $container ? implode("\n", $container->getCompiler()->getLog()) : ''); 647 file_put_contents($cacheDir.'/'.$class.'Compiler.log', null !== $container ? implode("\n", $container->getCompiler()->getLog()) : '');
650 } 648 }
651 } 649 }
652 650
653 if (null === $oldContainer) { 651 if (null === $oldContainer && file_exists($cache->getPath())) {
654 $errorLevel = error_reporting(\E_ALL ^ \E_WARNING); 652 $errorLevel = error_reporting(\E_ALL ^ \E_WARNING);
655 try { 653 try {
656 $oldContainer = include $cache->getPath(); 654 $oldContainer = include $cache->getPath();
657 } catch (\Throwable $e) { 655 } catch (\Throwable $e) {
658 } catch (\Exception $e) { 656 } catch (\Exception $e) {
668 666
669 if ($oldContainer && get_class($this->container) !== $oldContainer->name) { 667 if ($oldContainer && get_class($this->container) !== $oldContainer->name) {
670 // Because concurrent requests might still be using them, 668 // Because concurrent requests might still be using them,
671 // old container files are not removed immediately, 669 // old container files are not removed immediately,
672 // but on a next dump of the container. 670 // but on a next dump of the container.
671 static $legacyContainers = array();
673 $oldContainerDir = dirname($oldContainer->getFileName()); 672 $oldContainerDir = dirname($oldContainer->getFileName());
674 foreach (glob(dirname($oldContainerDir).'/*.legacy') as $legacyContainer) { 673 $legacyContainers[$oldContainerDir.'.legacy'] = true;
675 if ($oldContainerDir.'.legacy' !== $legacyContainer && @unlink($legacyContainer)) { 674 foreach (glob(dirname($oldContainerDir).DIRECTORY_SEPARATOR.'*.legacy') as $legacyContainer) {
675 if (!isset($legacyContainers[$legacyContainer]) && @unlink($legacyContainer)) {
676 (new Filesystem())->remove(substr($legacyContainer, 0, -7)); 676 (new Filesystem())->remove(substr($legacyContainer, 0, -7));
677 } 677 }
678 } 678 }
679 679
680 touch($oldContainerDir.'.legacy'); 680 touch($oldContainerDir.'.legacy');