8000 Merge branch '4.3' into 4.4 · symfony/symfony@2273de0 · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit 2273de0

Browse files
Merge branch '4.3' into 4.4
* 4.3: consistently throw NotSupportException [HttpKernel] Clarify error handler restoring process again [HttpClient] Remove CURLOPT_CONNECTTIMEOUT_MS curl opt [Intl] fix nullable phpdocs and useless method visibility of internal class Resilience against file_get_contents() race conditions.
2 parents fbaf4ac + c0f416e commit 2273de0

File tree

10 files changed

+31
-20
lines changed

10 files changed

+31
-20
lines changed

src/Symfony/Component/HttpClient/CurlHttpClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public function request(string $method, string $url, array $options = []): Respo
141141
CURLOPT_FOLLOWLOCATION => true,
142142
CURLOPT_MAXREDIRS => 0 < $options['max_redirects'] ? $options['max_redirects'] : 0,
143143
CURLOPT_COOKIEFILE => '', // Keep track of cookies during redirects
144-
CURLOPT_CONNECTTIMEOUT_MS => 1000 * $options['timeout'],
144+
CURLOPT_TIMEOUT => 0,
145145
CURLOPT_PROXY => $options['proxy'],
146146
CURLOPT_NOPROXY => $options['no_proxy'] ?? $_SERVER['no_proxy'] ?? $_SERVER['NO_PROXY'] ?? '',
147147
CURLOPT_SSL_VERIFYPEER => $options['verify_peer'],

src/Symfony/Component/HttpKernel/HttpCache/Store.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ private function load(string $key): ?string
340340
{
341341
$path = $this->getPath($key);
342342

343-
return file_exists($path) ? file_get_contents($path) : null;
343+
return file_exists($path) && false !== ($contents = file_get_contents($path)) ? $contents : null;
344344
}
345345

346346
/**

src/Symfony/Component/HttpKernel/Kernel.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -503,10 +503,9 @@ protected function initializeContainer()
503503
return;
504504
}
505505

506-
if ($this->debug) {
506+
if ($collectDeprecations = $this->debug && !\defined('PHPUNIT_COMPOSER_INSTALL')) {
507507
$collectedLogs = [];
508-
$previousHandler = \defined('PHPUNIT_COMPOSER_INSTALL');
509-
$previousHandler = $previousHandler ?: set_error_handler(function ($type, $message, $file, $line) use (&$collectedLogs, &$previousHandler) {
508+
$previousHandler = set_error_handler(function ($type, $message, $file, $line) use (&$collectedLogs, &$previousHandler) {
510509
if (E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type) {
511510
return $previousHandler ? $previousHandler($type, $message, $file, $line) : false;
512511
}
@@ -549,7 +548,7 @@ protected function initializeContainer()
549548
$container = $this->buildContainer();
550549
$container->compile();
551550
} finally {
552-
if ($this->debug && true !== $previousHandler) {
551+
if ($collectDeprecations) {
553552
restore_error_handler();
554553

555554
file_put_contents($cacheDir.'/'.$class.'Deprecations.log', serialize(array_values($collectedLogs)));

src/Symfony/Component/Intl/Collator/Collator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class Collator
7070
const SORT_STRING = 1;
7171

7272
/**
73-
* @param string $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
73+
* @param string|null $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
7474
*
7575
* @throws MethodArgumentValueNotImplementedException When $locale different than "en" or null is passed
7676
*/
@@ -84,7 +84,7 @@ public function __construct(?string $locale)
8484
/**
8585
* Static constructor.
8686
*
87-
* @param string $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
87+
* @param string|null $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
8888
*
8989
* @return self
9090
*

src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class IntlDateFormatter
118118
private $timeZoneId;
119119

120120
/**
121-
* @param string $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
121+
* @param string|null $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
122122
* @param int|null $datetype Type of date formatting, one of the format type constants
123123
* @param int|null $timetype Type of time formatting, one of the format type constants
124124
* @param \IntlTimeZone|\DateTimeZone|string|null $timezone Timezone identifier
@@ -152,7 +152,7 @@ public function __construct(?string $locale, ?int $datetype, ?int $timetype, $ti
152152
/**
153153
* Static constructor.
154154
*
155-
* @param string $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
155+
* @param string|null $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
156156
* @param int|null $datetype Type of date formatting, one of the format type constants
157157
* @param int|null $timetype Type of time formatting, one of the format type constants
158158
* @param \IntlTimeZone|\DateTimeZone|string|null $timezone Timezone identifier

src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -241,13 +241,13 @@ class NumberFormatter
241241
];
242242

243243
/**
244-
* @param string $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
245-
* @param int $style Style of the formatting, one of the format style constants.
246-
* The only supported styles are NumberFormatter::DECIMAL
247-
* and NumberFormatter::CURRENCY.
248-
* @param string $pattern Not supported. A pattern string in case $style is NumberFormat::PATTERN_DECIMAL or
249-
* NumberFormat::PATTERN_RULEBASED. It must conform to the syntax
250-
* described in the ICU DecimalFormat or ICU RuleBasedNumberFormat documentation
244+
* @param string|null $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
245+
* @param int $style Style of the formatting, one of the format style constants.
246+
* The only supported styles are NumberFormatter::DECIMAL
247+
* and NumberFormatter::CURRENCY.
248+
* @param string $pattern Not supported. A pattern string in case $style is NumberFormat::PATTERN_DECIMAL or
249+
* NumberFormat::PATTERN_RULEBASED. It must conform to the syntax
250+
* described in the ICU DecimalFormat or ICU RuleBasedNumberFormat documentation
251251
*
252252
* @see http://www.php.net/manual/en/numberformatter.create.php
253253
* @see http://www.icu-project.org/apiref/icu4c/classDecimalFormat.html#_details

src/Symfony/Component/Lock/Store/CombinedStore.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public function save(Key $key)
101101
public function waitAndSave(Key $key)
102102
{
103103
@trigger_error(sprintf('%s() is deprecated since Symfony 4.4 and will be removed in Symfony 5.0.', __METHOD__), E_USER_DEPRECATED);
104-
throw new NotSupportedException(sprintf('The store "%s" does not supports blocking locks.', \get_class($this)));
104+
throw new NotSupportedException(sprintf('The store "%s" does not support blocking locks.', \get_class($this)));
105105
}
106106

107107
/**

src/Symfony/Component/Lock/Store/MemcachedStore.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Symfony\Component\Lock\Exception\InvalidArgumentException;
1515< FB22 /td>
use Symfony\Component\Lock\Exception\InvalidTtlException;
1616
use Symfony\Component\Lock\Exception\LockConflictedException;
17+
use Symfony\Component\Lock\Exception\NotSupportedException;
1718
use Symfony\Component\Lock\Key;
1819
use Symfony\Component\Lock\StoreInterface;
1920

@@ -77,7 +78,7 @@ public function save(Key $key)
7778
public function waitAndSave(Key $key)
7879
{
7980
@trigger_error(sprintf('%s() is deprecated since Symfony 4.4 and will be removed in Symfony 5.0.', __METHOD__), E_USER_DEPRECATED);
80-
throw new InvalidArgumentException(sprintf('The store "%s" does not supports blocking locks.', \get_class($this)));
81+
throw new NotSupportedException(sprintf('The store "%s" does not support blocking locks.', \get_class($this)));
8182
}
8283

8384
/**

src/Symfony/Component/Lock/Store/RedisStore.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Symfony\Component\Lock\Exception\InvalidArgumentException;
1717
use Symfony\Component\Lock\Exception\InvalidTtlException;
1818
use Symfony\Component\Lock\Exception\LockConflictedException;
19+
use Symfony\Component\Lock\Exception\NotSupportedException;
1920
use Symfony\Component\Lock\Key;
2021
use Symfony\Component\Lock\StoreInterface;
2122

@@ -80,7 +81,7 @@ public function save(Key $key)
8081
public function waitAndSave(Key $key)
8182
{
8283
@trigger_error(sprintf('%s() is deprecated since Symfony 4.4 and will be removed in Symfony 5.0.', __METHOD__), E_USER_DEPRECATED);
83-
throw new InvalidArgumentException(sprintf('The store "%s" does not supports blocking locks.', \get_class($this)));
84+
throw new NotSupportedException(sprintf('The store "%s" does not support blocking locks.', \get_class($this)));
8485
}
8586

8687
/**

src/Symfony/Contracts/HttpClient/Test/HttpClientTestCase.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,16 @@ public function testResolv 10A6 e()
583583
$client->request('GET', 'http://symfony.com:8057/', ['timeout' => 1]);
584584
}
585585

586+
public function testNotATimeout()
587+
{
588+
$client = $this->getHttpClient(__FUNCTION__);
589+
$response = $client->request('GET', 'http://localhost:8057/timeout-header', [
590+
'timeout' => 0.5,
591+
]);
592+
usleep(510000);
593+
$this->assertSame(200, $response->getStatusCode());
594+
}
595+
586596
public function testTimeoutOnAccess()
587597
{
588598
$client = $this->getHttpClient(__FUNCTION__);

0 commit comments

Comments
 (0)
0