Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitb14b0e1

Browse files
[Cache] Handle unserialization failures for Memcached
1 parent34d5f9e commitb14b0e1

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ trait MemcachedTrait
2626
'persistent_id' =>null,
2727
'username' =>null,
2828
'password' =>null,
29+
'serializer' =>'php',
2930
);
3031

3132
private$client;
@@ -186,15 +187,22 @@ public static function createConnection($servers, array $options = array())
186187
*/
187188
protectedfunctiondoSave(array$values,$lifetime)
188189
{
189-
return$this->checkResultCode($this->client->setMulti($values,$lifetime));
190+
return$this->checkResultCode($this->client->setMulti($serialized,$lifetime));
190191
}
191192

192193
/**
193194
* {@inheritdoc}
194195
*/
195196
protectedfunctiondoFetch(array$ids)
196197
{
197-
return$this->checkResultCode($this->client->getMulti($ids));
198+
$unserializeCallbackHandler =ini_set('unserialize_callback_func',__CLASS__.'::handleUnserializeCallback');
199+
try {
200+
return$this->checkResultCode($this->client->getMulti($ids));
201+
}catch (\Error$e) {
202+
thrownew \ErrorException($e->getMessage(),$e->getCode(),E_ERROR,$e->getFile(),$e->getLine());
203+
}finally {
204+
ini_set('unserialize_callback_func',$unserializeCallbackHandler);
205+
}
198206
}
199207

200208
/**

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp