Plugin Directory

Changeset 3225789


Ignore:
Timestamp:
01/20/2025 07:06:37 PM (13 months ago)
Author:
mosparo
Message:

Fixed another issue with the conditionally hidden fields in Gravity Forms and fixed an issue with the WPForms initialization.

Location:
mosparo-integration
Files:
81 edited
17 copied

Legend:

Unmodified
Added
Removed
  • mosparo-integration/tags/1.12.2/mosparo-integration.php

    r3224805 r3225789  
    1515 * Author URI:        https://mosparo.io/
    1616 * License:           MIT
    17  * Version:           1.12.1
     17 * Version:           1.12.2
    1818 * Text Domain:       mosparo-integration
    1919 * Domain Path:       /languages
  • mosparo-integration/tags/1.12.2/readme.txt

    r3224805 r3225789  
    55Tested up to: 6.7.1
    66Requires PHP: 7.4
    7 Stable tag: 1.12.1
     7Stable tag: 1.12.2
    88License: MIT
    99
     
    104104== Changelog ==
    105105
     106= 1.12.2 =
     107*Release Date: 20th January 2025*
     108
     109* [Bugfix] Gravity Forms: Fixed another issue with the handling of conditionally hidden fields.
     110* [Bugfix] WPForms: Fixed the initialization of the module in some cases where WPForms is not fully loaded.
     111
    106112= 1.12.1 =
    107113*Release Date: 18th January 2025*
    108114
    109115* [Bugfix] Gravity Forms: Fixed the selector and logic to handle conditionally hidden fields correctly.
     116* [Maintenance] Updated the backend dependencies
    110117
    111118= 1.12.0 =
  • mosparo-integration/tags/1.12.2/src/MosparoIntegration/Module/GravityForms/MosparoField.php

    r3224805 r3225789  
    143143
    144144        foreach ($form['fields'] as $field) {
    145             if (in_array($field['type'], $ignoredTypes) || strpos($field['cssClass'] ?? '', 'mosparo__ignored-field') !== false) {
     145            if (
     146                in_array($field['type'], $ignoredTypes) ||
     147                strpos($field['cssClass'] ?? '', 'mosparo__ignored-field') !== false ||
     148                GFFormsModel::is_field_hidden($form, $field, [])
     149            ) {
    146150                continue;
    147151            }
  • mosparo-integration/tags/1.12.2/src/MosparoIntegration/Module/WPForms/WPFormsModule.php

    r3113145 r3225789  
    2020    public function canInitialize()
    2121    {
    22         return defined('WPFORMS_VERSION');
     22        return defined('WPFORMS_VERSION') && class_exists('WPForms_Field');
    2323    }
    2424
  • mosparo-integration/tags/1.12.2/vendor-prefixed/guzzlehttp/guzzle/src/BodySummarizer.php

    r3042153 r3225789  
    1818    private $truncateAt;
    1919
    20     public function __construct(int $truncateAt = null)
     20    public function __construct(?int $truncateAt = null)
    2121    {
    2222        $this->truncateAt = $truncateAt;
     
    2929    {
    3030        return $this->truncateAt === null
    31             ? \MosparoDependencies\GuzzleHttp\Psr7\Message::bodySummary($message)
    32             : \MosparoDependencies\GuzzleHttp\Psr7\Message::bodySummary($message, $this->truncateAt);
     31            ? Psr7\Message::bodySummary($message)
     32            : Psr7\Message::bodySummary($message, $this->truncateAt);
    3333    }
    3434}
  • mosparo-integration/tags/1.12.2/vendor-prefixed/guzzlehttp/guzzle/src/Client.php

    r3042153 r3225789  
    5959     * @param array $config Client configuration settings.
    6060     *
    61      * @see \MosparoDependencies\GuzzleHttp\RequestOptions for a list of available request options.
     61     * @see RequestOptions for a list of available request options.
    6262     */
    6363    public function __construct(array $config = [])
     
    209209     * @deprecated Client::getConfig will be removed in guzzlehttp/guzzle:8.0.
    210210     */
    211     public function getConfig(string $option = null)
     211    public function getConfig(?string $option = null)
    212212    {
    213213        return $option === null
  • mosparo-integration/tags/1.12.2/vendor-prefixed/guzzlehttp/guzzle/src/ClientInterface.php

    r3042153 r3225789  
    8787     * @deprecated ClientInterface::getConfig will be removed in guzzlehttp/guzzle:8.0.
    8888     */
    89     public function getConfig(string $option = null);
     89    public function getConfig(?string $option = null);
    9090}
  • mosparo-integration/tags/1.12.2/vendor-prefixed/guzzlehttp/guzzle/src/Cookie/CookieJar.php

    r3042153 r3225789  
    110110    }
    111111
    112     public function clear(string $domain = null, string $path = null, string $name = null): void
     112    public function clear(?string $domain = null, ?string $path = null, ?string $name = null): void
    113113    {
    114114        if (!$domain) {
  • mosparo-integration/tags/1.12.2/vendor-prefixed/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php

    r3042153 r3225789  
    6969     * @param string|null $name   Clears cookies matching a domain, path, and name
    7070     */
    71     public function clear(string $domain = null, string $path = null, string $name = null): void;
     71    public function clear(?string $domain = null, ?string $path = null, ?string $name = null): void;
    7272
    7373    /**
  • mosparo-integration/tags/1.12.2/vendor-prefixed/guzzlehttp/guzzle/src/Exception/BadResponseException.php

    r3042153 r3225789  
    2121        RequestInterface $request,
    2222        ResponseInterface $response,
    23         \Throwable $previous = null,
     23        ?\Throwable $previous = null,
    2424        array $handlerContext = []
    2525    ) {
  • mosparo-integration/tags/1.12.2/vendor-prefixed/guzzlehttp/guzzle/src/Exception/ConnectException.php

    r3042153 r3225789  
    3232        string $message,
    3333        RequestInterface $request,
    34         \Throwable $previous = null,
     34        ?\Throwable $previous = null,
    3535        array $handlerContext = []
    3636    ) {
  • mosparo-integration/tags/1.12.2/vendor-prefixed/guzzlehttp/guzzle/src/Exception/RequestException.php

    r3042153 r3225789  
    1414use MosparoDependencies\Psr\Http\Message\RequestInterface;
    1515use MosparoDependencies\Psr\Http\Message\ResponseInterface;
    16 use MosparoDependencies\Psr\Http\Message\UriInterface;
    1716
    1817/**
     
    3938        string $message,
    4039        RequestInterface $request,
    41         ResponseInterface $response = null,
    42         \Throwable $previous = null,
     40        ?ResponseInterface $response = null,
     41        ?\Throwable $previous = null,
    4342        array $handlerContext = []
    4443    ) {
     
    7069    public static function create(
    7170        RequestInterface $request,
    72         ResponseInterface $response = null,
    73         \Throwable $previous = null,
     71        ?ResponseInterface $response = null,
     72        ?\Throwable $previous = null,
    7473        array $handlerContext = [],
    75         BodySummarizerInterface $bodySummarizer = null
     74        ?BodySummarizerInterface $bodySummarizer = null
    7675    ): self {
    7776        if (!$response) {
     
    9796        }
    9897
    99         $uri = $request->getUri();
    100         $uri = static::obfuscateUri($uri);
     98        $uri = \MosparoDependencies\GuzzleHttp\Psr7\Utils::redactUserInfo($request->getUri());
    10199
    102100        // Client Error: `GET /` resulted in a `404 Not Found` response:
     
    118116
    119117        return new $className($message, $request, $response, $previous, $handlerContext);
    120     }
    121 
    122     /**
    123      * Obfuscates URI if there is a username and a password present
    124      */
    125     private static function obfuscateUri(UriInterface $uri): UriInterface
    126     {
    127         $userInfo = $uri->getUserInfo();
    128 
    129         if (false !== ($pos = \strpos($userInfo, ':'))) {
    130             return $uri->withUserInfo(\substr($userInfo, 0, $pos), '***');
    131         }
    132 
    133         return $uri;
    134118    }
    135119
  • mosparo-integration/tags/1.12.2/vendor-prefixed/guzzlehttp/guzzle/src/Handler/CurlFactory.php

    r3042153 r3225789  
    1818use MosparoDependencies\GuzzleHttp\Utils;
    1919use MosparoDependencies\Psr\Http\Message\RequestInterface;
     20use MosparoDependencies\Psr\Http\Message\UriInterface;
    2021
    2122/**
     
    5354    public function create(RequestInterface $request, array $options): EasyHandle
    5455    {
     56        $protocolVersion = $request->getProtocolVersion();
     57
     58        if ('2' === $protocolVersion || '2.0' === $protocolVersion) {
     59            if (!self::supportsHttp2()) {
     60                throw new ConnectException('HTTP/2 is supported by the cURL handler, however libcurl is built without HTTP/2 support.', $request);
     61            }
     62        } elseif ('1.0' !== $protocolVersion && '1.1' !== $protocolVersion) {
     63            throw new ConnectException(sprintf('HTTP/%s is not supported by the cURL handler.', $protocolVersion), $request);
     64        }
     65
    5566        if (isset($options['curl']['body_as_string'])) {
    5667            $options['_body_as_string'] = $options['curl']['body_as_string'];
     
    7788
    7889        return $easy;
     90    }
     91
     92    private static function supportsHttp2(): bool
     93    {
     94        static $supportsHttp2 = null;
     95
     96        if (null === $supportsHttp2) {
     97            $supportsHttp2 = self::supportsTls12()
     98                && defined('CURL_VERSION_HTTP2')
     99                && (\CURL_VERSION_HTTP2 & \curl_version()['features']);
     100        }
     101
     102        return $supportsHttp2;
     103    }
     104
     105    private static function supportsTls12(): bool
     106    {
     107        static $supportsTls12 = null;
     108
     109        if (null === $supportsTls12) {
     110            $supportsTls12 = \CURL_SSLVERSION_TLSv1_2 & \curl_version()['features'];
     111        }
     112
     113        return $supportsTls12;
     114    }
     115
     116    private static function supportsTls13(): bool
     117    {
     118        static $supportsTls13 = null;
     119
     120        if (null === $supportsTls13) {
     121            $supportsTls13 = defined('CURL_SSLVERSION_TLSv1_3')
     122                && (\CURL_SSLVERSION_TLSv1_3 & \curl_version()['features']);
     123        }
     124
     125        return $supportsTls13;
    79126    }
    80127
     
    154201            'appconnect_time' => \curl_getinfo($easy->handle, \CURLINFO_APPCONNECT_TIME),
    155202        ] + \curl_getinfo($easy->handle);
    156         $ctx[self::CURL_VERSION_STR] = \curl_version()['version'];
     203        $ctx[self::CURL_VERSION_STR] = self::getCurlVersion();
    157204        $factory->release($easy);
    158205
     
    163210
    164211        return self::createRejection($easy, $ctx);
     212    }
     213
     214    private static function getCurlVersion(): string
     215    {
     216        static $curlVersion = null;
     217
     218        if (null === $curlVersion) {
     219            $curlVersion = \curl_version()['version'];
     220        }
     221
     222        return $curlVersion;
    165223    }
    166224
     
    201259        }
    202260
     261        $uri = $easy->request->getUri();
     262
     263        $sanitizedError = self::sanitizeCurlError($ctx['error'] ?? '', $uri);
     264
    203265        $message = \sprintf(
    204266            'cURL error %s: %s (%s)',
    205267            $ctx['errno'],
    206             $ctx['error'],
     268            $sanitizedError,
    207269            'see https://curl.haxx.se/libcurl/c/libcurl-errors.html'
    208270        );
    209         $uriString = (string) $easy->request->getUri();
    210         if ($uriString !== '' && false === \strpos($ctx['error'], $uriString)) {
    211             $message .= \sprintf(' for %s', $uriString);
     271
     272        if ('' !== $sanitizedError) {
     273            $redactedUriString = \MosparoDependencies\GuzzleHttp\Psr7\Utils::redactUserInfo($uri)->__toString();
     274            if ($redactedUriString !== '' && false === \strpos($sanitizedError, $redactedUriString)) {
     275                $message .= \sprintf(' for %s', $redactedUriString);
     276            }
    212277        }
    213278
     
    218283
    219284        return P\Create::rejectionFor($error);
     285    }
     286
     287    private static function sanitizeCurlError(string $error, UriInterface $uri): string
     288    {
     289        if ('' === $error) {
     290            return $error;
     291        }
     292
     293        $baseUri = $uri->withQuery('')->withFragment('');
     294        $baseUriString = $baseUri->__toString();
     295
     296        if ('' === $baseUriString) {
     297            return $error;
     298        }
     299
     300        $redactedUriString = \MosparoDependencies\GuzzleHttp\Psr7\Utils::redactUserInfo($baseUri)->__toString();
     301
     302        return str_replace($baseUriString, $redactedUriString, $error);
    220303    }
    221304
     
    239322
    240323        $version = $easy->request->getProtocolVersion();
    241         if ($version == 1.1) {
     324
     325        if ('2' === $version || '2.0' === $version) {
     326            $conf[\CURLOPT_HTTP_VERSION] = \CURL_HTTP_VERSION_2_0;
     327        } elseif ('1.1' === $version) {
    242328            $conf[\CURLOPT_HTTP_VERSION] = \CURL_HTTP_VERSION_1_1;
    243         } elseif ($version == 2.0) {
    244             $conf[\CURLOPT_HTTP_VERSION] = \CURL_HTTP_VERSION_2_0;
    245329        } else {
    246330            $conf[\CURLOPT_HTTP_VERSION] = \CURL_HTTP_VERSION_1_0;
     
    397481                // sets a matching 'Accept-Encoding' header.
    398482                $conf[\CURLOPT_ENCODING] = '';
    399                 // But as the user did not specify any acceptable encodings we need
    400                 // to overwrite this implicit header with an empty one.
     483                // But as the user did not specify any encoding preference,
     484                // let's leave it up to server by preventing curl from sending
     485                // the header, which will be interpreted as 'Accept-Encoding: *'.
     486                // https://www.rfc-editor.org/rfc/rfc9110#field.accept-encoding
    401487                $conf[\CURLOPT_HTTPHEADER][] = 'Accept-Encoding:';
    402488            }
     
    462548
    463549        if (isset($options['crypto_method'])) {
    464             if (\STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT === $options['crypto_method']) {
    465                 if (!defined('CURL_SSLVERSION_TLSv1_0')) {
    466                     throw new \InvalidArgumentException('Invalid crypto_method request option: TLS 1.0 not supported by your version of cURL');
    467                 }
     550            $protocolVersion = $easy->request->getProtocolVersion();
     551
     552            // If HTTP/2, upgrade TLS 1.0 and 1.1 to 1.2
     553            if ('2' === $protocolVersion || '2.0' === $protocolVersion) {
     554                if (
     555                    \STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT === $options['crypto_method']
     556                    || \STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT === $options['crypto_method']
     557                    || \STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT === $options['crypto_method']
     558                ) {
     559                    $conf[\CURLOPT_SSLVERSION] = \CURL_SSLVERSION_TLSv1_2;
     560                } elseif (defined('STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT') && \STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT === $options['crypto_method']) {
     561                    if (!self::supportsTls13()) {
     562                        throw new \InvalidArgumentException('Invalid crypto_method request option: TLS 1.3 not supported by your version of cURL');
     563                    }
     564                    $conf[\CURLOPT_SSLVERSION] = \CURL_SSLVERSION_TLSv1_3;
     565                } else {
     566                    throw new \InvalidArgumentException('Invalid crypto_method request option: unknown version provided');
     567                }
     568            } elseif (\STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT === $options['crypto_method']) {
    468569                $conf[\CURLOPT_SSLVERSION] = \CURL_SSLVERSION_TLSv1_0;
    469570            } elseif (\STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT === $options['crypto_method']) {
    470                 if (!defined('CURL_SSLVERSION_TLSv1_1')) {
    471                     throw new \InvalidArgumentException('Invalid crypto_method request option: TLS 1.1 not supported by your version of cURL');
    472                 }
    473571                $conf[\CURLOPT_SSLVERSION] = \CURL_SSLVERSION_TLSv1_1;
    474572            } elseif (\STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT === $options['crypto_method']) {
    475                 if (!defined('CURL_SSLVERSION_TLSv1_2')) {
     573                if (!self::supportsTls12()) {
    476574                    throw new \InvalidArgumentException('Invalid crypto_method request option: TLS 1.2 not supported by your version of cURL');
    477575                }
    478576                $conf[\CURLOPT_SSLVERSION] = \CURL_SSLVERSION_TLSv1_2;
    479577            } elseif (defined('STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT') && \STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT === $options['crypto_method']) {
    480                 if (!defined('CURL_SSLVERSION_TLSv1_3')) {
     578                if (!self::supportsTls13()) {
    481579                    throw new \InvalidArgumentException('Invalid crypto_method request option: TLS 1.3 not supported by your version of cURL');
    482580                }
  • mosparo-integration/tags/1.12.2/vendor-prefixed/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php

    r3042153 r3225789  
    99namespace MosparoDependencies\GuzzleHttp\Handler;
    1010
     11use Closure;
    1112use MosparoDependencies\GuzzleHttp\Promise as P;
    1213use MosparoDependencies\GuzzleHttp\Promise\Promise;
     
    166167        }
    167168
     169        // Run curl_multi_exec in the queue to enable other async tasks to run
     170        P\Utils::queue()->add(Closure::fromCallable([$this, 'tickInQueue']));
     171
    168172        // Step through the task queue which may add additional requests.
    169173        P\Utils::queue()->run();
     
    176180
    177181        while (\curl_multi_exec($this->_mh, $this->active) === \CURLM_CALL_MULTI_PERFORM) {
     182            // Prevent busy looping for slow HTTP requests.
     183            \curl_multi_select($this->_mh, $this->selectTimeout);
    178184        }
    179185
    180186        $this->processMessages();
     187    }
     188
     189    /**
     190     * Runs \curl_multi_exec() inside the event loop, to prevent busy looping
     191     */
     192    private function tickInQueue(): void
     193    {
     194        if (\curl_multi_exec($this->_mh, $this->active) === \CURLM_CALL_MULTI_PERFORM) {
     195            \curl_multi_select($this->_mh, 0);
     196            P\Utils::queue()->add(Closure::fromCallable([$this, 'tickInQueue']));
     197        }
    181198    }
    182199
  • mosparo-integration/tags/1.12.2/vendor-prefixed/guzzlehttp/guzzle/src/Handler/MockHandler.php

    r3042153 r3225789  
    5959     * @param callable|null $onRejected  Callback to invoke when the return value is rejected.
    6060     */
    61     public static function createWithMiddleware(array $queue = null, callable $onFulfilled = null, callable $onRejected = null): HandlerStack
     61    public static function createWithMiddleware(?array $queue = null, ?callable $onFulfilled = null, ?callable $onRejected = null): HandlerStack
    6262    {
    6363        return HandlerStack::create(new self($queue, $onFulfilled, $onRejected));
     
    6666    /**
    6767     * The passed in value must be an array of
    68      * {@see \Psr\Http\Message\ResponseInterface} objects, Exceptions,
     68     * {@see ResponseInterface} objects, Exceptions,
    6969     * callables, or Promises.
    7070     *
     
    7373     * @param callable|null          $onRejected  Callback to invoke when the return value is rejected.
    7474     */
    75     public function __construct(array $queue = null, callable $onFulfilled = null, callable $onRejected = null)
     75    public function __construct(?array $queue = null, ?callable $onFulfilled = null, ?callable $onRejected = null)
    7676    {
    7777        $this->onFulfilled = $onFulfilled;
     
    207207        RequestInterface $request,
    208208        array $options,
    209         ResponseInterface $response = null,
     209        ?ResponseInterface $response = null,
    210210        $reason = null
    211211    ): void {
  • mosparo-integration/tags/1.12.2/vendor-prefixed/guzzlehttp/guzzle/src/Handler/StreamHandler.php

    r3042153 r3225789  
    4545        if (isset($options['delay'])) {
    4646            \usleep($options['delay'] * 1000);
     47        }
     48
     49        $protocolVersion = $request->getProtocolVersion();
     50
     51        if ('1.0' !== $protocolVersion && '1.1' !== $protocolVersion) {
     52            throw new ConnectException(sprintf('HTTP/%s is not supported by the stream handler.', $protocolVersion), $request);
    4753        }
    4854
     
    9096        RequestInterface $request,
    9197        ?float $startTime,
    92         ResponseInterface $response = null,
    93         \Throwable $error = null
     98        ?ResponseInterface $response = null,
     99        ?\Throwable $error = null
    94100    ): void {
    95101        if (isset($options['on_stats'])) {
     
    280286        // HTTP/1.1 streams using the PHP stream wrapper require a
    281287        // Connection: close header
    282         if ($request->getProtocolVersion() == '1.1'
     288        if ($request->getProtocolVersion() === '1.1'
    283289            && !$request->hasHeader('Connection')
    284290        ) {
  • mosparo-integration/tags/1.12.2/vendor-prefixed/guzzlehttp/guzzle/src/HandlerStack.php

    r3042153 r3225789  
    5151     *                                                                            system will be utilized.
    5252     */
    53     public static function create(callable $handler = null): self
     53    public static function create(?callable $handler = null): self
    5454    {
    5555        $stack = new self($handler ?: Utils::chooseHandler());
     
    6565     * @param (callable(RequestInterface, array): PromiseInterface)|null $handler Underlying HTTP handler.
    6666     */
    67     public function __construct(callable $handler = null)
     67    public function __construct(?callable $handler = null)
    6868    {
    6969        $this->handler = $handler;
     
    138138     * @param string                       $name       Name to register for this middleware.
    139139     */
    140     public function unshift(callable $middleware, string $name = null): void
     140    public function unshift(callable $middleware, ?string $name = null): void
    141141    {
    142142        \array_unshift($this->stack, [$middleware, $name]);
  • mosparo-integration/tags/1.12.2/vendor-prefixed/guzzlehttp/guzzle/src/MessageFormatter.php

    r3042153 r3225789  
    7575     * @param \Throwable|null        $error    Exception that was received
    7676     */
    77     public function format(RequestInterface $request, ResponseInterface $response = null, \Throwable $error = null): string
     77    public function format(RequestInterface $request, ?ResponseInterface $response = null, ?\Throwable $error = null): string
    7878    {
    7979        $cache = [];
  • mosparo-integration/tags/1.12.2/vendor-prefixed/guzzlehttp/guzzle/src/MessageFormatterInterface.php

    r3042153 r3225789  
    2121     * @param \Throwable|null        $error    Exception that was received
    2222     */
    23     public function format(RequestInterface $request, ResponseInterface $response = null, \Throwable $error = null): string;
     23    public function format(RequestInterface $request, ?ResponseInterface $response = null, ?\Throwable $error = null): string;
    2424}
  • mosparo-integration/tags/1.12.2/vendor-prefixed/guzzlehttp/guzzle/src/Middleware.php

    r3042153 r3225789  
    6262     * @return callable(callable): callable Returns a function that accepts the next handler.
    6363     */
    64     public static function httpErrors(BodySummarizerInterface $bodySummarizer = null): callable
     64    public static function httpErrors(?BodySummarizerInterface $bodySummarizer = null): callable
    6565    {
    6666        return static function (callable $handler) use ($bodySummarizer): callable {
     
    139139     * @return callable Returns a function that accepts the next handler.
    140140     */
    141     public static function tap(callable $before = null, callable $after = null): callable
     141    public static function tap(?callable $before = null, ?callable $after = null): callable
    142142    {
    143143        return static function (callable $handler) use ($before, $after): callable {
     
    183183     * @return callable Returns a function that accepts the next handler.
    184184     */
    185     public static function retry(callable $decider, callable $delay = null): callable
     185    public static function retry(callable $decider, ?callable $delay = null): callable
    186186    {
    187187        return static function (callable $handler) use ($decider, $delay): RetryMiddleware {
  • mosparo-integration/tags/1.12.2/vendor-prefixed/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php

    r3042153 r3225789  
    8383        $expect = $options['expect'] ?? null;
    8484
    85         // Return if disabled or if you're not using HTTP/1.1 or HTTP/2.0
    86         if ($expect === false || $request->getProtocolVersion() < 1.1) {
     85        // Return if disabled or using HTTP/1.0
     86        if ($expect === false || $request->getProtocolVersion() === '1.0') {
    8787            return;
    8888        }
  • mosparo-integration/tags/1.12.2/vendor-prefixed/guzzlehttp/guzzle/src/RequestOptions.php

    r3042153 r3225789  
    6868     * jar to use or what cookies to send. This option only works if your
    6969     * handler has the `cookie` middleware. Valid values are `false` and
    70      * an instance of {@see \GuzzleHttp\Cookie\CookieJarInterface}.
     70     * an instance of {@see Cookie\CookieJarInterface}.
    7171     */
    7272    public const COOKIES = 'cookies';
  • mosparo-integration/tags/1.12.2/vendor-prefixed/guzzlehttp/guzzle/src/RetryMiddleware.php

    r3042153 r3225789  
    4747     *                                                                         milliseconds to delay.
    4848     */
    49     public function __construct(callable $decider, callable $nextHandler, callable $delay = null)
     49    public function __construct(callable $decider, callable $nextHandler, ?callable $delay = null)
    5050    {
    5151        $this->decider = $decider;
     
    117117    }
    118118
    119     private function doRetry(RequestInterface $request, array $options, ResponseInterface $response = null): PromiseInterface
     119    private function doRetry(RequestInterface $request, array $options, ?ResponseInterface $response = null): PromiseInterface
    120120    {
    121121        $options['delay'] = ($this->delay)(++$options['retries'], $response, $request);
  • mosparo-integration/tags/1.12.2/vendor-prefixed/guzzlehttp/guzzle/src/TransferStats.php

    r3042153 r3225789  
    5353    public function __construct(
    5454        RequestInterface $request,
    55         ResponseInterface $response = null,
    56         float $transferTime = null,
     55        ?ResponseInterface $response = null,
     56        ?float $transferTime = null,
    5757        $handlerErrorData = null,
    5858        array $handlerStats = []
  • mosparo-integration/tags/1.12.2/vendor-prefixed/guzzlehttp/guzzle/src/Utils.php

    r3042153 r3225789  
    7878        }
    7979
    80         return \MosparoDependencies\GuzzleHttp\Psr7\Utils::tryFopen('php://output', 'w');
     80        return Psr7\Utils::tryFopen('php://output', 'w');
    8181    }
    8282
     
    9494        $handler = null;
    9595
    96         if (\defined('CURLOPT_CUSTOMREQUEST')) {
     96        if (\defined('CURLOPT_CUSTOMREQUEST') && \function_exists('curl_version') && version_compare(curl_version()['version'], '7.21.2') >= 0) {
    9797            if (\function_exists('curl_multi_exec') && \function_exists('curl_exec')) {
    9898                $handler = Proxy::wrapSync(new CurlMultiHandler(), new CurlHandler());
  • mosparo-integration/tags/1.12.2/vendor-prefixed/guzzlehttp/promises/src/Coroutine.php

    r3042153 r3225789  
    9191
    9292    public function then(
    93         callable $onFulfilled = null,
    94         callable $onRejected = null
     93        ?callable $onFulfilled = null,
     94        ?callable $onRejected = null
    9595    ): PromiseInterface {
    9696        return $this->result->then($onFulfilled, $onRejected);
  • mosparo-integration/tags/1.12.2/vendor-prefixed/guzzlehttp/promises/src/Each.php

    r3042153 r3225789  
    3030    public static function of(
    3131        $iterable,
    32         callable $onFulfilled = null,
    33         callable $onRejected = null
     32        ?callable $onFulfilled = null,
     33        ?callable $onRejected = null
    3434    ): PromiseInterface {
    3535        return (new EachPromise($iterable, [
     
    5353        $iterable,
    5454        $concurrency,
    55         callable $onFulfilled = null,
    56         callable $onRejected = null
     55        ?callable $onFulfilled = null,
     56        ?callable $onRejected = null
    5757    ): PromiseInterface {
    5858        return (new EachPromise($iterable, [
     
    7474        $iterable,
    7575        $concurrency,
    76         callable $onFulfilled = null
     76        ?callable $onFulfilled = null
    7777    ): PromiseInterface {
    7878        return self::ofLimit(
  • mosparo-integration/tags/1.12.2/vendor-prefixed/guzzlehttp/promises/src/FulfilledPromise.php

    r3042153 r3225789  
    3838
    3939    public function then(
    40         callable $onFulfilled = null,
    41         callable $onRejected = null
     40        ?callable $onFulfilled = null,
     41        ?callable $onRejected = null
    4242    ): PromiseInterface {
    4343        // Return itself if there is no onFulfilled function.
  • mosparo-integration/tags/1.12.2/vendor-prefixed/guzzlehttp/promises/src/Promise.php

    r3042153 r3225789  
    3232     */
    3333    public function __construct(
    34         callable $waitFn = null,
    35         callable $cancelFn = null
     34        ?callable $waitFn = null,
     35        ?callable $cancelFn = null
    3636    ) {
    3737        $this->waitFn = $waitFn;
     
    4040
    4141    public function then(
    42         callable $onFulfilled = null,
    43         callable $onRejected = null
     42        ?callable $onFulfilled = null,
     43        ?callable $onRejected = null
    4444    ): PromiseInterface {
    4545        if ($this->state === self::PENDING) {
  • mosparo-integration/tags/1.12.2/vendor-prefixed/guzzlehttp/promises/src/PromiseInterface.php

    r3042153 r3225789  
    3434     */
    3535    public function then(
    36         callable $onFulfilled = null,
    37         callable $onRejected = null
     36        ?callable $onFulfilled = null,
     37        ?callable $onRejected = null
    3838    ): PromiseInterface;
    3939
  • mosparo-integration/tags/1.12.2/vendor-prefixed/guzzlehttp/promises/src/RejectedPromise.php

    r3042153 r3225789  
    3838
    3939    public function then(
    40         callable $onFulfilled = null,
    41         callable $onRejected = null
     40        ?callable $onFulfilled = null,
     41        ?callable $onRejected = null
    4242    ): PromiseInterface {
    4343        // If there's no onRejected callback then just return self.
  • mosparo-integration/tags/1.12.2/vendor-prefixed/guzzlehttp/promises/src/RejectionException.php

    r3042153 r3225789  
    2525     * @param string|null $description Optional description.
    2626     */
    27     public function __construct($reason, string $description = null)
     27    public function __construct($reason, ?string $description = null)
    2828    {
    2929        $this->reason = $reason;
  • mosparo-integration/tags/1.12.2/vendor-prefixed/guzzlehttp/promises/src/Utils.php

    r3042153 r3225789  
    2828     * @param TaskQueueInterface|null $assign Optionally specify a new queue instance.
    2929     */
    30     public static function queue(TaskQueueInterface $assign = null): TaskQueueInterface
     30    public static function queue(?TaskQueueInterface $assign = null): TaskQueueInterface
    3131    {
    3232        static $queue;
     
    151151            },
    152152            function ($reason, $idx, Promise $aggregate): void {
    153                 $aggregate->reject($reason);
     153                if (Is::pending($aggregate)) {
     154                    $aggregate->reject($reason);
     155                }
    154156            }
    155157        )->then(function () use (&$results) {
  • mosparo-integration/tags/1.12.2/vendor-prefixed/guzzlehttp/psr7/src/CachingStream.php

    r3042153 r3225789  
    4040    public function __construct(
    4141        StreamInterface $stream,
    42         StreamInterface $target = null
     42        ?StreamInterface $target = null
    4343    ) {
    4444        $this->remoteStream = $stream;
  • mosparo-integration/tags/1.12.2/vendor-prefixed/guzzlehttp/psr7/src/HttpFactory.php

    r3042153 r3225789  
    3434    public function createUploadedFile(
    3535        StreamInterface $stream,
    36         int $size = null,
     36        ?int $size = null,
    3737        int $error = \UPLOAD_ERR_OK,
    38         string $clientFilename = null,
    39         string $clientMediaType = null
     38        ?string $clientFilename = null,
     39        ?string $clientMediaType = null
    4040    ): UploadedFileInterface {
    4141        if ($size === null) {
  • mosparo-integration/tags/1.12.2/vendor-prefixed/guzzlehttp/psr7/src/MultipartStream.php

    r3042153 r3225789  
    3939     * @throws \InvalidArgumentException
    4040     */
    41     public function __construct(array $elements = [], string $boundary = null)
     41    public function __construct(array $elements = [], ?string $boundary = null)
    4242    {
    4343        $this->boundary = $boundary ?: bin2hex(random_bytes(20));
  • mosparo-integration/tags/1.12.2/vendor-prefixed/guzzlehttp/psr7/src/Query.php

    r3042153 r3225789  
    7070     * encountered (like `http_build_query()` would).
    7171     *
    72      * @param array     $params   Query string parameters.
    73      * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986
    74      *                            to encode using RFC3986, or PHP_QUERY_RFC1738
    75      *                            to encode using RFC1738.
     72     * @param array     $params           Query string parameters.
     73     * @param int|false $encoding         Set to false to not encode,
     74     *                                    PHP_QUERY_RFC3986 to encode using
     75     *                                    RFC3986, or PHP_QUERY_RFC1738 to
     76     *                                    encode using RFC1738.
     77     * @param bool      $treatBoolsAsInts Set to true to encode as 0/1, and
     78     *                                    false as false/true.
    7679     */
    77     public static function build(array $params, $encoding = PHP_QUERY_RFC3986): string
     80    public static function build(array $params, $encoding = PHP_QUERY_RFC3986, bool $treatBoolsAsInts = true): string
    7881    {
    7982        if (!$params) {
     
    9396        }
    9497
     98        $castBool = $treatBoolsAsInts ? static function ($v) { return (int) $v; } : static function ($v) { return $v ? 'true' : 'false'; };
     99
    95100        $qs = '';
    96101        foreach ($params as $k => $v) {
     
    98103            if (!is_array($v)) {
    99104                $qs .= $k;
    100                 $v = is_bool($v) ? (int) $v : $v;
     105                $v = is_bool($v) ? $castBool($v) : $v;
    101106                if ($v !== null) {
    102107                    $qs .= '='.$encoder((string) $v);
     
    106111                foreach ($v as $vv) {
    107112                    $qs .= $k;
    108                     $vv = is_bool($vv) ? (int) $vv : $vv;
     113                    $vv = is_bool($vv) ? $castBool($vv) : $vv;
    109114                    if ($vv !== null) {
    110115                        $qs .= '='.$encoder((string) $vv);
  • mosparo-integration/tags/1.12.2/vendor-prefixed/guzzlehttp/psr7/src/Response.php

    r3042153 r3225789  
    103103        $body = null,
    104104        string $version = '1.1',
    105         string $reason = null
     105        ?string $reason = null
    106106    ) {
    107107        $this->assertStatusCodeRange($status);
  • mosparo-integration/tags/1.12.2/vendor-prefixed/guzzlehttp/psr7/src/StreamWrapper.php

    r3042153 r3225789  
    7676    }
    7777
    78     public function stream_open(string $path, string $mode, int $options, string &$opened_path = null): bool
     78    public function stream_open(string $path, string $mode, int $options, ?string &$opened_path = null): bool
    7979    {
    8080        $options = stream_context_get_options($this->context);
     
    126126
    127127        return $resource ?? false;
     128    }
     129
     130    /**
     131     * @return array{
     132     *   dev: int,
     133     *   ino: int,
     134     *   mode: int,
     135     *   nlink: int,
     136     *   uid: int,
     137     *   gid: int,
     138     *   rdev: int,
     139     *   size: int,
     140     *   atime: int,
     141     *   mtime: int,
     142     *   ctime: int,
     143     *   blksize: int,
     144     *   blocks: int
     145     * }|false
     146     */
     147    public function stream_stat()
     148    {
     149        if ($this->stream->getSize() === null) {
     150            return false;
     151        }
     152
     153        static $modeMap = [
     154            'r' => 33060,
     155            'rb' => 33060,
     156            'r+' => 33206,
     157            'w' => 33188,
     158            'wb' => 33188,
     159        ];
     160
     161        return [
     162            'dev' => 0,
     163            'ino' => 0,
     164            'mode' => $modeMap[$this->mode],
     165            'nlink' => 0,
     166            'uid' => 0,
     167            'gid' => 0,
     168            'rdev' => 0,
     169            'size' => $this->stream->getSize() ?: 0,
     170            'atime' => 0,
     171            'mtime' => 0,
     172            'ctime' => 0,
     173            'blksize' => 0,
     174            'blocks' => 0,
     175        ];
    128176    }
    129177
     
    145193     * }
    146194     */
    147     public function stream_stat(): array
    148     {
    149         static $modeMap = [
    150             'r' => 33060,
    151             'rb' => 33060,
    152             'r+' => 33206,
    153             'w' => 33188,
    154             'wb' => 33188,
    155         ];
    156 
    157         return [
    158             'dev' => 0,
    159             'ino' => 0,
    160             'mode' => $modeMap[$this->mode],
    161             'nlink' => 0,
    162             'uid' => 0,
    163             'gid' => 0,
    164             'rdev' => 0,
    165             'size' => $this->stream->getSize() ?: 0,
    166             'atime' => 0,
    167             'mtime' => 0,
    168             'ctime' => 0,
    169             'blksize' => 0,
    170             'blocks' => 0,
    171         ];
    172     }
    173 
    174     /**
    175      * @return array{
    176      *   dev: int,
    177      *   ino: int,
    178      *   mode: int,
    179      *   nlink: int,
    180      *   uid: int,
    181      *   gid: int,
    182      *   rdev: int,
    183      *   size: int,
    184      *   atime: int,
    185      *   mtime: int,
    186      *   ctime: int,
    187      *   blksize: int,
    188      *   blocks: int
    189      * }
    190      */
    191195    public function url_stat(string $path, int $flags): array
    192196    {
  • mosparo-integration/tags/1.12.2/vendor-prefixed/guzzlehttp/psr7/src/UploadedFile.php

    r3042153 r3225789  
    7171        ?int $size,
    7272        int $errorStatus,
    73         string $clientFilename = null,
    74         string $clientMediaType = null
     73        ?string $clientFilename = null,
     74        ?string $clientMediaType = null
    7575    ) {
    7676        $this->setError($errorStatus);
  • mosparo-integration/tags/1.12.2/vendor-prefixed/guzzlehttp/psr7/src/Uri.php

    r3042153 r3225789  
    286286     * @see https://datatracker.ietf.org/doc/html/rfc3986#section-4.4
    287287     */
    288     public static function isSameDocumentReference(UriInterface $uri, UriInterface $base = null): bool
     288    public static function isSameDocumentReference(UriInterface $uri, ?UriInterface $base = null): bool
    289289    {
    290290        if ($base !== null) {
  • mosparo-integration/tags/1.12.2/vendor-prefixed/guzzlehttp/psr7/src/Utils.php

    r3042153 r3225789  
    238238     * @param int|null        $maxLength Maximum buffer length
    239239     */
    240     public static function readLine(StreamInterface $stream, int $maxLength = null): string
     240    public static function readLine(StreamInterface $stream, ?int $maxLength = null): string
    241241    {
    242242        $buffer = '';
     
    255255
    256256        return $buffer;
     257    }
     258
     259    /**
     260     * Redact the password in the user info part of a URI.
     261     */
     262    public static function redactUserInfo(UriInterface $uri): UriInterface
     263    {
     264        $userInfo = $uri->getUserInfo();
     265
     266        if (false !== ($pos = \strpos($userInfo, ':'))) {
     267            return $uri->withUserInfo(\substr($userInfo, 0, $pos), '***');
     268        }
     269
     270        return $uri;
    257271    }
    258272
  • mosparo-integration/trunk/mosparo-integration.php

    r3224805 r3225789  
    1515 * Author URI:        https://mosparo.io/
    1616 * License:           MIT
    17  * Version:           1.12.1
     17 * Version:           1.12.2
    1818 * Text Domain:       mosparo-integration
    1919 * Domain Path:       /languages
  • mosparo-integration/trunk/readme.txt

    r3224805 r3225789  
    55Tested up to: 6.7.1
    66Requires PHP: 7.4
    7 Stable tag: 1.12.1
     7Stable tag: 1.12.2
    88License: MIT
    99
     
    104104== Changelog ==
    105105
     106= 1.12.2 =
     107*Release Date: 20th January 2025*
     108
     109* [Bugfix] Gravity Forms: Fixed another issue with the handling of conditionally hidden fields.
     110* [Bugfix] WPForms: Fixed the initialization of the module in some cases where WPForms is not fully loaded.
     111
    106112= 1.12.1 =
    107113*Release Date: 18th January 2025*
    108114
    109115* [Bugfix] Gravity Forms: Fixed the selector and logic to handle conditionally hidden fields correctly.
     116* [Maintenance] Updated the backend dependencies
    110117
    111118= 1.12.0 =
  • mosparo-integration/trunk/src/MosparoIntegration/Module/GravityForms/MosparoField.php

    r3224805 r3225789  
    143143
    144144        foreach ($form['fields'] as $field) {
    145             if (in_array($field['type'], $ignoredTypes) || strpos($field['cssClass'] ?? '', 'mosparo__ignored-field') !== false) {
     145            if (
     146                in_array($field['type'], $ignoredTypes) ||
     147                strpos($field['cssClass'] ?? '', 'mosparo__ignored-field') !== false ||
     148                GFFormsModel::is_field_hidden($form, $field, [])
     149            ) {
    146150                continue;
    147151            }
  • mosparo-integration/trunk/src/MosparoIntegration/Module/WPForms/WPFormsModule.php

    r3113145 r3225789  
    2020    public function canInitialize()
    2121    {
    22         return defined('WPFORMS_VERSION');
     22        return defined('WPFORMS_VERSION') && class_exists('WPForms_Field');
    2323    }
    2424
  • mosparo-integration/trunk/vendor-prefixed/guzzlehttp/guzzle/src/BodySummarizer.php

    r3042153 r3225789  
    1818    private $truncateAt;
    1919
    20     public function __construct(int $truncateAt = null)
     20    public function __construct(?int $truncateAt = null)
    2121    {
    2222        $this->truncateAt = $truncateAt;
     
    2929    {
    3030        return $this->truncateAt === null
    31             ? \MosparoDependencies\GuzzleHttp\Psr7\Message::bodySummary($message)
    32             : \MosparoDependencies\GuzzleHttp\Psr7\Message::bodySummary($message, $this->truncateAt);
     31            ? Psr7\Message::bodySummary($message)
     32            : Psr7\Message::bodySummary($message, $this->truncateAt);
    3333    }
    3434}
  • mosparo-integration/trunk/vendor-prefixed/guzzlehttp/guzzle/src/Client.php

    r3042153 r3225789  
    5959     * @param array $config Client configuration settings.
    6060     *
    61      * @see \MosparoDependencies\GuzzleHttp\RequestOptions for a list of available request options.
     61     * @see RequestOptions for a list of available request options.
    6262     */
    6363    public function __construct(array $config = [])
     
    209209     * @deprecated Client::getConfig will be removed in guzzlehttp/guzzle:8.0.
    210210     */
    211     public function getConfig(string $option = null)
     211    public function getConfig(?string $option = null)
    212212    {
    213213        return $option === null
  • mosparo-integration/trunk/vendor-prefixed/guzzlehttp/guzzle/src/ClientInterface.php

    r3042153 r3225789  
    8787     * @deprecated ClientInterface::getConfig will be removed in guzzlehttp/guzzle:8.0.
    8888     */
    89     public function getConfig(string $option = null);
     89    public function getConfig(?string $option = null);
    9090}
  • mosparo-integration/trunk/vendor-prefixed/guzzlehttp/guzzle/src/Cookie/CookieJar.php

    r3042153 r3225789  
    110110    }
    111111
    112     public function clear(string $domain = null, string $path = null, string $name = null): void
     112    public function clear(?string $domain = null, ?string $path = null, ?string $name = null): void
    113113    {
    114114        if (!$domain) {
  • mosparo-integration/trunk/vendor-prefixed/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php

    r3042153 r3225789  
    6969     * @param string|null $name   Clears cookies matching a domain, path, and name
    7070     */
    71     public function clear(string $domain = null, string $path = null, string $name = null): void;
     71    public function clear(?string $domain = null, ?string $path = null, ?string $name = null): void;
    7272
    7373    /**
  • mosparo-integration/trunk/vendor-prefixed/guzzlehttp/guzzle/src/Exception/BadResponseException.php

    r3042153 r3225789  
    2121        RequestInterface $request,
    2222        ResponseInterface $response,
    23         \Throwable $previous = null,
     23        ?\Throwable $previous = null,
    2424        array $handlerContext = []
    2525    ) {
  • mosparo-integration/trunk/vendor-prefixed/guzzlehttp/guzzle/src/Exception/ConnectException.php

    r3042153 r3225789  
    3232        string $message,
    3333        RequestInterface $request,
    34         \Throwable $previous = null,
     34        ?\Throwable $previous = null,
    3535        array $handlerContext = []
    3636    ) {
  • mosparo-integration/trunk/vendor-prefixed/guzzlehttp/guzzle/src/Exception/RequestException.php

    r3042153 r3225789  
    1414use MosparoDependencies\Psr\Http\Message\RequestInterface;
    1515use MosparoDependencies\Psr\Http\Message\ResponseInterface;
    16 use MosparoDependencies\Psr\Http\Message\UriInterface;
    1716
    1817/**
     
    3938        string $message,
    4039        RequestInterface $request,
    41         ResponseInterface $response = null,
    42         \Throwable $previous = null,
     40        ?ResponseInterface $response = null,
     41        ?\Throwable $previous = null,
    4342        array $handlerContext = []
    4443    ) {
     
    7069    public static function create(
    7170        RequestInterface $request,
    72         ResponseInterface $response = null,
    73         \Throwable $previous = null,
     71        ?ResponseInterface $response = null,
     72        ?\Throwable $previous = null,
    7473        array $handlerContext = [],
    75         BodySummarizerInterface $bodySummarizer = null
     74        ?BodySummarizerInterface $bodySummarizer = null
    7675    ): self {
    7776        if (!$response) {
     
    9796        }
    9897
    99         $uri = $request->getUri();
    100         $uri = static::obfuscateUri($uri);
     98        $uri = \MosparoDependencies\GuzzleHttp\Psr7\Utils::redactUserInfo($request->getUri());
    10199
    102100        // Client Error: `GET /` resulted in a `404 Not Found` response:
     
    118116
    119117        return new $className($message, $request, $response, $previous, $handlerContext);
    120     }
    121 
    122     /**
    123      * Obfuscates URI if there is a username and a password present
    124      */
    125     private static function obfuscateUri(UriInterface $uri): UriInterface
    126     {
    127         $userInfo = $uri->getUserInfo();
    128 
    129         if (false !== ($pos = \strpos($userInfo, ':'))) {
    130             return $uri->withUserInfo(\substr($userInfo, 0, $pos), '***');
    131         }
    132 
    133         return $uri;
    134118    }
    135119
  • mosparo-integration/trunk/vendor-prefixed/guzzlehttp/guzzle/src/Handler/CurlFactory.php

    r3042153 r3225789  
    1818use MosparoDependencies\GuzzleHttp\Utils;
    1919use MosparoDependencies\Psr\Http\Message\RequestInterface;
     20use MosparoDependencies\Psr\Http\Message\UriInterface;
    2021
    2122/**
     
    5354    public function create(RequestInterface $request, array $options): EasyHandle
    5455    {
     56        $protocolVersion = $request->getProtocolVersion();
     57
     58        if ('2' === $protocolVersion || '2.0' === $protocolVersion) {
     59            if (!self::supportsHttp2()) {
     60                throw new ConnectException('HTTP/2 is supported by the cURL handler, however libcurl is built without HTTP/2 support.', $request);
     61            }
     62        } elseif ('1.0' !== $protocolVersion && '1.1' !== $protocolVersion) {
     63            throw new ConnectException(sprintf('HTTP/%s is not supported by the cURL handler.', $protocolVersion), $request);
     64        }
     65
    5566        if (isset($options['curl']['body_as_string'])) {
    5667            $options['_body_as_string'] = $options['curl']['body_as_string'];
     
    7788
    7889        return $easy;
     90    }
     91
     92    private static function supportsHttp2(): bool
     93    {
     94        static $supportsHttp2 = null;
     95
     96        if (null === $supportsHttp2) {
     97            $supportsHttp2 = self::supportsTls12()
     98                && defined('CURL_VERSION_HTTP2')
     99                && (\CURL_VERSION_HTTP2 & \curl_version()['features']);
     100        }
     101
     102        return $supportsHttp2;
     103    }
     104
     105    private static function supportsTls12(): bool
     106    {
     107        static $supportsTls12 = null;
     108
     109        if (null === $supportsTls12) {
     110            $supportsTls12 = \CURL_SSLVERSION_TLSv1_2 & \curl_version()['features'];
     111        }
     112
     113        return $supportsTls12;
     114    }
     115
     116    private static function supportsTls13(): bool
     117    {
     118        static $supportsTls13 = null;
     119
     120        if (null === $supportsTls13) {
     121            $supportsTls13 = defined('CURL_SSLVERSION_TLSv1_3')
     122                && (\CURL_SSLVERSION_TLSv1_3 & \curl_version()['features']);
     123        }
     124
     125        return $supportsTls13;
    79126    }
    80127
     
    154201            'appconnect_time' => \curl_getinfo($easy->handle, \CURLINFO_APPCONNECT_TIME),
    155202        ] + \curl_getinfo($easy->handle);
    156         $ctx[self::CURL_VERSION_STR] = \curl_version()['version'];
     203        $ctx[self::CURL_VERSION_STR] = self::getCurlVersion();
    157204        $factory->release($easy);
    158205
     
    163210
    164211        return self::createRejection($easy, $ctx);
     212    }
     213
     214    private static function getCurlVersion(): string
     215    {
     216        static $curlVersion = null;
     217
     218        if (null === $curlVersion) {
     219            $curlVersion = \curl_version()['version'];
     220        }
     221
     222        return $curlVersion;
    165223    }
    166224
     
    201259        }
    202260
     261        $uri = $easy->request->getUri();
     262
     263        $sanitizedError = self::sanitizeCurlError($ctx['error'] ?? '', $uri);
     264
    203265        $message = \sprintf(
    204266            'cURL error %s: %s (%s)',
    205267            $ctx['errno'],
    206             $ctx['error'],
     268            $sanitizedError,
    207269            'see https://curl.haxx.se/libcurl/c/libcurl-errors.html'
    208270        );
    209         $uriString = (string) $easy->request->getUri();
    210         if ($uriString !== '' && false === \strpos($ctx['error'], $uriString)) {
    211             $message .= \sprintf(' for %s', $uriString);
     271
     272        if ('' !== $sanitizedError) {
     273            $redactedUriString = \MosparoDependencies\GuzzleHttp\Psr7\Utils::redactUserInfo($uri)->__toString();
     274            if ($redactedUriString !== '' && false === \strpos($sanitizedError, $redactedUriString)) {
     275                $message .= \sprintf(' for %s', $redactedUriString);
     276            }
    212277        }
    213278
     
    218283
    219284        return P\Create::rejectionFor($error);
     285    }
     286
     287    private static function sanitizeCurlError(string $error, UriInterface $uri): string
     288    {
     289        if ('' === $error) {
     290            return $error;
     291        }
     292
     293        $baseUri = $uri->withQuery('')->withFragment('');
     294        $baseUriString = $baseUri->__toString();
     295
     296        if ('' === $baseUriString) {
     297            return $error;
     298        }
     299
     300        $redactedUriString = \MosparoDependencies\GuzzleHttp\Psr7\Utils::redactUserInfo($baseUri)->__toString();
     301
     302        return str_replace($baseUriString, $redactedUriString, $error);
    220303    }
    221304
     
    239322
    240323        $version = $easy->request->getProtocolVersion();
    241         if ($version == 1.1) {
     324
     325        if ('2' === $version || '2.0' === $version) {
     326            $conf[\CURLOPT_HTTP_VERSION] = \CURL_HTTP_VERSION_2_0;
     327        } elseif ('1.1' === $version) {
    242328            $conf[\CURLOPT_HTTP_VERSION] = \CURL_HTTP_VERSION_1_1;
    243         } elseif ($version == 2.0) {
    244             $conf[\CURLOPT_HTTP_VERSION] = \CURL_HTTP_VERSION_2_0;
    245329        } else {
    246330            $conf[\CURLOPT_HTTP_VERSION] = \CURL_HTTP_VERSION_1_0;
     
    397481                // sets a matching 'Accept-Encoding' header.
    398482                $conf[\CURLOPT_ENCODING] = '';
    399                 // But as the user did not specify any acceptable encodings we need
    400                 // to overwrite this implicit header with an empty one.
     483                // But as the user did not specify any encoding preference,
     484                // let's leave it up to server by preventing curl from sending
     485                // the header, which will be interpreted as 'Accept-Encoding: *'.
     486                // https://www.rfc-editor.org/rfc/rfc9110#field.accept-encoding
    401487                $conf[\CURLOPT_HTTPHEADER][] = 'Accept-Encoding:';
    402488            }
     
    462548
    463549        if (isset($options['crypto_method'])) {
    464             if (\STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT === $options['crypto_method']) {
    465                 if (!defined('CURL_SSLVERSION_TLSv1_0')) {
    466                     throw new \InvalidArgumentException('Invalid crypto_method request option: TLS 1.0 not supported by your version of cURL');
    467                 }
     550            $protocolVersion = $easy->request->getProtocolVersion();
     551
     552            // If HTTP/2, upgrade TLS 1.0 and 1.1 to 1.2
     553            if ('2' === $protocolVersion || '2.0' === $protocolVersion) {
     554                if (
     555                    \STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT === $options['crypto_method']
     556                    || \STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT === $options['crypto_method']
     557                    || \STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT === $options['crypto_method']
     558                ) {
     559                    $conf[\CURLOPT_SSLVERSION] = \CURL_SSLVERSION_TLSv1_2;
     560                } elseif (defined('STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT') && \STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT === $options['crypto_method']) {
     561                    if (!self::supportsTls13()) {
     562                        throw new \InvalidArgumentException('Invalid crypto_method request option: TLS 1.3 not supported by your version of cURL');
     563                    }
     564                    $conf[\CURLOPT_SSLVERSION] = \CURL_SSLVERSION_TLSv1_3;
     565                } else {
     566                    throw new \InvalidArgumentException('Invalid crypto_method request option: unknown version provided');
     567                }
     568            } elseif (\STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT === $options['crypto_method']) {
    468569                $conf[\CURLOPT_SSLVERSION] = \CURL_SSLVERSION_TLSv1_0;
    469570            } elseif (\STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT === $options['crypto_method']) {
    470                 if (!defined('CURL_SSLVERSION_TLSv1_1')) {
    471                     throw new \InvalidArgumentException('Invalid crypto_method request option: TLS 1.1 not supported by your version of cURL');
    472                 }
    473571                $conf[\CURLOPT_SSLVERSION] = \CURL_SSLVERSION_TLSv1_1;
    474572            } elseif (\STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT === $options['crypto_method']) {
    475                 if (!defined('CURL_SSLVERSION_TLSv1_2')) {
     573                if (!self::supportsTls12()) {
    476574                    throw new \InvalidArgumentException('Invalid crypto_method request option: TLS 1.2 not supported by your version of cURL');
    477575                }
    478576                $conf[\CURLOPT_SSLVERSION] = \CURL_SSLVERSION_TLSv1_2;
    479577            } elseif (defined('STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT') && \STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT === $options['crypto_method']) {
    480                 if (!defined('CURL_SSLVERSION_TLSv1_3')) {
     578                if (!self::supportsTls13()) {
    481579                    throw new \InvalidArgumentException('Invalid crypto_method request option: TLS 1.3 not supported by your version of cURL');
    482580                }
  • mosparo-integration/trunk/vendor-prefixed/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php

    r3042153 r3225789  
    99namespace MosparoDependencies\GuzzleHttp\Handler;
    1010
     11use Closure;
    1112use MosparoDependencies\GuzzleHttp\Promise as P;
    1213use MosparoDependencies\GuzzleHttp\Promise\Promise;
     
    166167        }
    167168
     169        // Run curl_multi_exec in the queue to enable other async tasks to run
     170        P\Utils::queue()->add(Closure::fromCallable([$this, 'tickInQueue']));
     171
    168172        // Step through the task queue which may add additional requests.
    169173        P\Utils::queue()->run();
     
    176180
    177181        while (\curl_multi_exec($this->_mh, $this->active) === \CURLM_CALL_MULTI_PERFORM) {
     182            // Prevent busy looping for slow HTTP requests.
     183            \curl_multi_select($this->_mh, $this->selectTimeout);
    178184        }
    179185
    180186        $this->processMessages();
     187    }
     188
     189    /**
     190     * Runs \curl_multi_exec() inside the event loop, to prevent busy looping
     191     */
     192    private function tickInQueue(): void
     193    {
     194        if (\curl_multi_exec($this->_mh, $this->active) === \CURLM_CALL_MULTI_PERFORM) {
     195            \curl_multi_select($this->_mh, 0);
     196            P\Utils::queue()->add(Closure::fromCallable([$this, 'tickInQueue']));
     197        }
    181198    }
    182199
  • mosparo-integration/trunk/vendor-prefixed/guzzlehttp/guzzle/src/Handler/MockHandler.php

    r3042153 r3225789  
    5959     * @param callable|null $onRejected  Callback to invoke when the return value is rejected.
    6060     */
    61     public static function createWithMiddleware(array $queue = null, callable $onFulfilled = null, callable $onRejected = null): HandlerStack
     61    public static function createWithMiddleware(?array $queue = null, ?callable $onFulfilled = null, ?callable $onRejected = null): HandlerStack
    6262    {
    6363        return HandlerStack::create(new self($queue, $onFulfilled, $onRejected));
     
    6666    /**
    6767     * The passed in value must be an array of
    68      * {@see \Psr\Http\Message\ResponseInterface} objects, Exceptions,
     68     * {@see ResponseInterface} objects, Exceptions,
    6969     * callables, or Promises.
    7070     *
     
    7373     * @param callable|null          $onRejected  Callback to invoke when the return value is rejected.
    7474     */
    75     public function __construct(array $queue = null, callable $onFulfilled = null, callable $onRejected = null)
     75    public function __construct(?array $queue = null, ?callable $onFulfilled = null, ?callable $onRejected = null)
    7676    {
    7777        $this->onFulfilled = $onFulfilled;
     
    207207        RequestInterface $request,
    208208        array $options,
    209         ResponseInterface $response = null,
     209        ?ResponseInterface $response = null,
    210210        $reason = null
    211211    ): void {
  • mosparo-integration/trunk/vendor-prefixed/guzzlehttp/guzzle/src/Handler/StreamHandler.php

    r3042153 r3225789  
    4545        if (isset($options['delay'])) {
    4646            \usleep($options['delay'] * 1000);
     47        }
     48
     49        $protocolVersion = $request->getProtocolVersion();
     50
     51        if ('1.0' !== $protocolVersion && '1.1' !== $protocolVersion) {
     52            throw new ConnectException(sprintf('HTTP/%s is not supported by the stream handler.', $protocolVersion), $request);
    4753        }
    4854
     
    9096        RequestInterface $request,
    9197        ?float $startTime,
    92         ResponseInterface $response = null,
    93         \Throwable $error = null
     98        ?ResponseInterface $response = null,
     99        ?\Throwable $error = null
    94100    ): void {
    95101        if (isset($options['on_stats'])) {
     
    280286        // HTTP/1.1 streams using the PHP stream wrapper require a
    281287        // Connection: close header
    282         if ($request->getProtocolVersion() == '1.1'
     288        if ($request->getProtocolVersion() === '1.1'
    283289            && !$request->hasHeader('Connection')
    284290        ) {
  • mosparo-integration/trunk/vendor-prefixed/guzzlehttp/guzzle/src/HandlerStack.php

    r3042153 r3225789  
    5151     *                                                                            system will be utilized.
    5252     */
    53     public static function create(callable $handler = null): self
     53    public static function create(?callable $handler = null): self
    5454    {
    5555        $stack = new self($handler ?: Utils::chooseHandler());
     
    6565     * @param (callable(RequestInterface, array): PromiseInterface)|null $handler Underlying HTTP handler.
    6666     */
    67     public function __construct(callable $handler = null)
     67    public function __construct(?callable $handler = null)
    6868    {
    6969        $this->handler = $handler;
     
    138138     * @param string                       $name       Name to register for this middleware.
    139139     */
    140     public function unshift(callable $middleware, string $name = null): void
     140    public function unshift(callable $middleware, ?string $name = null): void
    141141    {
    142142        \array_unshift($this->stack, [$middleware, $name]);
  • mosparo-integration/trunk/vendor-prefixed/guzzlehttp/guzzle/src/MessageFormatter.php

    r3042153 r3225789  
    7575     * @param \Throwable|null        $error    Exception that was received
    7676     */
    77     public function format(RequestInterface $request, ResponseInterface $response = null, \Throwable $error = null): string
     77    public function format(RequestInterface $request, ?ResponseInterface $response = null, ?\Throwable $error = null): string
    7878    {
    7979        $cache = [];
  • mosparo-integration/trunk/vendor-prefixed/guzzlehttp/guzzle/src/MessageFormatterInterface.php

    r3042153 r3225789  
    2121     * @param \Throwable|null        $error    Exception that was received
    2222     */
    23     public function format(RequestInterface $request, ResponseInterface $response = null, \Throwable $error = null): string;
     23    public function format(RequestInterface $request, ?ResponseInterface $response = null, ?\Throwable $error = null): string;
    2424}
  • mosparo-integration/trunk/vendor-prefixed/guzzlehttp/guzzle/src/Middleware.php

    r3042153 r3225789  
    6262     * @return callable(callable): callable Returns a function that accepts the next handler.
    6363     */
    64     public static function httpErrors(BodySummarizerInterface $bodySummarizer = null): callable
     64    public static function httpErrors(?BodySummarizerInterface $bodySummarizer = null): callable
    6565    {
    6666        return static function (callable $handler) use ($bodySummarizer): callable {
     
    139139     * @return callable Returns a function that accepts the next handler.
    140140     */
    141     public static function tap(callable $before = null, callable $after = null): callable
     141    public static function tap(?callable $before = null, ?callable $after = null): callable
    142142    {
    143143        return static function (callable $handler) use ($before, $after): callable {
     
    183183     * @return callable Returns a function that accepts the next handler.
    184184     */
    185     public static function retry(callable $decider, callable $delay = null): callable
     185    public static function retry(callable $decider, ?callable $delay = null): callable
    186186    {
    187187        return static function (callable $handler) use ($decider, $delay): RetryMiddleware {
  • mosparo-integration/trunk/vendor-prefixed/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php

    r3042153 r3225789  
    8383        $expect = $options['expect'] ?? null;
    8484
    85         // Return if disabled or if you're not using HTTP/1.1 or HTTP/2.0
    86         if ($expect === false || $request->getProtocolVersion() < 1.1) {
     85        // Return if disabled or using HTTP/1.0
     86        if ($expect === false || $request->getProtocolVersion() === '1.0') {
    8787            return;
    8888        }
  • mosparo-integration/trunk/vendor-prefixed/guzzlehttp/guzzle/src/RequestOptions.php

    r3042153 r3225789  
    6868     * jar to use or what cookies to send. This option only works if your
    6969     * handler has the `cookie` middleware. Valid values are `false` and
    70      * an instance of {@see \GuzzleHttp\Cookie\CookieJarInterface}.
     70     * an instance of {@see Cookie\CookieJarInterface}.
    7171     */
    7272    public const COOKIES = 'cookies';
  • mosparo-integration/trunk/vendor-prefixed/guzzlehttp/guzzle/src/RetryMiddleware.php

    r3042153 r3225789  
    4747     *                                                                         milliseconds to delay.
    4848     */
    49     public function __construct(callable $decider, callable $nextHandler, callable $delay = null)
     49    public function __construct(callable $decider, callable $nextHandler, ?callable $delay = null)
    5050    {
    5151        $this->decider = $decider;
     
    117117    }
    118118
    119     private function doRetry(RequestInterface $request, array $options, ResponseInterface $response = null): PromiseInterface
     119    private function doRetry(RequestInterface $request, array $options, ?ResponseInterface $response = null): PromiseInterface
    120120    {
    121121        $options['delay'] = ($this->delay)(++$options['retries'], $response, $request);
  • mosparo-integration/trunk/vendor-prefixed/guzzlehttp/guzzle/src/TransferStats.php

    r3042153 r3225789  
    5353    public function __construct(
    5454        RequestInterface $request,
    55         ResponseInterface $response = null,
    56         float $transferTime = null,
     55        ?ResponseInterface $response = null,
     56        ?float $transferTime = null,
    5757        $handlerErrorData = null,
    5858        array $handlerStats = []
  • mosparo-integration/trunk/vendor-prefixed/guzzlehttp/guzzle/src/Utils.php

    r3042153 r3225789  
    7878        }
    7979
    80         return \MosparoDependencies\GuzzleHttp\Psr7\Utils::tryFopen('php://output', 'w');
     80        return Psr7\Utils::tryFopen('php://output', 'w');
    8181    }
    8282
     
    9494        $handler = null;
    9595
    96         if (\defined('CURLOPT_CUSTOMREQUEST')) {
     96        if (\defined('CURLOPT_CUSTOMREQUEST') && \function_exists('curl_version') && version_compare(curl_version()['version'], '7.21.2') >= 0) {
    9797            if (\function_exists('curl_multi_exec') && \function_exists('curl_exec')) {
    9898                $handler = Proxy::wrapSync(new CurlMultiHandler(), new CurlHandler());
  • mosparo-integration/trunk/vendor-prefixed/guzzlehttp/promises/src/Coroutine.php

    r3042153 r3225789  
    9191
    9292    public function then(
    93         callable $onFulfilled = null,
    94         callable $onRejected = null
     93        ?callable $onFulfilled = null,
     94        ?callable $onRejected = null
    9595    ): PromiseInterface {
    9696        return $this->result->then($onFulfilled, $onRejected);
  • mosparo-integration/trunk/vendor-prefixed/guzzlehttp/promises/src/Each.php

    r3042153 r3225789  
    3030    public static function of(
    3131        $iterable,
    32         callable $onFulfilled = null,
    33         callable $onRejected = null
     32        ?callable $onFulfilled = null,
     33        ?callable $onRejected = null
    3434    ): PromiseInterface {
    3535        return (new EachPromise($iterable, [
     
    5353        $iterable,
    5454        $concurrency,
    55         callable $onFulfilled = null,
    56         callable $onRejected = null
     55        ?callable $onFulfilled = null,
     56        ?callable $onRejected = null
    5757    ): PromiseInterface {
    5858        return (new EachPromise($iterable, [
     
    7474        $iterable,
    7575        $concurrency,
    76         callable $onFulfilled = null
     76        ?callable $onFulfilled = null
    7777    ): PromiseInterface {
    7878        return self::ofLimit(
  • mosparo-integration/trunk/vendor-prefixed/guzzlehttp/promises/src/FulfilledPromise.php

    r3042153 r3225789  
    3838
    3939    public function then(
    40         callable $onFulfilled = null,
    41         callable $onRejected = null
     40        ?callable $onFulfilled = null,
     41        ?callable $onRejected = null
    4242    ): PromiseInterface {
    4343        // Return itself if there is no onFulfilled function.
  • mosparo-integration/trunk/vendor-prefixed/guzzlehttp/promises/src/Promise.php

    r3042153 r3225789  
    3232     */
    3333    public function __construct(
    34         callable $waitFn = null,
    35         callable $cancelFn = null
     34        ?callable $waitFn = null,
     35        ?callable $cancelFn = null
    3636    ) {
    3737        $this->waitFn = $waitFn;
     
    4040
    4141    public function then(
    42         callable $onFulfilled = null,
    43         callable $onRejected = null
     42        ?callable $onFulfilled = null,
     43        ?callable $onRejected = null
    4444    ): PromiseInterface {
    4545        if ($this->state === self::PENDING) {
  • mosparo-integration/trunk/vendor-prefixed/guzzlehttp/promises/src/PromiseInterface.php

    r3042153 r3225789  
    3434     */
    3535    public function then(
    36         callable $onFulfilled = null,
    37         callable $onRejected = null
     36        ?callable $onFulfilled = null,
     37        ?callable $onRejected = null
    3838    ): PromiseInterface;
    3939
  • mosparo-integration/trunk/vendor-prefixed/guzzlehttp/promises/src/RejectedPromise.php

    r3042153 r3225789  
    3838
    3939    public function then(
    40         callable $onFulfilled = null,
    41         callable $onRejected = null
     40        ?callable $onFulfilled = null,
     41        ?callable $onRejected = null
    4242    ): PromiseInterface {
    4343        // If there's no onRejected callback then just return self.
  • mosparo-integration/trunk/vendor-prefixed/guzzlehttp/promises/src/RejectionException.php

    r3042153 r3225789  
    2525     * @param string|null $description Optional description.
    2626     */
    27     public function __construct($reason, string $description = null)
     27    public function __construct($reason, ?string $description = null)
    2828    {
    2929        $this->reason = $reason;
  • mosparo-integration/trunk/vendor-prefixed/guzzlehttp/promises/src/Utils.php

    r3042153 r3225789  
    2828     * @param TaskQueueInterface|null $assign Optionally specify a new queue instance.
    2929     */
    30     public static function queue(TaskQueueInterface $assign = null): TaskQueueInterface
     30    public static function queue(?TaskQueueInterface $assign = null): TaskQueueInterface
    3131    {
    3232        static $queue;
     
    151151            },
    152152            function ($reason, $idx, Promise $aggregate): void {
    153                 $aggregate->reject($reason);
     153                if (Is::pending($aggregate)) {
     154                    $aggregate->reject($reason);
     155                }
    154156            }
    155157        )->then(function () use (&$results) {
  • mosparo-integration/trunk/vendor-prefixed/guzzlehttp/psr7/src/CachingStream.php

    r3042153 r3225789  
    4040    public function __construct(
    4141        StreamInterface $stream,
    42         StreamInterface $target = null
     42        ?StreamInterface $target = null
    4343    ) {
    4444        $this->remoteStream = $stream;
  • mosparo-integration/trunk/vendor-prefixed/guzzlehttp/psr7/src/HttpFactory.php

    r3042153 r3225789  
    3434    public function createUploadedFile(
    3535        StreamInterface $stream,
    36         int $size = null,
     36        ?int $size = null,
    3737        int $error = \UPLOAD_ERR_OK,
    38         string $clientFilename = null,
    39         string $clientMediaType = null
     38        ?string $clientFilename = null,
     39        ?string $clientMediaType = null
    4040    ): UploadedFileInterface {
    4141        if ($size === null) {
  • mosparo-integration/trunk/vendor-prefixed/guzzlehttp/psr7/src/MultipartStream.php

    r3042153 r3225789  
    3939     * @throws \InvalidArgumentException
    4040     */
    41     public function __construct(array $elements = [], string $boundary = null)
     41    public function __construct(array $elements = [], ?string $boundary = null)
    4242    {
    4343        $this->boundary = $boundary ?: bin2hex(random_bytes(20));
  • mosparo-integration/trunk/vendor-prefixed/guzzlehttp/psr7/src/Query.php

    r3042153 r3225789  
    7070     * encountered (like `http_build_query()` would).
    7171     *
    72      * @param array     $params   Query string parameters.
    73      * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986
    74      *                            to encode using RFC3986, or PHP_QUERY_RFC1738
    75      *                            to encode using RFC1738.
     72     * @param array     $params           Query string parameters.
     73     * @param int|false $encoding         Set to false to not encode,
     74     *                                    PHP_QUERY_RFC3986 to encode using
     75     *                                    RFC3986, or PHP_QUERY_RFC1738 to
     76     *                                    encode using RFC1738.
     77     * @param bool      $treatBoolsAsInts Set to true to encode as 0/1, and
     78     *                                    false as false/true.
    7679     */
    77     public static function build(array $params, $encoding = PHP_QUERY_RFC3986): string
     80    public static function build(array $params, $encoding = PHP_QUERY_RFC3986, bool $treatBoolsAsInts = true): string
    7881    {
    7982        if (!$params) {
     
    9396        }
    9497
     98        $castBool = $treatBoolsAsInts ? static function ($v) { return (int) $v; } : static function ($v) { return $v ? 'true' : 'false'; };
     99
    95100        $qs = '';
    96101        foreach ($params as $k => $v) {
     
    98103            if (!is_array($v)) {
    99104                $qs .= $k;
    100                 $v = is_bool($v) ? (int) $v : $v;
     105                $v = is_bool($v) ? $castBool($v) : $v;
    101106                if ($v !== null) {
    102107                    $qs .= '='.$encoder((string) $v);
     
    106111                foreach ($v as $vv) {
    107112                    $qs .= $k;
    108                     $vv = is_bool($vv) ? (int) $vv : $vv;
     113                    $vv = is_bool($vv) ? $castBool($vv) : $vv;
    109114                    if ($vv !== null) {
    110115                        $qs .= '='.$encoder((string) $vv);
  • mosparo-integration/trunk/vendor-prefixed/guzzlehttp/psr7/src/Response.php

    r3042153 r3225789  
    103103        $body = null,
    104104        string $version = '1.1',
    105         string $reason = null
     105        ?string $reason = null
    106106    ) {
    107107        $this->assertStatusCodeRange($status);
  • mosparo-integration/trunk/vendor-prefixed/guzzlehttp/psr7/src/StreamWrapper.php

    r3042153 r3225789  
    7676    }
    7777
    78     public function stream_open(string $path, string $mode, int $options, string &$opened_path = null): bool
     78    public function stream_open(string $path, string $mode, int $options, ?string &$opened_path = null): bool
    7979    {
    8080        $options = stream_context_get_options($this->context);
     
    126126
    127127        return $resource ?? false;
     128    }
     129
     130    /**
     131     * @return array{
     132     *   dev: int,
     133     *   ino: int,
     134     *   mode: int,
     135     *   nlink: int,
     136     *   uid: int,
     137     *   gid: int,
     138     *   rdev: int,
     139     *   size: int,
     140     *   atime: int,
     141     *   mtime: int,
     142     *   ctime: int,
     143     *   blksize: int,
     144     *   blocks: int
     145     * }|false
     146     */
     147    public function stream_stat()
     148    {
     149        if ($this->stream->getSize() === null) {
     150            return false;
     151        }
     152
     153        static $modeMap = [
     154            'r' => 33060,
     155            'rb' => 33060,
     156            'r+' => 33206,
     157            'w' => 33188,
     158            'wb' => 33188,
     159        ];
     160
     161        return [
     162            'dev' => 0,
     163            'ino' => 0,
     164            'mode' => $modeMap[$this->mode],
     165            'nlink' => 0,
     166            'uid' => 0,
     167            'gid' => 0,
     168            'rdev' => 0,
     169            'size' => $this->stream->getSize() ?: 0,
     170            'atime' => 0,
     171            'mtime' => 0,
     172            'ctime' => 0,
     173            'blksize' => 0,
     174            'blocks' => 0,
     175        ];
    128176    }
    129177
     
    145193     * }
    146194     */
    147     public function stream_stat(): array
    148     {
    149         static $modeMap = [
    150             'r' => 33060,
    151             'rb' => 33060,
    152             'r+' => 33206,
    153             'w' => 33188,
    154             'wb' => 33188,
    155         ];
    156 
    157         return [
    158             'dev' => 0,
    159             'ino' => 0,
    160             'mode' => $modeMap[$this->mode],
    161             'nlink' => 0,
    162             'uid' => 0,
    163             'gid' => 0,
    164             'rdev' => 0,
    165             'size' => $this->stream->getSize() ?: 0,
    166             'atime' => 0,
    167             'mtime' => 0,
    168             'ctime' => 0,
    169             'blksize' => 0,
    170             'blocks' => 0,
    171         ];
    172     }
    173 
    174     /**
    175      * @return array{
    176      *   dev: int,
    177      *   ino: int,
    178      *   mode: int,
    179      *   nlink: int,
    180      *   uid: int,
    181      *   gid: int,
    182      *   rdev: int,
    183      *   size: int,
    184      *   atime: int,
    185      *   mtime: int,
    186      *   ctime: int,
    187      *   blksize: int,
    188      *   blocks: int
    189      * }
    190      */
    191195    public function url_stat(string $path, int $flags): array
    192196    {
  • mosparo-integration/trunk/vendor-prefixed/guzzlehttp/psr7/src/UploadedFile.php

    r3042153 r3225789  
    7171        ?int $size,
    7272        int $errorStatus,
    73         string $clientFilename = null,
    74         string $clientMediaType = null
     73        ?string $clientFilename = null,
     74        ?string $clientMediaType = null
    7575    ) {
    7676        $this->setError($errorStatus);
  • mosparo-integration/trunk/vendor-prefixed/guzzlehttp/psr7/src/Uri.php

    r3042153 r3225789  
    286286     * @see https://datatracker.ietf.org/doc/html/rfc3986#section-4.4
    287287     */
    288     public static function isSameDocumentReference(UriInterface $uri, UriInterface $base = null): bool
     288    public static function isSameDocumentReference(UriInterface $uri, ?UriInterface $base = null): bool
    289289    {
    290290        if ($base !== null) {
  • mosparo-integration/trunk/vendor-prefixed/guzzlehttp/psr7/src/Utils.php

    r3042153 r3225789  
    238238     * @param int|null        $maxLength Maximum buffer length
    239239     */
    240     public static function readLine(StreamInterface $stream, int $maxLength = null): string
     240    public static function readLine(StreamInterface $stream, ?int $maxLength = null): string
    241241    {
    242242        $buffer = '';
     
    255255
    256256        return $buffer;
     257    }
     258
     259    /**
     260     * Redact the password in the user info part of a URI.
     261     */
     262    public static function redactUserInfo(UriInterface $uri): UriInterface
     263    {
     264        $userInfo = $uri->getUserInfo();
     265
     266        if (false !== ($pos = \strpos($userInfo, ':'))) {
     267            return $uri->withUserInfo(\substr($userInfo, 0, $pos), '***');
     268        }
     269
     270        return $uri;
    257271    }
    258272
Note: See TracChangeset for help on using the changeset viewer.