--TEST-- PHPC-531: Segfault due to double free by corrupt BSON visitor (top-level) --FILE-- "world"]); $bson[4] = 1; echo throws(function() use ($bson) { toPHP($bson); }, 'MongoDB\Driver\Exception\UnexpectedValueException'), "\n"; ?> ===DONE=== --EXPECT-- OK: Got MongoDB\Driver\Exception\UnexpectedValueException Detected unknown BSON type 0x31 for field path "hello". Are you using the latest driver? ===DONE===