mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-12-02 13:09:53 +09:00
Update to laravel 7
This commit is contained in:
22
vendor/symfony/process/Pipes/AbstractPipes.php
vendored
22
vendor/symfony/process/Pipes/AbstractPipes.php
vendored
@@ -47,17 +47,17 @@ abstract class AbstractPipes implements PipesInterface
|
||||
public function close()
|
||||
{
|
||||
foreach ($this->pipes as $pipe) {
|
||||
fclose($pipe);
|
||||
if (\is_resource($pipe)) {
|
||||
fclose($pipe);
|
||||
}
|
||||
}
|
||||
$this->pipes = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if a system call has been interrupted.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function hasSystemCallBeenInterrupted()
|
||||
protected function hasSystemCallBeenInterrupted(): bool
|
||||
{
|
||||
$lastError = $this->lastError;
|
||||
$this->lastError = null;
|
||||
@@ -90,10 +90,10 @@ abstract class AbstractPipes implements PipesInterface
|
||||
*
|
||||
* @throws InvalidArgumentException When an input iterator yields a non supported value
|
||||
*/
|
||||
protected function write()
|
||||
protected function write(): ?array
|
||||
{
|
||||
if (!isset($this->pipes[0])) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
$input = $this->input;
|
||||
|
||||
@@ -105,7 +105,7 @@ abstract class AbstractPipes implements PipesInterface
|
||||
} elseif (!isset($this->inputBuffer[0])) {
|
||||
if (!\is_string($input)) {
|
||||
if (!is_scalar($input)) {
|
||||
throw new InvalidArgumentException(sprintf('%s yielded a value of type "%s", but only scalars and stream resources are supported', \get_class($this->input), \gettype($input)));
|
||||
throw new InvalidArgumentException(sprintf('"%s" yielded a value of type "%s", but only scalars and stream resources are supported.', get_debug_type($this->input), get_debug_type($input)));
|
||||
}
|
||||
$input = (string) $input;
|
||||
}
|
||||
@@ -122,7 +122,7 @@ abstract class AbstractPipes implements PipesInterface
|
||||
|
||||
// let's have a look if something changed in streams
|
||||
if (false === @stream_select($r, $w, $e, 0, 0)) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
foreach ($w as $stdin) {
|
||||
@@ -135,7 +135,7 @@ abstract class AbstractPipes implements PipesInterface
|
||||
}
|
||||
|
||||
if ($input) {
|
||||
for (;;) {
|
||||
while (true) {
|
||||
$data = fread($input, self::CHUNK_SIZE);
|
||||
if (!isset($data[0])) {
|
||||
break;
|
||||
@@ -166,12 +166,14 @@ abstract class AbstractPipes implements PipesInterface
|
||||
} elseif (!$w) {
|
||||
return [$this->pipes[0]];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function handleError($type, $msg)
|
||||
public function handleError(int $type, string $msg)
|
||||
{
|
||||
$this->lastError = $msg;
|
||||
}
|
||||
|
||||
18
vendor/symfony/process/Pipes/PipesInterface.php
vendored
18
vendor/symfony/process/Pipes/PipesInterface.php
vendored
@@ -20,21 +20,19 @@ namespace Symfony\Component\Process\Pipes;
|
||||
*/
|
||||
interface PipesInterface
|
||||
{
|
||||
const CHUNK_SIZE = 16384;
|
||||
public const CHUNK_SIZE = 16384;
|
||||
|
||||
/**
|
||||
* Returns an array of descriptors for the use of proc_open.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getDescriptors();
|
||||
public function getDescriptors(): array;
|
||||
|
||||
/**
|
||||
* Returns an array of filenames indexed by their related stream in case these pipes use temporary files.
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getFiles();
|
||||
public function getFiles(): array;
|
||||
|
||||
/**
|
||||
* Reads data in file handles and pipes.
|
||||
@@ -44,21 +42,17 @@ interface PipesInterface
|
||||
*
|
||||
* @return string[] An array of read data indexed by their fd
|
||||
*/
|
||||
public function readAndWrite($blocking, $close = false);
|
||||
public function readAndWrite(bool $blocking, bool $close = false): array;
|
||||
|
||||
/**
|
||||
* Returns if the current state has open file handles or pipes.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function areOpen();
|
||||
public function areOpen(): bool;
|
||||
|
||||
/**
|
||||
* Returns if pipes are able to read output.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function haveReadSupport();
|
||||
public function haveReadSupport(): bool;
|
||||
|
||||
/**
|
||||
* Closes file handles and pipes.
|
||||
|
||||
22
vendor/symfony/process/Pipes/UnixPipes.php
vendored
22
vendor/symfony/process/Pipes/UnixPipes.php
vendored
@@ -35,6 +35,16 @@ class UnixPipes extends AbstractPipes
|
||||
parent::__construct($input);
|
||||
}
|
||||
|
||||
public function __sleep(): array
|
||||
{
|
||||
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
|
||||
}
|
||||
|
||||
public function __wakeup()
|
||||
{
|
||||
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
$this->close();
|
||||
@@ -43,7 +53,7 @@ class UnixPipes extends AbstractPipes
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDescriptors()
|
||||
public function getDescriptors(): array
|
||||
{
|
||||
if (!$this->haveReadSupport) {
|
||||
$nullstream = fopen('/dev/null', 'c');
|
||||
@@ -81,7 +91,7 @@ class UnixPipes extends AbstractPipes
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFiles()
|
||||
public function getFiles(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
@@ -89,7 +99,7 @@ class UnixPipes extends AbstractPipes
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function readAndWrite($blocking, $close = false)
|
||||
public function readAndWrite(bool $blocking, bool $close = false): array
|
||||
{
|
||||
$this->unblock();
|
||||
$w = $this->write();
|
||||
@@ -118,7 +128,7 @@ class UnixPipes extends AbstractPipes
|
||||
$read[$type = array_search($pipe, $this->pipes, true)] = '';
|
||||
|
||||
do {
|
||||
$data = fread($pipe, self::CHUNK_SIZE);
|
||||
$data = @fread($pipe, self::CHUNK_SIZE);
|
||||
$read[$type] .= $data;
|
||||
} while (isset($data[0]) && ($close || isset($data[self::CHUNK_SIZE - 1])));
|
||||
|
||||
@@ -138,7 +148,7 @@ class UnixPipes extends AbstractPipes
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function haveReadSupport()
|
||||
public function haveReadSupport(): bool
|
||||
{
|
||||
return $this->haveReadSupport;
|
||||
}
|
||||
@@ -146,7 +156,7 @@ class UnixPipes extends AbstractPipes
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function areOpen()
|
||||
public function areOpen(): bool
|
||||
{
|
||||
return (bool) $this->pipes;
|
||||
}
|
||||
|
||||
47
vendor/symfony/process/Pipes/WindowsPipes.php
vendored
47
vendor/symfony/process/Pipes/WindowsPipes.php
vendored
@@ -17,8 +17,8 @@ use Symfony\Component\Process\Process;
|
||||
/**
|
||||
* WindowsPipes implementation uses temporary files as handles.
|
||||
*
|
||||
* @see https://bugs.php.net/bug.php?id=51800
|
||||
* @see https://bugs.php.net/bug.php?id=65650
|
||||
* @see https://bugs.php.net/51800
|
||||
* @see https://bugs.php.net/65650
|
||||
*
|
||||
* @author Romain Neutron <imprec@gmail.com>
|
||||
*
|
||||
@@ -43,7 +43,7 @@ class WindowsPipes extends AbstractPipes
|
||||
// Fix for PHP bug #51800: reading from STDOUT pipe hangs forever on Windows if the output is too big.
|
||||
// Workaround for this problem is to use temporary files instead of pipes on Windows platform.
|
||||
//
|
||||
// @see https://bugs.php.net/bug.php?id=51800
|
||||
// @see https://bugs.php.net/51800
|
||||
$pipes = [
|
||||
Process::STDOUT => Process::OUT,
|
||||
Process::STDERR => Process::ERR,
|
||||
@@ -56,20 +56,23 @@ class WindowsPipes extends AbstractPipes
|
||||
$file = sprintf('%s\\sf_proc_%02X.%s', $tmpDir, $i, $name);
|
||||
|
||||
if (!$h = fopen($file.'.lock', 'w')) {
|
||||
if (file_exists($file.'.lock')) {
|
||||
continue 2;
|
||||
}
|
||||
restore_error_handler();
|
||||
throw new RuntimeException(sprintf('A temporary file could not be opened to write the process output: %s', $lastError));
|
||||
throw new RuntimeException('A temporary file could not be opened to write the process output: '.$lastError);
|
||||
}
|
||||
if (!flock($h, LOCK_EX | LOCK_NB)) {
|
||||
if (!flock($h, \LOCK_EX | \LOCK_NB)) {
|
||||
continue 2;
|
||||
}
|
||||
if (isset($this->lockHandles[$pipe])) {
|
||||
flock($this->lockHandles[$pipe], LOCK_UN);
|
||||
flock($this->lockHandles[$pipe], \LOCK_UN);
|
||||
fclose($this->lockHandles[$pipe]);
|
||||
}
|
||||
$this->lockHandles[$pipe] = $h;
|
||||
|
||||
if (!fclose(fopen($file, 'w')) || !$h = fopen($file, 'r')) {
|
||||
flock($this->lockHandles[$pipe], LOCK_UN);
|
||||
if (!($h = fopen($file, 'w')) || !fclose($h) || !$h = fopen($file, 'r')) {
|
||||
flock($this->lockHandles[$pipe], \LOCK_UN);
|
||||
fclose($this->lockHandles[$pipe]);
|
||||
unset($this->lockHandles[$pipe]);
|
||||
continue 2;
|
||||
@@ -85,6 +88,16 @@ class WindowsPipes extends AbstractPipes
|
||||
parent::__construct($input);
|
||||
}
|
||||
|
||||
public function __sleep(): array
|
||||
{
|
||||
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
|
||||
}
|
||||
|
||||
public function __wakeup()
|
||||
{
|
||||
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
$this->close();
|
||||
@@ -93,7 +106,7 @@ class WindowsPipes extends AbstractPipes
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDescriptors()
|
||||
public function getDescriptors(): array
|
||||
{
|
||||
if (!$this->haveReadSupport) {
|
||||
$nullstream = fopen('NUL', 'c');
|
||||
@@ -105,8 +118,8 @@ class WindowsPipes extends AbstractPipes
|
||||
];
|
||||
}
|
||||
|
||||
// We're not using pipe on Windows platform as it hangs (https://bugs.php.net/bug.php?id=51800)
|
||||
// We're not using file handles as it can produce corrupted output https://bugs.php.net/bug.php?id=65650
|
||||
// We're not using pipe on Windows platform as it hangs (https://bugs.php.net/51800)
|
||||
// We're not using file handles as it can produce corrupted output https://bugs.php.net/65650
|
||||
// So we redirect output within the commandline and pass the nul device to the process
|
||||
return [
|
||||
['pipe', 'r'],
|
||||
@@ -118,7 +131,7 @@ class WindowsPipes extends AbstractPipes
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFiles()
|
||||
public function getFiles(): array
|
||||
{
|
||||
return $this->files;
|
||||
}
|
||||
@@ -126,7 +139,7 @@ class WindowsPipes extends AbstractPipes
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function readAndWrite($blocking, $close = false)
|
||||
public function readAndWrite(bool $blocking, bool $close = false): array
|
||||
{
|
||||
$this->unblock();
|
||||
$w = $this->write();
|
||||
@@ -149,7 +162,7 @@ class WindowsPipes extends AbstractPipes
|
||||
if ($close) {
|
||||
ftruncate($fileHandle, 0);
|
||||
fclose($fileHandle);
|
||||
flock($this->lockHandles[$type], LOCK_UN);
|
||||
flock($this->lockHandles[$type], \LOCK_UN);
|
||||
fclose($this->lockHandles[$type]);
|
||||
unset($this->fileHandles[$type], $this->lockHandles[$type]);
|
||||
}
|
||||
@@ -161,7 +174,7 @@ class WindowsPipes extends AbstractPipes
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function haveReadSupport()
|
||||
public function haveReadSupport(): bool
|
||||
{
|
||||
return $this->haveReadSupport;
|
||||
}
|
||||
@@ -169,7 +182,7 @@ class WindowsPipes extends AbstractPipes
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function areOpen()
|
||||
public function areOpen(): bool
|
||||
{
|
||||
return $this->pipes && $this->fileHandles;
|
||||
}
|
||||
@@ -183,7 +196,7 @@ class WindowsPipes extends AbstractPipes
|
||||
foreach ($this->fileHandles as $type => $handle) {
|
||||
ftruncate($handle, 0);
|
||||
fclose($handle);
|
||||
flock($this->lockHandles[$type], LOCK_UN);
|
||||
flock($this->lockHandles[$type], \LOCK_UN);
|
||||
fclose($this->lockHandles[$type]);
|
||||
}
|
||||
$this->fileHandles = $this->lockHandles = [];
|
||||
|
||||
Reference in New Issue
Block a user