updated plugin WP-WebAuthn
version 1.3.4
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
Copyright (c) 2018-2019 Fabien Potencier
|
||||
Copyright (c) 2018-present 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
|
||||
|
@ -16,7 +16,7 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=7.1"
|
||||
"php": ">=7.2"
|
||||
},
|
||||
"provide": {
|
||||
"ext-ctype": "*"
|
||||
@ -30,9 +30,6 @@
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "1.27-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
"url": "https://github.com/symfony/polyfill"
|
||||
|
@ -1,4 +1,4 @@
|
||||
Copyright (c) 2020 Fabien Potencier
|
||||
Copyright (c) 2020-present 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
|
||||
|
@ -20,7 +20,7 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=7.1"
|
||||
"php": ">=7.2"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": { "Symfony\\Polyfill\\Php80\\": "" },
|
||||
@ -29,9 +29,6 @@
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "1.27-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
"url": "https://github.com/symfony/polyfill"
|
||||
|
@ -1,4 +1,4 @@
|
||||
Copyright (c) 2021 Fabien Potencier
|
||||
Copyright (c) 2021-present 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
|
||||
|
@ -7,6 +7,7 @@ This component provides features added to PHP 8.1 core:
|
||||
- [`enum_exists`](https://php.net/enum-exists)
|
||||
- [`MYSQLI_REFRESH_REPLICA`](https://php.net/mysqli.constants#constantmysqli-refresh-replica) constant
|
||||
- [`ReturnTypeWillChange`](https://wiki.php.net/rfc/internal_method_return_types)
|
||||
- [`CURLStringFile`](https://php.net/CURLStringFile) (but only if PHP >= 7.4 is used)
|
||||
|
||||
More information can be found in the
|
||||
[main Polyfill README](https://github.com/symfony/polyfill/blob/main/README.md).
|
||||
|
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
if (\PHP_VERSION_ID >= 70400 && extension_loaded('curl')) {
|
||||
/**
|
||||
* @property string $data
|
||||
*/
|
||||
class CURLStringFile extends CURLFile
|
||||
{
|
||||
private $data;
|
||||
|
||||
public function __construct(string $data, string $postname, string $mime = 'application/octet-stream')
|
||||
{
|
||||
$this->data = $data;
|
||||
parent::__construct('data://application/octet-stream;base64,'.base64_encode($data), $mime, $postname);
|
||||
}
|
||||
|
||||
public function __set(string $name, $value): void
|
||||
{
|
||||
if ('data' !== $name) {
|
||||
$this->$name = $value;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (is_object($value) ? !method_exists($value, '__toString') : !is_scalar($value)) {
|
||||
throw new TypeError('Cannot assign '.gettype($value).' to property CURLStringFile::$data of type string');
|
||||
}
|
||||
|
||||
$this->name = 'data://application/octet-stream;base64,'.base64_encode($value);
|
||||
}
|
||||
|
||||
public function __isset(string $name): bool
|
||||
{
|
||||
return isset($this->$name);
|
||||
}
|
||||
|
||||
public function &__get(string $name)
|
||||
{
|
||||
return $this->$name;
|
||||
}
|
||||
}
|
||||
}
|
@ -25,9 +25,6 @@
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "1.27-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
"url": "https://github.com/symfony/polyfill"
|
||||
|
@ -46,7 +46,7 @@ class ExecutableFinder
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function find(string $name, string $default = null, array $extraDirs = [])
|
||||
public function find(string $name, ?string $default = null, array $extraDirs = [])
|
||||
{
|
||||
if (\ini_get('open_basedir')) {
|
||||
$searchPath = array_merge(explode(\PATH_SEPARATOR, \ini_get('open_basedir')), $extraDirs);
|
||||
|
@ -30,7 +30,7 @@ class InputStream implements \IteratorAggregate
|
||||
/**
|
||||
* Sets a callback that is called when the write buffer becomes empty.
|
||||
*/
|
||||
public function onEmpty(callable $onEmpty = null)
|
||||
public function onEmpty(?callable $onEmpty = null)
|
||||
{
|
||||
$this->onEmpty = $onEmpty;
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ class PhpExecutableFinder
|
||||
{
|
||||
if ($php = getenv('PHP_BINARY')) {
|
||||
if (!is_executable($php)) {
|
||||
$command = '\\' === \DIRECTORY_SEPARATOR ? 'where' : 'command -v';
|
||||
$command = '\\' === \DIRECTORY_SEPARATOR ? 'where' : 'command -v --';
|
||||
if ($php = strtok(exec($command.' '.escapeshellarg($php)), \PHP_EOL)) {
|
||||
if (!is_executable($php)) {
|
||||
return false;
|
||||
|
@ -32,7 +32,7 @@ class PhpProcess extends Process
|
||||
* @param int $timeout The timeout in seconds
|
||||
* @param array|null $php Path to the PHP binary to use with any additional arguments
|
||||
*/
|
||||
public function __construct(string $script, string $cwd = null, array $env = null, int $timeout = 60, array $php = null)
|
||||
public function __construct(string $script, ?string $cwd = null, ?array $env = null, int $timeout = 60, ?array $php = null)
|
||||
{
|
||||
if (null === $php) {
|
||||
$executableFinder = new PhpExecutableFinder();
|
||||
@ -53,7 +53,7 @@ class PhpProcess extends Process
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function fromShellCommandline(string $command, string $cwd = null, array $env = null, $input = null, ?float $timeout = 60)
|
||||
public static function fromShellCommandline(string $command, ?string $cwd = null, ?array $env = null, $input = null, ?float $timeout = 60)
|
||||
{
|
||||
throw new LogicException(sprintf('The "%s()" method cannot be called when using "%s".', __METHOD__, self::class));
|
||||
}
|
||||
@ -61,7 +61,7 @@ class PhpProcess extends Process
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function start(callable $callback = null, array $env = [])
|
||||
public function start(?callable $callback = null, array $env = [])
|
||||
{
|
||||
if (null === $this->getCommandLine()) {
|
||||
throw new RuntimeException('Unable to find the PHP executable.');
|
||||
|
@ -149,7 +149,7 @@ class WindowsPipes extends AbstractPipes
|
||||
if ($w) {
|
||||
@stream_select($r, $w, $e, 0, Process::TIMEOUT_PRECISION * 1E6);
|
||||
} elseif ($this->fileHandles) {
|
||||
usleep(Process::TIMEOUT_PRECISION * 1E6);
|
||||
usleep((int) (Process::TIMEOUT_PRECISION * 1E6));
|
||||
}
|
||||
}
|
||||
foreach ($this->fileHandles as $type => $fileHandle) {
|
||||
|
@ -80,6 +80,7 @@ class Process implements \IteratorAggregate
|
||||
private $processPipes;
|
||||
|
||||
private $latestSignal;
|
||||
private $cachedExitCode;
|
||||
|
||||
private static $sigchild;
|
||||
|
||||
@ -140,7 +141,7 @@ class Process implements \IteratorAggregate
|
||||
*
|
||||
* @throws LogicException When proc_open is not installed
|
||||
*/
|
||||
public function __construct(array $command, string $cwd = null, array $env = null, $input = null, ?float $timeout = 60)
|
||||
public function __construct(array $command, ?string $cwd = null, ?array $env = null, $input = null, ?float $timeout = 60)
|
||||
{
|
||||
if (!\function_exists('proc_open')) {
|
||||
throw new LogicException('The Process class relies on proc_open, which is not available on your PHP installation.');
|
||||
@ -189,7 +190,7 @@ class Process implements \IteratorAggregate
|
||||
*
|
||||
* @throws LogicException When proc_open is not installed
|
||||
*/
|
||||
public static function fromShellCommandline(string $command, string $cwd = null, array $env = null, $input = null, ?float $timeout = 60)
|
||||
public static function fromShellCommandline(string $command, ?string $cwd = null, ?array $env = null, $input = null, ?float $timeout = 60)
|
||||
{
|
||||
$process = new static([], $cwd, $env, $input, $timeout);
|
||||
$process->commandline = $command;
|
||||
@ -247,7 +248,7 @@ class Process implements \IteratorAggregate
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
public function run(callable $callback = null, array $env = []): int
|
||||
public function run(?callable $callback = null, array $env = []): int
|
||||
{
|
||||
$this->start($callback, $env);
|
||||
|
||||
@ -266,7 +267,7 @@ class Process implements \IteratorAggregate
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
public function mustRun(callable $callback = null, array $env = []): self
|
||||
public function mustRun(?callable $callback = null, array $env = []): self
|
||||
{
|
||||
if (0 !== $this->run($callback, $env)) {
|
||||
throw new ProcessFailedException($this);
|
||||
@ -294,7 +295,7 @@ class Process implements \IteratorAggregate
|
||||
* @throws RuntimeException When process is already running
|
||||
* @throws LogicException In case a callback is provided and output has been disabled
|
||||
*/
|
||||
public function start(callable $callback = null, array $env = [])
|
||||
public function start(?callable $callback = null, array $env = [])
|
||||
{
|
||||
if ($this->isRunning()) {
|
||||
throw new RuntimeException('Process is already running.');
|
||||
@ -385,7 +386,7 @@ class Process implements \IteratorAggregate
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
public function restart(callable $callback = null, array $env = []): self
|
||||
public function restart(?callable $callback = null, array $env = []): self
|
||||
{
|
||||
if ($this->isRunning()) {
|
||||
throw new RuntimeException('Process is already running.');
|
||||
@ -412,7 +413,7 @@ class Process implements \IteratorAggregate
|
||||
* @throws ProcessSignaledException When process stopped after receiving signal
|
||||
* @throws LogicException When process is not yet started
|
||||
*/
|
||||
public function wait(callable $callback = null)
|
||||
public function wait(?callable $callback = null)
|
||||
{
|
||||
$this->requireProcessIsStarted(__FUNCTION__);
|
||||
|
||||
@ -914,7 +915,7 @@ class Process implements \IteratorAggregate
|
||||
*
|
||||
* @return int|null The exit-code of the process or null if it's not running
|
||||
*/
|
||||
public function stop(float $timeout = 10, int $signal = null)
|
||||
public function stop(float $timeout = 10, ?int $signal = null)
|
||||
{
|
||||
$timeoutMicro = microtime(true) + $timeout;
|
||||
if ($this->isRunning()) {
|
||||
@ -1310,7 +1311,7 @@ class Process implements \IteratorAggregate
|
||||
*
|
||||
* @return \Closure
|
||||
*/
|
||||
protected function buildCallback(callable $callback = null)
|
||||
protected function buildCallback(?callable $callback = null)
|
||||
{
|
||||
if ($this->outputDisabled) {
|
||||
return function ($type, $data) use ($callback): bool {
|
||||
@ -1345,6 +1346,19 @@ class Process implements \IteratorAggregate
|
||||
$this->processInformation = proc_get_status($this->process);
|
||||
$running = $this->processInformation['running'];
|
||||
|
||||
// In PHP < 8.3, "proc_get_status" only returns the correct exit status on the first call.
|
||||
// Subsequent calls return -1 as the process is discarded. This workaround caches the first
|
||||
// retrieved exit status for consistent results in later calls, mimicking PHP 8.3 behavior.
|
||||
if (\PHP_VERSION_ID < 80300) {
|
||||
if (!isset($this->cachedExitCode) && !$running && -1 !== $this->processInformation['exitcode']) {
|
||||
$this->cachedExitCode = $this->processInformation['exitcode'];
|
||||
}
|
||||
|
||||
if (isset($this->cachedExitCode) && !$running && -1 === $this->processInformation['exitcode']) {
|
||||
$this->processInformation['exitcode'] = $this->cachedExitCode;
|
||||
}
|
||||
}
|
||||
|
||||
$this->readPipes($running && $blocking, '\\' !== \DIRECTORY_SEPARATOR || !$running);
|
||||
|
||||
if ($this->fallbackStatus && $this->isSigchildEnabled()) {
|
||||
|
Reference in New Issue
Block a user