Merge branch '4.0' into 4.1
* 4.0: [Lock] use 'r+' for fopen (fixes issue on Solaris) [HttpKernel] fix test compat with PHP 5.3 fix handling of nested Error instances fix file lock on SunOS [Cache] more granular handling of exceptions in AbstractTrait::clear() change `evaluate()` docblock return type from string to mixed Set serialize_precision explicitly to avoid fancy float rounding
This commit is contained in:
commit
e1f2c3c058
@ -105,22 +105,26 @@ trait AbstractTrait
|
|||||||
public function clear()
|
public function clear()
|
||||||
{
|
{
|
||||||
$this->deferred = array();
|
$this->deferred = array();
|
||||||
try {
|
if ($cleared = $this->versioningIsEnabled) {
|
||||||
if ($cleared = $this->versioningIsEnabled) {
|
$namespaceVersion = 2;
|
||||||
$namespaceVersion = 2;
|
try {
|
||||||
try {
|
foreach ($this->doFetch(array('@'.$this->namespace)) as $v) {
|
||||||
foreach ($this->doFetch(array('@'.$this->namespace)) as $v) {
|
$namespaceVersion = 1 + (int) $v;
|
||||||
$namespaceVersion = 1 + (int) $v;
|
|
||||||
}
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
}
|
|
||||||
$namespaceVersion .= ':';
|
|
||||||
$cleared = $this->doSave(array('@'.$this->namespace => $namespaceVersion), 0);
|
|
||||||
if ($cleared = true === $cleared || array() === $cleared) {
|
|
||||||
$this->namespaceVersion = $namespaceVersion;
|
|
||||||
}
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
}
|
}
|
||||||
|
$namespaceVersion .= ':';
|
||||||
|
try {
|
||||||
|
$cleared = $this->doSave(array('@'.$this->namespace => $namespaceVersion), 0);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$cleared = false;
|
||||||
|
}
|
||||||
|
if ($cleared = true === $cleared || array() === $cleared) {
|
||||||
|
$this->namespaceVersion = $namespaceVersion;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
return $this->doClear($this->namespace) || $cleared;
|
return $this->doClear($this->namespace) || $cleared;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
CacheItem::log($this->logger, 'Failed to clear the cache', array('exception' => $e));
|
CacheItem::log($this->logger, 'Failed to clear the cache', array('exception' => $e));
|
||||||
|
@ -60,7 +60,7 @@ class ExpressionLanguage
|
|||||||
* @param Expression|string $expression The expression to compile
|
* @param Expression|string $expression The expression to compile
|
||||||
* @param array $values An array of values
|
* @param array $values An array of values
|
||||||
*
|
*
|
||||||
* @return string The result of the evaluation of the expression
|
* @return mixed The result of the evaluation of the expression
|
||||||
*/
|
*/
|
||||||
public function evaluate($expression, $values = array())
|
public function evaluate($expression, $values = array())
|
||||||
{
|
{
|
||||||
|
@ -67,7 +67,7 @@ class ExceptionListener implements EventSubscriberInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$prev = new \ReflectionProperty('Exception', 'previous');
|
$prev = new \ReflectionProperty($wrapper instanceof \Exception ? \Exception::class : \Error::class, 'previous');
|
||||||
$prev->setAccessible(true);
|
$prev->setAccessible(true);
|
||||||
$prev->setValue($wrapper, $exception);
|
$prev->setValue($wrapper, $exception);
|
||||||
|
|
||||||
|
@ -79,12 +79,12 @@ class FlockStore implements StoreInterface
|
|||||||
|
|
||||||
// Silence error reporting
|
// Silence error reporting
|
||||||
set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
|
set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
|
||||||
if (!$handle = fopen($fileName, 'r')) {
|
if (!$handle = fopen($fileName, 'r+') ?: fopen($fileName, 'r')) {
|
||||||
if ($handle = fopen($fileName, 'x')) {
|
if ($handle = fopen($fileName, 'x')) {
|
||||||
chmod($fileName, 0444);
|
chmod($fileName, 0444);
|
||||||
} elseif (!$handle = fopen($fileName, 'r')) {
|
} elseif (!$handle = fopen($fileName, 'r+') ?: fopen($fileName, 'r')) {
|
||||||
usleep(100); // Give some time for chmod() to complete
|
usleep(100); // Give some time for chmod() to complete
|
||||||
$handle = fopen($fileName, 'r');
|
$handle = fopen($fileName, 'r+') ?: fopen($fileName, 'r');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
restore_error_handler();
|
restore_error_handler();
|
||||||
|
Reference in New Issue
Block a user