diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php index 2ae4a0e46c..5e98e1d58f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php @@ -158,9 +158,18 @@ EOF } // fix references to kernel/container related classes - $search = $tempKernel->getName().ucfirst($tempKernel->getEnvironment()); - $replace = $realKernel->getName().ucfirst($realKernel->getEnvironment()); - foreach (Finder::create()->files()->name($search.'*')->in($warmupDir) as $file) { + $fileSearch = $tempKernel->getName().ucfirst($tempKernel->getEnvironment()).'*'; + $search = array( + $tempKernel->getName().ucfirst($tempKernel->getEnvironment()), + sprintf('\'kernel.name\' => \'%s\'', $tempKernel->getName()), + sprintf('key="kernel.name">%s<', $tempKernel->getName()), + ); + $replace = array( + $realKernel->getName().ucfirst($realKernel->getEnvironment()), + sprintf('\'kernel.name\' => \'%s\'', $realKernel->getName()), + sprintf('key="kernel.name">%s<', $realKernel->getName()), + ); + foreach (Finder::create()->files()->name($fileSearch)->in($warmupDir) as $file) { $content = str_replace($search, $replace, file_get_contents($file)); file_put_contents(str_replace($search, $replace, $file), $content); unlink($file); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php index 501355beff..c351a790ac 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php @@ -83,5 +83,6 @@ class CacheClearCommandTest extends TestCase } } $this->assertTrue($found, 'Kernel file should present as resource'); + $this->assertRegExp(sprintf('/\'kernel.name\'\s*=>\s*\'%s\'/', $this->kernel->getName()), file_get_contents($containerFile), 'kernel.name is properly set on the dumped container'); } } diff --git a/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception.html.twig b/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception.html.twig index f09ffb3c65..546c3f262b 100644 --- a/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception.html.twig +++ b/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception.html.twig @@ -98,7 +98,7 @@ if (clazz) { var tags = document.getElementsByTagName('*'); - for (i = tags.length - 1; i >= 0 ; i--) { + for (i = tags.length - 1; i >= 0; i--) { if (tags[i].className === clazz) { tags[i].style.display = 'none'; } diff --git a/src/Symfony/Component/Console/Helper/DialogHelper.php b/src/Symfony/Component/Console/Helper/DialogHelper.php index fa747339e7..0f6ae520c9 100644 --- a/src/Symfony/Component/Console/Helper/DialogHelper.php +++ b/src/Symfony/Component/Console/Helper/DialogHelper.php @@ -458,7 +458,7 @@ class DialogHelper extends InputAwareHelper * @param callable $interviewer A callable that will ask for a question and return the result * @param OutputInterface $output An Output instance * @param callable $validator A PHP callback - * @param int|false $attempts Max number of times to ask before giving up ; false will ask infinitely + * @param int|false $attempts Max number of times to ask before giving up; false will ask infinitely * * @return string The validated response * diff --git a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php index 7e4ec86dba..202c6e8645 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php @@ -215,7 +215,7 @@ class RequestTest extends \PHPUnit_Framework_TestCase $this->assertEquals('/?foo', $request->getRequestUri()); $this->assertEquals(array('foo' => ''), $request->query->all()); - // assume rewrite rule: (.*) --> app/app.php ; app/ is a symlink to a symfony web/ directory + // assume rewrite rule: (.*) --> app/app.php; app/ is a symlink to a symfony web/ directory $request = Request::create('http://test.com/apparthotel-1234', 'GET', array(), array(), array(), array( 'DOCUMENT_ROOT' => '/var/www/www.test.com', diff --git a/src/Symfony/Component/Intl/Locale/Locale.php b/src/Symfony/Component/Intl/Locale/Locale.php index 23194a064d..cc30c14ffd 100644 --- a/src/Symfony/Component/Intl/Locale/Locale.php +++ b/src/Symfony/Component/Intl/Locale/Locale.php @@ -306,7 +306,7 @@ class Locale * * @return bool true on success or false on failure * - * @see http://www.php.net/manual/en/locale.parselocale.php + * @see http://www.php.net/manual/en/locale.setdefault.php * * @throws MethodNotImplementedException */ diff --git a/src/Symfony/Component/Process/Process.php b/src/Symfony/Component/Process/Process.php index 10885bcef7..df36fd581d 100644 --- a/src/Symfony/Component/Process/Process.php +++ b/src/Symfony/Component/Process/Process.php @@ -780,8 +780,12 @@ class Process } } - $this->updateStatus(false); - if ($this->processInformation['running']) { + if ($this->isRunning()) { + if (isset($this->fallbackStatus['pid'])) { + unset($this->fallbackStatus['pid']); + + return $this->stop(0, $signal); + } $this->close(); } @@ -1412,7 +1416,7 @@ class Process */ private function doSignal($signal, $throwException) { - if (!$this->isRunning()) { + if (null === $pid = $this->getPid()) { if ($throwException) { throw new LogicException('Can not send signal on a non running process.'); } @@ -1421,7 +1425,7 @@ class Process } if ('\\' === DIRECTORY_SEPARATOR) { - exec(sprintf('taskkill /F /T /PID %d 2>&1', $this->getPid()), $output, $exitCode); + exec(sprintf('taskkill /F /T /PID %d 2>&1', $pid), $output, $exitCode); if ($exitCode && $this->isRunning()) { if ($throwException) { throw new RuntimeException(sprintf('Unable to kill the process (%s).', implode(' ', $output))); @@ -1433,8 +1437,8 @@ class Process if (!$this->enhanceSigchildCompatibility || !$this->isSigchildEnabled()) { $ok = @proc_terminate($this->process, $signal); } elseif (function_exists('posix_kill')) { - $ok = @posix_kill($this->getPid(), $signal); - } elseif ($ok = proc_open(sprintf('kill -%d %d', $signal, $this->getPid()), array(2 => array('pipe', 'w')), $pipes)) { + $ok = @posix_kill($pid, $signal); + } elseif ($ok = proc_open(sprintf('kill -%d %d', $signal, $pid), array(2 => array('pipe', 'w')), $pipes)) { $ok = false === fgets($pipes[2]); } if (!$ok) { diff --git a/src/Symfony/Component/Process/Tests/ProcessTest.php b/src/Symfony/Component/Process/Tests/ProcessTest.php index 4e17ed81b7..8af324cad3 100644 --- a/src/Symfony/Component/Process/Tests/ProcessTest.php +++ b/src/Symfony/Component/Process/Tests/ProcessTest.php @@ -787,22 +787,16 @@ class ProcessTest extends \PHPUnit_Framework_TestCase */ public function testRunProcessWithTimeout() { - $timeout = 0.1; - $process = $this->getProcess(self::$phpBin.' -r "sleep(1);"'); - $process->setTimeout($timeout); + $process = $this->getProcess(self::$phpBin.' -r "sleep(30);"'); + $process->setTimeout(0.1); $start = microtime(true); try { $process->run(); $this->fail('A RuntimeException should have been raised'); } catch (RuntimeException $e) { } - $duration = microtime(true) - $start; - if ('\\' !== DIRECTORY_SEPARATOR) { - // On Windows, timers are too transient - $maxDuration = $timeout + 2 * Process::TIMEOUT_PRECISION; - $this->assertLessThan($maxDuration, $duration); - } + $this->assertLessThan(15, microtime(true) - $start); throw $e; }