Merge branch '3.4' into 4.3
* 3.4: consistently throw NotSupportException [HttpKernel] Clarify error handler restoring process again [Intl] fix nullable phpdocs and useless method visibility of internal class Resilience against file_get_contents() race conditions.
This commit is contained in:
commit
c0f416eb9d
@ -462,9 +462,8 @@ class HttpCache implements HttpKernelInterface, TerminableInterface
|
|||||||
* All backend requests (cache passes, fetches, cache validations)
|
* All backend requests (cache passes, fetches, cache validations)
|
||||||
* run through this method.
|
* run through this method.
|
||||||
*
|
*
|
||||||
* @param Request $request A Request instance
|
* @param bool $catch Whether to catch exceptions or not
|
||||||
* @param bool $catch Whether to catch exceptions or not
|
* @param Response|null $entry A Response instance (the stale entry if present, null otherwise)
|
||||||
* @param Response $entry A Response instance (the stale entry if present, null otherwise)
|
|
||||||
*
|
*
|
||||||
* @return Response A Response instance
|
* @return Response A Response instance
|
||||||
*/
|
*/
|
||||||
|
@ -354,7 +354,7 @@ class Store implements StoreInterface
|
|||||||
{
|
{
|
||||||
$path = $this->getPath($key);
|
$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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -503,10 +503,9 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->debug) {
|
if ($collectDeprecations = $this->debug && !\defined('PHPUNIT_COMPOSER_INSTALL')) {
|
||||||
$collectedLogs = [];
|
$collectedLogs = [];
|
||||||
$previousHandler = \defined('PHPUNIT_COMPOSER_INSTALL');
|
$previousHandler = set_error_handler(function ($type, $message, $file, $line) use (&$collectedLogs, &$previousHandler) {
|
||||||
$previousHandler = $previousHandler ?: set_error_handler(function ($type, $message, $file, $line) use (&$collectedLogs, &$previousHandler) {
|
|
||||||
if (E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type) {
|
if (E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type) {
|
||||||
return $previousHandler ? $previousHandler($type, $message, $file, $line) : false;
|
return $previousHandler ? $previousHandler($type, $message, $file, $line) : false;
|
||||||
}
|
}
|
||||||
@ -549,7 +548,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
|
|||||||
$container = $this->buildContainer();
|
$container = $this->buildContainer();
|
||||||
$container->compile();
|
$container->compile();
|
||||||
} finally {
|
} finally {
|
||||||
if ($this->debug && true !== $previousHandler) {
|
if ($collectDeprecations) {
|
||||||
restore_error_handler();
|
restore_error_handler();
|
||||||
|
|
||||||
file_put_contents($cacheDir.'/'.$class.'Deprecations.log', serialize(array_values($collectedLogs)));
|
file_put_contents($cacheDir.'/'.$class.'Deprecations.log', serialize(array_values($collectedLogs)));
|
||||||
|
@ -70,7 +70,7 @@ class Collator
|
|||||||
const SORT_STRING = 1;
|
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
|
* @throws MethodArgumentValueNotImplementedException When $locale different than "en" or null is passed
|
||||||
*/
|
*/
|
||||||
@ -84,7 +84,7 @@ class Collator
|
|||||||
/**
|
/**
|
||||||
* Static constructor.
|
* 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
|
* @return self
|
||||||
*
|
*
|
||||||
|
@ -118,7 +118,7 @@ class IntlDateFormatter
|
|||||||
private $timeZoneId;
|
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 $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 int|null $timetype Type of time formatting, one of the format type constants
|
||||||
* @param \IntlTimeZone|\DateTimeZone|string|null $timezone Timezone identifier
|
* @param \IntlTimeZone|\DateTimeZone|string|null $timezone Timezone identifier
|
||||||
@ -152,7 +152,7 @@ class IntlDateFormatter
|
|||||||
/**
|
/**
|
||||||
* Static constructor.
|
* 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 $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 int|null $timetype Type of time formatting, one of the format type constants
|
||||||
* @param \IntlTimeZone|\DateTimeZone|string|null $timezone Timezone identifier
|
* @param \IntlTimeZone|\DateTimeZone|string|null $timezone Timezone identifier
|
||||||
|
@ -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 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.
|
* @param int $style Style of the formatting, one of the format style constants.
|
||||||
* The only supported styles are NumberFormatter::DECIMAL
|
* The only supported styles are NumberFormatter::DECIMAL
|
||||||
* and NumberFormatter::CURRENCY.
|
* and NumberFormatter::CURRENCY.
|
||||||
* @param string $pattern Not supported. A pattern string in case $style is NumberFormat::PATTERN_DECIMAL or
|
* @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
|
* NumberFormat::PATTERN_RULEBASED. It must conform to the syntax
|
||||||
* described in the ICU DecimalFormat or ICU RuleBasedNumberFormat documentation
|
* described in the ICU DecimalFormat or ICU RuleBasedNumberFormat documentation
|
||||||
*
|
*
|
||||||
* @see http://www.php.net/manual/en/numberformatter.create.php
|
* @see http://www.php.net/manual/en/numberformatter.create.php
|
||||||
* @see http://www.icu-project.org/apiref/icu4c/classDecimalFormat.html#_details
|
* @see http://www.icu-project.org/apiref/icu4c/classDecimalFormat.html#_details
|
||||||
|
@ -94,7 +94,7 @@ class CombinedStore implements StoreInterface, LoggerAwareInterface
|
|||||||
|
|
||||||
public function waitAndSave(Key $key)
|
public function waitAndSave(Key $key)
|
||||||
{
|
{
|
||||||
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)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -13,6 +13,7 @@ namespace Symfony\Component\Lock\Store;
|
|||||||
|
|
||||||
use Symfony\Component\Lock\Exception\InvalidArgumentException;
|
use Symfony\Component\Lock\Exception\InvalidArgumentException;
|
||||||
use Symfony\Component\Lock\Exception\LockConflictedException;
|
use Symfony\Component\Lock\Exception\LockConflictedException;
|
||||||
|
use Symfony\Component\Lock\Exception\NotSupportedException;
|
||||||
use Symfony\Component\Lock\Key;
|
use Symfony\Component\Lock\Key;
|
||||||
use Symfony\Component\Lock\StoreInterface;
|
use Symfony\Component\Lock\StoreInterface;
|
||||||
|
|
||||||
@ -70,7 +71,7 @@ class MemcachedStore implements StoreInterface
|
|||||||
|
|
||||||
public function waitAndSave(Key $key)
|
public function waitAndSave(Key $key)
|
||||||
{
|
{
|
||||||
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)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -15,6 +15,7 @@ use Symfony\Component\Cache\Traits\RedisClusterProxy;
|
|||||||
use Symfony\Component\Cache\Traits\RedisProxy;
|
use Symfony\Component\Cache\Traits\RedisProxy;
|
||||||
use Symfony\Component\Lock\Exception\InvalidArgumentException;
|
use Symfony\Component\Lock\Exception\InvalidArgumentException;
|
||||||
use Symfony\Component\Lock\Exception\LockConflictedException;
|
use Symfony\Component\Lock\Exception\LockConflictedException;
|
||||||
|
use Symfony\Component\Lock\Exception\NotSupportedException;
|
||||||
use Symfony\Component\Lock\Key;
|
use Symfony\Component\Lock\Key;
|
||||||
use Symfony\Component\Lock\StoreInterface;
|
use Symfony\Component\Lock\StoreInterface;
|
||||||
|
|
||||||
@ -76,7 +77,7 @@ class RedisStore implements StoreInterface
|
|||||||
*/
|
*/
|
||||||
public function waitAndSave(Key $key)
|
public function waitAndSave(Key $key)
|
||||||
{
|
{
|
||||||
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)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user