Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ff4bb8f

Browse filesBrowse files
[Filesystem] Fix usages of error_get_last()
1 parent 40bcd77 commit ff4bb8f
Copy full SHA for ff4bb8f

File tree

2 files changed

+10
-8
lines changed
Filter options

2 files changed

+10
-8
lines changed

‎src/Symfony/Component/Cache/Traits/RedisTrait.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Traits/RedisTrait.php
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,10 @@ public static function createConnection($dsn, array $options = array())
126126
throw new InvalidArgumentException(sprintf('Redis connection failed (%s): %s', $e->getMessage(), $dsn));
127127
}
128128

129-
if (@!$redis->isConnected()) {
129+
set_error_handler('var_dump', 0);
130+
$isConnected = @$redis->isConnected();
131+
restore_error_handler();
132+
if (!$isConnected) {
130133
$e = ($e = error_get_last()) && preg_match('/^Redis::p?connect\(\): (.*)/', $e['message'], $e) ? sprintf(' (%s)', $e[1]) : '';
131134
throw new InvalidArgumentException(sprintf('Redis connection failed%s: %s', $e, $dsn));
132135
}

‎src/Symfony/Component/Lock/Store/FlockStore.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Lock/Store/FlockStore.php
+6-7Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,13 @@ private function lock(Key $key, $blocking)
7878
);
7979

8080
// Silence error reporting
81-
set_error_handler(function () {
82-
});
83-
if (!$handle = fopen($fileName, 'r')) {
84-
if ($handle = fopen($fileName, 'x')) {
85-
chmod($fileName, 0444);
86-
} elseif (!$handle = fopen($fileName, 'r')) {
81+
set_error_handler('var_dump', 0);
82+
if (!$handle = @fopen($fileName, 'r')) {
83+
if ($handle = @fopen($fileName, 'x')) {
84+
@chmod($fileName, 0444);
85+
} elseif (!$handle = @fopen($fileName, 'r')) {
8786
usleep(100); // Give some time for chmod() to complete
88-
$handle = fopen($fileName, 'r');
87+
$handle = @fopen($fileName, 'r');
8988
}
9089
}
9190
restore_error_handler();

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.