Fix memoization of functions called with keyset arguments
commit004a049592d950da0cbb4f9bd4c3454243493eb5
authorRick Lavoie <rlavoie@fb.com>
Sat, 10 Dec 2016 01:06:59 +0000 (9 17:06 -0800)
committerHhvm Bot <hhvm-bot-bot@fb.com>
Mon, 12 Dec 2016 21:09:22 +0000 (12 13:09 -0800)
treec3f4d0324c19ec94a3b04d61ac73c22d4ea32f41
parent36be5c6e30440119b3531ea5a4406c9565a2353b
Fix memoization of functions called with keyset arguments

Summary:
Arguments to memoized functions get converted into memoization keys
using fb_compact_serialize. Due to a bug, keysets get treated like packed arrays
during compact serialization, which means that if the keyset has no integer
values, it gets treated like an empty array. Thus calling memoized functions
with different keysets would all return the same value. Fix this by properly
encoding keysets like mixed arrays (with a key and value). While we're there,
use the new Iterate interface instead of ArrayIter.

Reviewed By: markw65

Differential Revision: D4307591

fbshipit-source-id: e9c033eac231a840544eac8ded0c608a4a892710
hphp/runtime/ext/fb/ext_fb.cpp
hphp/test/slow/dict/memoize.php [new file with mode: 0644]
hphp/test/slow/dict/memoize.php.expect [new file with mode: 0644]
hphp/test/slow/keyset/memoize.php [new file with mode: 0644]
hphp/test/slow/keyset/memoize.php.expect [new file with mode: 0644]
hphp/test/slow/vec/memoize.php [new file with mode: 0644]
hphp/test/slow/vec/memoize.php.expect [new file with mode: 0644]