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 fd0ddfb

Browse filesBrowse files
bug #18243 Fixed a bug: saving with not serializable values (RedisAdapter) (masterklavi)
This PR was squashed before being merged into the 3.1-dev branch (closes #18243). Discussion ---------- Fixed a bug: saving with not serializable values (RedisAdapter) | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | no | Fixed tickets | - | License | MIT | Doc PR | - Commits ------- 47f45b1 Fixed a bug: saving with not serializable values (RedisAdapter)
2 parents 83ebf97 + 47f45b1 commit fd0ddfb
Copy full SHA for fd0ddfb

File tree

Expand file treeCollapse file tree

1 file changed

+4
-3
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-3
lines changed

‎src/Symfony/Component/Cache/Adapter/RedisAdapter.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Adapter/RedisAdapter.php
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,22 +90,23 @@ protected function doDelete(array $ids)
9090
*/
9191
protected function doSave(array $values, $lifetime)
9292
{
93+
$serialized = array();
9394
$failed = array();
9495

9596
foreach ($values as $id => $v) {
9697
try {
97-
$values[$id] = serialize($v);
98+
$serialized[$id] = serialize($v);
9899
} catch (\Exception $e) {
99100
$failed[] = $id;
100101
}
101102
}
102103

103-
if (!$this->redis->mSet($values)) {
104+
if (!$this->redis->mSet($serialized)) {
104105
return false;
105106
}
106107

107108
if ($lifetime >= 1) {
108-
foreach ($values as $id => $v) {
109+
foreach ($serialized as $id => $v) {
109110
$this->redis->expire($id, $lifetime);
110111
}
111112
}

0 commit comments

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