Skip to content

Commit e2def5f

Browse files
[Cache] Fix Memcached options handling
1 parent 4baf968 commit e2def5f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/Symfony/Component/Cache/Traits/MemcachedTrait.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,14 @@ public static function createConnection($servers, array $options = array())
141141
if (is_int($name)) {
142142
continue;
143143
}
144+
unset($options[$name]);
145+
144146
if ('HASH' === $name || 'SERIALIZER' === $name || 'DISTRIBUTION' === $name) {
145147
$value = constant('Memcached::'.$name.'_'.strtoupper($value));
146148
}
147-
$opt = constant('Memcached::OPT_'.$name);
148-
149-
unset($options[$name]);
150-
$options[$opt] = $value;
149+
if (defined('Memcached::OPT_'.$name)) {
150+
$options[constant('Memcached::OPT_'.$name)] = $value;
151+
}
151152
}
152153
$client->setOptions($options);
153154

0 commit comments

Comments
 (0)