Merge branch '2.1' into 2.2

* 2.1:
  [BrowserKit] fixed BC break done recently
  [Process] Fix #5594 : `termsig` must be used instead of `stopsig` in exceptions when a process is signaled
  Rename misprint property (from warmer to finder)
  Add This field is missing RU translation

Conflicts:
	src/Symfony/Component/Process/Process.php
	src/Symfony/Component/Validator/Resources/translations/validators.ru.xlf
This commit is contained in:
Fabien Potencier 2013-04-30 09:15:50 +02:00
commit d29bf50dc8
3 changed files with 47 additions and 9 deletions

View File

@ -26,7 +26,7 @@ use Symfony\Bundle\FrameworkBundle\CacheWarmer\TemplateFinderInterface;
class TemplateCacheCacheWarmer implements CacheWarmerInterface
{
protected $container;
protected $warmer;
protected $finder;
/**
* Constructor.

View File

@ -37,6 +37,11 @@ class CookieJar
/**
* Gets a cookie by name.
*
* You should never use an empty domain, but if you do so,
* this method returns the first cookie for the given name/path
* (this behavior ensures a BC behavior with previous versions of
* Symfony).
*
* @param string $name The cookie name
* @param string $path The cookie path
* @param string $domain The cookie domain
@ -49,12 +54,27 @@ class CookieJar
{
$this->flushExpiredCookies();
return isset($this->cookieJar[$domain][$path][$name]) ? $this->cookieJar[$domain][$path][$name] : null;
if (!empty($domain)) {
return isset($this->cookieJar[$domain][$path][$name]) ? $this->cookieJar[$domain][$path][$name] : null;
}
// avoid relying on this behavior that is mainly here for BC reasons
foreach ($this->cookieJar as $domain => $cookies) {
if (isset($cookies[$path][$name])) {
return $cookies[$path][$name];
}
}
return null;
}
/**
* Removes a cookie by name.
*
* You should never use an empty domain, but if you do so,
* all cookies for the given name/path expire (this behavior
* ensures a BC behavior with previous versions of Symfony).
*
* @param string $name The cookie name
* @param string $path The cookie path
* @param string $domain The cookie domain
@ -67,13 +87,23 @@ class CookieJar
$path = '/';
}
unset($this->cookieJar[$domain][$path][$name]);
if (empty($domain)) {
// an empty domain means any domain
// this should never happen but it allows for a better BC
$domains = array_keys($this->cookieJar);
} else {
$domains = array($domain);
}
if (empty($this->cookieJar[$domain][$path])) {
unset($this->cookieJar[$domain][$path]);
foreach ($domains as $domain) {
unset($this->cookieJar[$domain][$path][$name]);
if (empty($this->cookieJar[$domain])) {
unset($this->cookieJar[$domain]);
if (empty($this->cookieJar[$domain][$path])) {
unset($this->cookieJar[$domain][$path]);
if (empty($this->cookieJar[$domain])) {
unset($this->cookieJar[$domain]);
}
}
}
}

View File

@ -443,7 +443,11 @@ class Process
}
$this->updateStatus();
if ($this->processInformation['signaled']) {
throw new RuntimeException(sprintf('The process stopped because of a "%s" signal.', $this->processInformation['stopsig']));
if ($this->isSigchildEnabled()) {
throw new RuntimeException('The process has been signaled.');
}
throw new RuntimeException(sprintf('The process has been signaled with signal "%s".', $this->processInformation['termsig']));
}
$time = 0;
@ -455,7 +459,11 @@ class Process
$exitcode = proc_close($this->process);
if ($this->processInformation['signaled']) {
throw new RuntimeException(sprintf('The process stopped because of a "%s" signal.', $this->processInformation['stopsig']));
if ($this->isSigchildEnabled()) {
throw new RuntimeException('The process has been signaled.');
}
throw new RuntimeException(sprintf('The process has been signaled with signal "%s".', $this->processInformation['termsig']));
}
$this->exitcode = $this->processInformation['running'] ? $exitcode : $this->processInformation['exitcode'];