diff --git a/src/Symfony/Component/HttpClient/CurlHttpClient.php b/src/Symfony/Component/HttpClient/CurlHttpClient.php index 93bae75816..f25367469a 100644 --- a/src/Symfony/Component/HttpClient/CurlHttpClient.php +++ b/src/Symfony/Component/HttpClient/CurlHttpClient.php @@ -141,7 +141,7 @@ final class CurlHttpClient implements HttpClientInterface, LoggerAwareInterface CURLOPT_FOLLOWLOCATION => true, CURLOPT_MAXREDIRS => 0 < $options['max_redirects'] ? $options['max_redirects'] : 0, CURLOPT_COOKIEFILE => '', // Keep track of cookies during redirects - CURLOPT_CONNECTTIMEOUT_MS => 1000 * $options['timeout'], + CURLOPT_TIMEOUT => 0, CURLOPT_PROXY => $options['proxy'], CURLOPT_NOPROXY => $options['no_proxy'] ?? $_SERVER['no_proxy'] ?? $_SERVER['NO_PROXY'] ?? '', CURLOPT_SSL_VERIFYPEER => $options['verify_peer'], diff --git a/src/Symfony/Component/HttpKernel/HttpCache/Store.php b/src/Symfony/Component/HttpKernel/HttpCache/Store.php index ede63878f6..bf7fd155bd 100644 --- a/src/Symfony/Component/HttpKernel/HttpCache/Store.php +++ b/src/Symfony/Component/HttpKernel/HttpCache/Store.php @@ -340,7 +340,7 @@ class Store implements StoreInterface { $path = $this->getPath($key); - return file_exists($path) ? file_get_contents($path) : null; + return file_exists($path) && false !== ($contents = file_get_contents($path)) ? $contents : null; } /** diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 4f33015653..e2a1520b66 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -503,10 +503,9 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl return; } - if ($this->debug) { + if ($collectDeprecations = $this->debug && !\defined('PHPUNIT_COMPOSER_INSTALL')) { $collectedLogs = []; - $previousHandler = \defined('PHPUNIT_COMPOSER_INSTALL'); - $previousHandler = $previousHandler ?: set_error_handler(function ($type, $message, $file, $line) use (&$collectedLogs, &$previousHandler) { + $previousHandler = set_error_handler(function ($type, $message, $file, $line) use (&$collectedLogs, &$previousHandler) { if (E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type) { return $previousHandler ? $previousHandler($type, $message, $file, $line) : false; } @@ -549,7 +548,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl $container = $this->buildContainer(); $container->compile(); } finally { - if ($this->debug && true !== $previousHandler) { + if ($collectDeprecations) { restore_error_handler(); file_put_contents($cacheDir.'/'.$class.'Deprecations.log', serialize(array_values($collectedLogs))); diff --git a/src/Symfony/Component/Intl/Collator/Collator.php b/src/Symfony/Component/Intl/Collator/Collator.php index a1fe084fa5..79ffb072aa 100644 --- a/src/Symfony/Component/Intl/Collator/Collator.php +++ b/src/Symfony/Component/Intl/Collator/Collator.php @@ -70,7 +70,7 @@ class Collator const SORT_STRING = 1; /** - * @param string $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en") + * @param string|null $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en") * * @throws MethodArgumentValueNotImplementedException When $locale different than "en" or null is passed */ @@ -84,7 +84,7 @@ class Collator /** * Static constructor. * - * @param string $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en") + * @param string|null $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en") * * @return self * diff --git a/src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php b/src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php index 390a98b962..79c025ce45 100644 --- a/src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php +++ b/src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php @@ -118,7 +118,7 @@ class IntlDateFormatter private $timeZoneId; /** - * @param string $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en") + * @param string|null $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en") * @param int|null $datetype Type of date formatting, one of the format type constants * @param int|null $timetype Type of time formatting, one of the format type constants * @param \IntlTimeZone|\DateTimeZone|string|null $timezone Timezone identifier @@ -152,7 +152,7 @@ class IntlDateFormatter /** * Static constructor. * - * @param string $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en") + * @param string|null $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en") * @param int|null $datetype Type of date formatting, one of the format type constants * @param int|null $timetype Type of time formatting, one of the format type constants * @param \IntlTimeZone|\DateTimeZone|string|null $timezone Timezone identifier diff --git a/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php b/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php index d40039e994..5299ad6edf 100644 --- a/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php +++ b/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php @@ -241,13 +241,13 @@ class NumberFormatter ]; /** - * @param string $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en") - * @param int $style Style of the formatting, one of the format style constants. - * The only supported styles are NumberFormatter::DECIMAL - * and NumberFormatter::CURRENCY. - * @param string $pattern Not supported. A pattern string in case $style is NumberFormat::PATTERN_DECIMAL or - * NumberFormat::PATTERN_RULEBASED. It must conform to the syntax - * described in the ICU DecimalFormat or ICU RuleBasedNumberFormat documentation + * @param string|null $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en") + * @param int $style Style of the formatting, one of the format style constants. + * The only supported styles are NumberFormatter::DECIMAL + * and NumberFormatter::CURRENCY. + * @param string $pattern Not supported. A pattern string in case $style is NumberFormat::PATTERN_DECIMAL or + * NumberFormat::PATTERN_RULEBASED. It must conform to the syntax + * described in the ICU DecimalFormat or ICU RuleBasedNumberFormat documentation * * @see http://www.php.net/manual/en/numberformatter.create.php * @see http://www.icu-project.org/apiref/icu4c/classDecimalFormat.html#_details diff --git a/src/Symfony/Component/Lock/Store/CombinedStore.php b/src/Symfony/Component/Lock/Store/CombinedStore.php index bb66fcd727..c66e454015 100644 --- a/src/Symfony/Component/Lock/Store/CombinedStore.php +++ b/src/Symfony/Component/Lock/Store/CombinedStore.php @@ -101,7 +101,7 @@ class CombinedStore implements StoreInterface, LoggerAwareInterface public function waitAndSave(Key $key) { @trigger_error(sprintf('%s() is deprecated since Symfony 4.4 and will be removed in Symfony 5.0.', __METHOD__), E_USER_DEPRECATED); - throw new NotSupportedException(sprintf('The store "%s" does not supports blocking locks.', \get_class($this))); + throw new NotSupportedException(sprintf('The store "%s" does not support blocking locks.', \get_class($this))); } /** diff --git a/src/Symfony/Component/Lock/Store/MemcachedStore.php b/src/Symfony/Component/Lock/Store/MemcachedStore.php index 5e99b39814..a72030b325 100644 --- a/src/Symfony/Component/Lock/Store/MemcachedStore.php +++ b/src/Symfony/Component/Lock/Store/MemcachedStore.php @@ -14,6 +14,7 @@ namespace Symfony\Component\Lock\Store; use Symfony\Component\Lock\Exception\InvalidArgumentException; use Symfony\Component\Lock\Exception\InvalidTtlException; use Symfony\Component\Lock\Exception\LockConflictedException; +use Symfony\Component\Lock\Exception\NotSupportedException; use Symfony\Component\Lock\Key; use Symfony\Component\Lock\StoreInterface; @@ -77,7 +78,7 @@ class MemcachedStore implements StoreInterface public function waitAndSave(Key $key) { @trigger_error(sprintf('%s() is deprecated since Symfony 4.4 and will be removed in Symfony 5.0.', __METHOD__), E_USER_DEPRECATED); - throw new InvalidArgumentException(sprintf('The store "%s" does not supports blocking locks.', \get_class($this))); + throw new NotSupportedException(sprintf('The store "%s" does not support blocking locks.', \get_class($this))); } /** diff --git a/src/Symfony/Component/Lock/Store/RedisStore.php b/src/Symfony/Component/Lock/Store/RedisStore.php index a20fb89a01..74984699c6 100644 --- a/src/Symfony/Component/Lock/Store/RedisStore.php +++ b/src/Symfony/Component/Lock/Store/RedisStore.php @@ -16,6 +16,7 @@ use Symfony\Component\Cache\Traits\RedisProxy; use Symfony\Component\Lock\Exception\InvalidArgumentException; use Symfony\Component\Lock\Exception\InvalidTtlException; use Symfony\Component\Lock\Exception\LockConflictedException; +use Symfony\Component\Lock\Exception\NotSupportedException; use Symfony\Component\Lock\Key; use Symfony\Component\Lock\StoreInterface; @@ -80,7 +81,7 @@ class RedisStore implements StoreInterface public function waitAndSave(Key $key) { @trigger_error(sprintf('%s() is deprecated since Symfony 4.4 and will be removed in Symfony 5.0.', __METHOD__), E_USER_DEPRECATED); - throw new InvalidArgumentException(sprintf('The store "%s" does not supports blocking locks.', \get_class($this))); + throw new NotSupportedException(sprintf('The store "%s" does not support blocking locks.', \get_class($this))); } /** diff --git a/src/Symfony/Contracts/HttpClient/Test/HttpClientTestCase.php b/src/Symfony/Contracts/HttpClient/Test/HttpClientTestCase.php index 59724e2e90..24cbfc3e1d 100644 --- a/src/Symfony/Contracts/HttpClient/Test/HttpClientTestCase.php +++ b/src/Symfony/Contracts/HttpClient/Test/HttpClientTestCase.php @@ -583,6 +583,16 @@ abstract class HttpClientTestCase extends TestCase $client->request('GET', 'http://symfony.com:8057/', ['timeout' => 1]); } + public function testNotATimeout() + { + $client = $this->getHttpClient(__FUNCTION__); + $response = $client->request('GET', 'http://localhost:8057/timeout-header', [ + 'timeout' => 0.5, + ]); + usleep(510000); + $this->assertSame(200, $response->getStatusCode()); + } + public function testTimeoutOnAccess() { $client = $this->getHttpClient(__FUNCTION__);