1--TEST-- 2Using FFI Types for keys of a WeakMap 3--EXTENSIONS-- 4ffi 5--INI-- 6ffi.enable=1 7--FILE-- 8<?php 9$map = new WeakMap(); 10 11$ffi = \FFI::cdef(''); 12$cdata_value = \FFI::new('int'); 13$cdata_array = \FFI::new('int[1]'); 14$cdata_free = \FFI::new('int[1]', false); 15\FFI::free($cdata_free); 16$ctype = \FFI::type('int'); 17 18$map[$ffi] = 'ffi'; 19$map[$cdata_value] = 'cdata_value'; 20$map[$cdata_array] = 'cdata_array'; 21$map[$cdata_free] = 'cdata_free'; 22$map[$ctype] = 'ctype'; 23 24var_dump(count($map) === 5); 25 26unset($ffi); 27unset($cdata_value); 28unset($cdata_array); 29unset($cdata_free); 30unset($ctype); 31 32var_dump(count($map) === 0); 33?> 34--EXPECTF-- 35bool(true) 36bool(true) 37