Update to Drupal 8.2.6. For more information, see https://www.drupal.org/project/drupal/releases/8.2.6

This commit is contained in:
Pantheon Automation 2017-02-02 16:28:38 -08:00 committed by Greg Anderson
parent db56c09587
commit f1e72395cb
588 changed files with 26857 additions and 2777 deletions

View file

@ -60,7 +60,7 @@ class ExecutableFinder
if (@is_dir($path)) {
$dirs[] = $path;
} else {
if (basename($path) == $name && is_executable($path)) {
if (basename($path) == $name && @is_executable($path)) {
return $path;
}
}
@ -79,7 +79,7 @@ class ExecutableFinder
}
foreach ($suffixes as $suffix) {
foreach ($dirs as $dir) {
if (is_file($file = $dir.DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === DIRECTORY_SEPARATOR || is_executable($file))) {
if (@is_file($file = $dir.DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === DIRECTORY_SEPARATOR || is_executable($file))) {
return $file;
}
}

View file

@ -1,4 +1,4 @@
Copyright (c) 2004-2016 Fabien Potencier
Copyright (c) 2004-2017 Fabien Potencier
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View file

@ -22,10 +22,9 @@ abstract class AbstractPipes implements PipesInterface
public $pipes = array();
/** @var string */
protected $inputBuffer = '';
private $inputBuffer = '';
/** @var resource|null */
protected $input;
private $input;
/** @var bool */
private $blocked = true;
@ -91,9 +90,8 @@ abstract class AbstractPipes implements PipesInterface
if (!isset($this->pipes[0])) {
return;
}
$e = array();
$r = null !== $this->input ? array($this->input) : $e;
$input = $this->input;
$r = $e = array();
$w = array($this->pipes[0]);
// let's have a look if something changed in streams
@ -110,7 +108,7 @@ abstract class AbstractPipes implements PipesInterface
}
}
foreach ($r as $input) {
if ($input) {
for (;;) {
$data = fread($input, self::CHUNK_SIZE);
if (!isset($data[0])) {
@ -124,7 +122,7 @@ abstract class AbstractPipes implements PipesInterface
return array($this->pipes[0]);
}
}
if (!isset($data[0]) && feof($input)) {
if (feof($input)) {
// no more data to read on input resource
// use an empty buffer in the next reads
$this->input = null;
@ -136,9 +134,7 @@ abstract class AbstractPipes implements PipesInterface
if (null === $this->input && !isset($this->inputBuffer[0])) {
fclose($this->pipes[0]);
unset($this->pipes[0]);
}
if (!$w) {
} elseif (!$w) {
return array($this->pipes[0]);
}
}

View file

@ -39,10 +39,10 @@ interface PipesInterface
/**
* Reads data in file handles and pipes.
*
* @param bool $blocking Whether to use blocking calls or not.
* @param bool $close Whether to close pipes if they've reached EOF.
* @param bool $blocking Whether to use blocking calls or not
* @param bool $close Whether to close pipes if they've reached EOF
*
* @return string[] An array of read data indexed by their fd.
* @return string[] An array of read data indexed by their fd
*/
public function readAndWrite($blocking, $close = false);

View file

@ -120,7 +120,7 @@ class UnixPipes extends AbstractPipes
do {
$data = fread($pipe, self::CHUNK_SIZE);
$read[$type] .= $data;
} while (isset($data[0]));
} while (isset($data[0]) && ($close || isset($data[self::CHUNK_SIZE - 1])));
if (!isset($read[$type][0])) {
unset($read[$type]);
@ -149,7 +149,7 @@ class UnixPipes extends AbstractPipes
* @param Process $process
* @param string|resource $input
*
* @return UnixPipes
* @return static
*/
public static function create(Process $process, $input)
{

View file

@ -47,15 +47,40 @@ class WindowsPipes extends AbstractPipes
// Workaround for this problem is to use temporary files instead of pipes on Windows platform.
//
// @see https://bugs.php.net/bug.php?id=51800
$this->files = array(
Process::STDOUT => tempnam(sys_get_temp_dir(), 'out_sf_proc'),
Process::STDERR => tempnam(sys_get_temp_dir(), 'err_sf_proc'),
$pipes = array(
Process::STDOUT => Process::OUT,
Process::STDERR => Process::ERR,
);
foreach ($this->files as $offset => $file) {
if (false === $file || false === $this->fileHandles[$offset] = @fopen($file, 'rb')) {
throw new RuntimeException('A temporary file could not be opened to write the process output to, verify that your TEMP environment variable is writable');
$tmpCheck = false;
$tmpDir = sys_get_temp_dir();
$lastError = 'unknown reason';
set_error_handler(function ($type, $msg) use (&$lastError) { $lastError = $msg; });
for ($i = 0;; ++$i) {
foreach ($pipes as $pipe => $name) {
$file = sprintf('%s\\sf_proc_%02X.%s', $tmpDir, $i, $name);
if (file_exists($file) && !unlink($file)) {
continue 2;
}
$h = fopen($file, 'xb');
if (!$h) {
$error = $lastError;
if ($tmpCheck || $tmpCheck = unlink(tempnam(false, 'sf_check_'))) {
continue;
}
restore_error_handler();
throw new RuntimeException(sprintf('A temporary file could not be opened to write the process output: %s', $error));
}
if (!$h || !$this->fileHandles[$pipe] = fopen($file, 'rb')) {
continue 2;
}
if (isset($this->files[$pipe])) {
unlink($this->files[$pipe]);
}
$this->files[$pipe] = $file;
}
break;
}
restore_error_handler();
}
parent::__construct($input);
@ -158,7 +183,7 @@ class WindowsPipes extends AbstractPipes
* @param Process $process The process
* @param $input
*
* @return WindowsPipes
* @return static
*/
public static function create(Process $process, $input)
{

View file

@ -158,7 +158,7 @@ class Process
$this->setEnv($env);
}
$this->input = $input;
$this->setInput($input);
$this->setTimeout($timeout);
$this->useFileHandles = '\\' === DIRECTORY_SEPARATOR;
$this->pty = false;
@ -314,7 +314,7 @@ class Process
* @param callable|null $callback A PHP callback to run whenever there is some
* output available on STDOUT or STDERR
*
* @return Process The new process
* @return $this
*
* @throws RuntimeException When process can't be launched
* @throws RuntimeException When process is already running
@ -389,7 +389,7 @@ class Process
*
* @param int $signal A valid POSIX signal (see http://www.php.net/manual/en/pcntl.constants.php)
*
* @return Process
* @return $this
*
* @throws LogicException In case the process is not running
* @throws RuntimeException In case --enable-sigchild is activated and the process can't be killed
@ -405,7 +405,7 @@ class Process
/**
* Disables fetching output and error output from the underlying process.
*
* @return Process
* @return $this
*
* @throws RuntimeException In case the process is already running
* @throws LogicException if an idle timeout is set
@ -427,7 +427,7 @@ class Process
/**
* Enables fetching output and error output from the underlying process.
*
* @return Process
* @return $this
*
* @throws RuntimeException In case the process is already running
*/
@ -477,10 +477,10 @@ class Process
* In comparison with the getOutput method which always return the whole
* output, this one returns the new output since the last call.
*
* @return string The process output since the last call
*
* @throws LogicException in case the output has been disabled
* @throws LogicException In case the process is not started
*
* @return string The process output since the last call
*/
public function getIncrementalOutput()
{
@ -499,7 +499,7 @@ class Process
/**
* Clears the process output.
*
* @return Process
* @return $this
*/
public function clearOutput()
{
@ -536,10 +536,10 @@ class Process
* whole error output, this one returns the new error output since the last
* call.
*
* @return string The process error output since the last call
*
* @throws LogicException in case the output has been disabled
* @throws LogicException In case the process is not started
*
* @return string The process error output since the last call
*/
public function getIncrementalErrorOutput()
{
@ -558,7 +558,7 @@ class Process
/**
* Clears the process output.
*
* @return Process
* @return $this
*/
public function clearErrorOutput()
{
@ -593,7 +593,7 @@ class Process
* This method relies on the Unix exit code status standardization
* and might not be relevant for other operating systems.
*
* @return null|string A string representation for the exit status code, null if the Process is not terminated.
* @return null|string A string representation for the exit status code, null if the Process is not terminated
*
* @see http://tldp.org/LDP/abs/html/exitcodes.html
* @see http://en.wikipedia.org/wiki/Unix_signal
@ -881,7 +881,7 @@ class Process
*
* @param int|float|null $timeout The timeout in seconds
*
* @return self The current Process instance.
* @return self The current Process instance
*
* @throws LogicException if the output is disabled
* @throws InvalidArgumentException if the timeout is negative
@ -911,8 +911,16 @@ class Process
if ('\\' === DIRECTORY_SEPARATOR && $tty) {
throw new RuntimeException('TTY mode is not supported on Windows platform.');
}
if ($tty && (!file_exists('/dev/tty') || !is_readable('/dev/tty'))) {
throw new RuntimeException('TTY mode requires /dev/tty to be readable.');
if ($tty) {
static $isTtySupported;
if (null === $isTtySupported) {
$isTtySupported = (bool) @proc_open('echo 1 >/dev/null', array(array('file', '/dev/tty', 'r'), array('file', '/dev/tty', 'w'), array('file', '/dev/tty', 'w')), $pipes);
}
if (!$isTtySupported) {
throw new RuntimeException('TTY mode requires /dev/tty to be read/writable.');
}
}
$this->tty = (bool) $tty;
@ -1087,7 +1095,7 @@ class Process
throw new LogicException('Input can not be set while the process is running.');
}
$this->input = ProcessUtils::validateInput(sprintf('%s::%s', __CLASS__, __FUNCTION__), $input);
$this->input = ProcessUtils::validateInput(__METHOD__, $input);
return $this;
}
@ -1214,7 +1222,7 @@ class Process
return $result = false;
}
return $result = (bool) @proc_open('echo 1', array(array('pty'), array('pty'), array('pty')), $pipes);
return $result = (bool) @proc_open('echo 1 >/dev/null', array(array('pty'), array('pty'), array('pty')), $pipes);
}
/**
@ -1265,7 +1273,7 @@ class Process
/**
* Updates the status of the process, reads pipes.
*
* @param bool $blocking Whether to use a blocking read call.
* @param bool $blocking Whether to use a blocking read call
*/
protected function updateStatus($blocking)
{
@ -1351,8 +1359,8 @@ class Process
/**
* Reads pipes, executes callback.
*
* @param bool $blocking Whether to use blocking calls or not.
* @param bool $close Whether to close file handles or not.
* @param bool $blocking Whether to use blocking calls or not
* @param bool $close Whether to close file handles or not
*/
private function readPipes($blocking, $close)
{
@ -1478,7 +1486,7 @@ class Process
/**
* Ensures the process is running or terminated, throws a LogicException if the process has a not started.
*
* @param string $functionName The function name that was called.
* @param string $functionName The function name that was called
*
* @throws LogicException If the process has not run.
*/
@ -1492,7 +1500,7 @@ class Process
/**
* Ensures the process is terminated, throws a LogicException if the process has a status different than `terminated`.
*
* @param string $functionName The function name that was called.
* @param string $functionName The function name that was called
*
* @throws LogicException If the process is not yet terminated.
*/

View file

@ -46,7 +46,7 @@ class ProcessBuilder
*
* @param string[] $arguments An array of arguments
*
* @return ProcessBuilder
* @return static
*/
public static function create(array $arguments = array())
{
@ -58,7 +58,7 @@ class ProcessBuilder
*
* @param string $argument A command argument
*
* @return ProcessBuilder
* @return $this
*/
public function add($argument)
{
@ -74,7 +74,7 @@ class ProcessBuilder
*
* @param string|array $prefix A command prefix or an array of command prefixes
*
* @return ProcessBuilder
* @return $this
*/
public function setPrefix($prefix)
{
@ -91,7 +91,7 @@ class ProcessBuilder
*
* @param string[] $arguments
*
* @return ProcessBuilder
* @return $this
*/
public function setArguments(array $arguments)
{
@ -105,7 +105,7 @@ class ProcessBuilder
*
* @param null|string $cwd The working directory
*
* @return ProcessBuilder
* @return $this
*/
public function setWorkingDirectory($cwd)
{
@ -119,7 +119,7 @@ class ProcessBuilder
*
* @param bool $inheritEnv
*
* @return ProcessBuilder
* @return $this
*/
public function inheritEnvironmentVariables($inheritEnv = true)
{
@ -137,7 +137,7 @@ class ProcessBuilder
* @param string $name The variable name
* @param null|string $value The variable value
*
* @return ProcessBuilder
* @return $this
*/
public function setEnv($name, $value)
{
@ -155,7 +155,7 @@ class ProcessBuilder
*
* @param array $variables The variables
*
* @return ProcessBuilder
* @return $this
*/
public function addEnvironmentVariables(array $variables)
{
@ -169,7 +169,7 @@ class ProcessBuilder
*
* @param mixed $input The input as a string
*
* @return ProcessBuilder
* @return $this
*
* @throws InvalidArgumentException In case the argument is invalid
*
@ -177,7 +177,7 @@ class ProcessBuilder
*/
public function setInput($input)
{
$this->input = ProcessUtils::validateInput(sprintf('%s::%s', __CLASS__, __FUNCTION__), $input);
$this->input = ProcessUtils::validateInput(__METHOD__, $input);
return $this;
}
@ -189,7 +189,7 @@ class ProcessBuilder
*
* @param float|null $timeout
*
* @return ProcessBuilder
* @return $this
*
* @throws InvalidArgumentException
*/
@ -218,7 +218,7 @@ class ProcessBuilder
* @param string $name The option name
* @param string $value The option value
*
* @return ProcessBuilder
* @return $this
*/
public function setOption($name, $value)
{
@ -230,7 +230,7 @@ class ProcessBuilder
/**
* Disables fetching output and error output from the underlying process.
*
* @return ProcessBuilder
* @return $this
*/
public function disableOutput()
{
@ -242,7 +242,7 @@ class ProcessBuilder
/**
* Enables fetching output and error output from the underlying process.
*
* @return ProcessBuilder
* @return $this
*/
public function enableOutput()
{

View file

@ -80,7 +80,7 @@ class ProcessUtils
* @param string $caller The name of method call that validates the input
* @param mixed $input The input to validate
*
* @return string The validated input
* @return mixed The validated input
*
* @throws InvalidArgumentException In case the input is not valid
*
@ -92,6 +92,9 @@ class ProcessUtils
if (is_resource($input)) {
return $input;
}
if (is_string($input)) {
return $input;
}
if (is_scalar($input)) {
return (string) $input;
}