File tree 2 files changed +17
-1
lines changed
src/Symfony/Component/Cache
2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -296,6 +296,15 @@ public function testWeirdDataMatchingMetadataWrappedValues()
296
296
297
297
$ this ->assertTrue ($ cache ->hasItem ('foobar ' ));
298
298
}
299
+
300
+ public function testNullByteInKey ()
301
+ {
302
+ $ cache = $ this ->createCachePool (0 , __FUNCTION__ );
303
+
304
+ $ cache ->save ($ cache ->getItem ("a \0b " )->set (123 ));
305
+
306
+ $ this ->assertSame (123 , $ cache ->getItem ("a \0b " )->get ());
307
+ }
299
308
}
300
309
301
310
class NotUnserializable
Original file line number Diff line number Diff line change @@ -54,7 +54,14 @@ protected function doFetch(array $ids)
54
54
$ unserializeCallbackHandler = ini_set ('unserialize_callback_func ' , __CLASS__ .'::handleUnserializeCallback ' );
55
55
try {
56
56
$ values = [];
57
- foreach (apcu_fetch ($ ids , $ ok ) ?: [] as $ k => $ v ) {
57
+ $ ids = array_flip ($ ids );
58
+ foreach (apcu_fetch (array_keys ($ ids )) ?: [] as $ k => $ v ) {
59
+ if (!isset ($ ids [$ k ])) {
60
+ // work around https://github.com/krakjoe/apcu/issues/247
61
+ $ k = key ($ ids );
62
+ }
63
+ unset($ keys [$ id ]);
64
+
58
65
if (null !== $ v || $ ok ) {
59
66
$ values [$ k ] = $ v ;
60
67
}
You can’t perform that action at this time.
0 commit comments