Merge branch '2.8'
* 2.8: add subject variable to expression context [Process] Fix signaling/stopping logic on Windows Forward compatibility with AbstractLayout* 2.8 tests [Yaml] minor CS cleaning [Console] do not encode backslashes in console default description
This commit is contained in:
commit
f20f2f06cc
@ -235,7 +235,7 @@ class TextDescriptor extends Descriptor
|
|||||||
*/
|
*/
|
||||||
private function formatDefaultValue($default)
|
private function formatDefaultValue($default)
|
||||||
{
|
{
|
||||||
return json_encode($default, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
|
return str_replace('\\\\', '\\', json_encode($default, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -775,22 +775,14 @@ class Process
|
|||||||
* Stops the process.
|
* Stops the process.
|
||||||
*
|
*
|
||||||
* @param int|float $timeout The timeout in seconds
|
* @param int|float $timeout The timeout in seconds
|
||||||
* @param int $signal A POSIX signal to send in case the process has not stop at timeout, default is SIGKILL
|
* @param int $signal A POSIX signal to send in case the process has not stop at timeout, default is SIGKILL (9)
|
||||||
*
|
*
|
||||||
* @return int The exit-code of the process
|
* @return int The exit-code of the process
|
||||||
*
|
|
||||||
* @throws RuntimeException if the process got signaled
|
|
||||||
*/
|
*/
|
||||||
public function stop($timeout = 10, $signal = null)
|
public function stop($timeout = 10, $signal = null)
|
||||||
{
|
{
|
||||||
$timeoutMicro = microtime(true) + $timeout;
|
$timeoutMicro = microtime(true) + $timeout;
|
||||||
if ($this->isRunning()) {
|
if ($this->isRunning()) {
|
||||||
if ('\\' === DIRECTORY_SEPARATOR && !$this->isSigchildEnabled()) {
|
|
||||||
exec(sprintf('taskkill /F /T /PID %d 2>&1', $this->getPid()), $output, $exitCode);
|
|
||||||
if ($exitCode > 0) {
|
|
||||||
throw new RuntimeException('Unable to kill the process');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// given `SIGTERM` may not be defined and that `proc_terminate` uses the constant value and not the constant itself, we use the same here
|
// given `SIGTERM` may not be defined and that `proc_terminate` uses the constant value and not the constant itself, we use the same here
|
||||||
$this->doSignal(15, false);
|
$this->doSignal(15, false);
|
||||||
do {
|
do {
|
||||||
@ -798,13 +790,9 @@ class Process
|
|||||||
} while ($this->isRunning() && microtime(true) < $timeoutMicro);
|
} while ($this->isRunning() && microtime(true) < $timeoutMicro);
|
||||||
|
|
||||||
if ($this->isRunning() && !$this->isSigchildEnabled()) {
|
if ($this->isRunning() && !$this->isSigchildEnabled()) {
|
||||||
if (null !== $signal || defined('SIGKILL')) {
|
// Avoid exception here: process is supposed to be running, but it might have stopped just
|
||||||
// avoid exception here :
|
// after this line. In any case, let's silently discard the error, we cannot do anything.
|
||||||
// process is supposed to be running, but it might have stop
|
$this->doSignal($signal ?: 9, false);
|
||||||
// just after this line.
|
|
||||||
// in any case, let's silently discard the error, we can not do anything
|
|
||||||
$this->doSignal($signal ?: SIGKILL, false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1434,7 +1422,18 @@ class Process
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (true !== @proc_terminate($this->process, $signal)) {
|
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||||
|
exec(sprintf('taskkill /F /T /PID %d 2>&1', $this->getPid()), $output, $exitCode);
|
||||||
|
if ($exitCode) {
|
||||||
|
if ($throwException) {
|
||||||
|
throw new RuntimeException(sprintf('Unable to kill the process (%s).', implode(' ', $output)));
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (true !== @proc_terminate($this->process, $signal) && '\\' !== DIRECTORY_SEPARATOR) {
|
||||||
if ($throwException) {
|
if ($throwException) {
|
||||||
throw new RuntimeException(sprintf('Error while sending signal `%s`.', $signal));
|
throw new RuntimeException(sprintf('Error while sending signal `%s`.', $signal));
|
||||||
}
|
}
|
||||||
|
@ -86,6 +86,7 @@ class ExpressionVoter implements VoterInterface
|
|||||||
'token' => $token,
|
'token' => $token,
|
||||||
'user' => $token->getUser(),
|
'user' => $token->getUser(),
|
||||||
'object' => $subject,
|
'object' => $subject,
|
||||||
|
'subject' => $subject,
|
||||||
'roles' => array_map(function ($role) { return $role->getRole(); }, $roles),
|
'roles' => array_map(function ($role) { return $role->getRole(); }, $roles),
|
||||||
'trust_resolver' => $this->trustResolver,
|
'trust_resolver' => $this->trustResolver,
|
||||||
);
|
);
|
||||||
|
@ -345,7 +345,7 @@ class Parser
|
|||||||
if (null === $indentation) {
|
if (null === $indentation) {
|
||||||
$newIndent = $this->getCurrentLineIndentation();
|
$newIndent = $this->getCurrentLineIndentation();
|
||||||
|
|
||||||
$unindentedEmbedBlock = $this->isStringUnIndentedCollectionItem($this->currentLine);
|
$unindentedEmbedBlock = $this->isStringUnIndentedCollectionItem();
|
||||||
|
|
||||||
if (!$this->isCurrentLineEmpty() && 0 === $newIndent && !$unindentedEmbedBlock) {
|
if (!$this->isCurrentLineEmpty() && 0 === $newIndent && !$unindentedEmbedBlock) {
|
||||||
throw new ParseException('Indentation problem.', $this->getRealCurrentLineNb() + 1, $this->currentLine);
|
throw new ParseException('Indentation problem.', $this->getRealCurrentLineNb() + 1, $this->currentLine);
|
||||||
@ -371,7 +371,7 @@ class Parser
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$isItUnindentedCollection = $this->isStringUnIndentedCollectionItem($this->currentLine);
|
$isItUnindentedCollection = $this->isStringUnIndentedCollectionItem();
|
||||||
|
|
||||||
// Comments must not be removed inside a block scalar
|
// Comments must not be removed inside a block scalar
|
||||||
$removeCommentsPattern = '~'.self::BLOCK_SCALAR_HEADER_PATTERN.'$~';
|
$removeCommentsPattern = '~'.self::BLOCK_SCALAR_HEADER_PATTERN.'$~';
|
||||||
@ -384,7 +384,7 @@ class Parser
|
|||||||
$removeComments = !preg_match($removeCommentsPattern, $this->currentLine);
|
$removeComments = !preg_match($removeCommentsPattern, $this->currentLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($isItUnindentedCollection && !$this->isStringUnIndentedCollectionItem($this->currentLine) && $newIndent === $indent) {
|
if ($isItUnindentedCollection && !$this->isStringUnIndentedCollectionItem() && $newIndent === $indent) {
|
||||||
$this->moveToPreviousLine();
|
$this->moveToPreviousLine();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -693,7 +693,7 @@ class Parser
|
|||||||
if (
|
if (
|
||||||
$this->getCurrentLineIndentation() == $currentIndentation
|
$this->getCurrentLineIndentation() == $currentIndentation
|
||||||
&&
|
&&
|
||||||
$this->isStringUnIndentedCollectionItem($this->currentLine)
|
$this->isStringUnIndentedCollectionItem()
|
||||||
) {
|
) {
|
||||||
$ret = true;
|
$ret = true;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user