1--TEST-- 2Weak reference to \FFI\CData 3--EXTENSIONS-- 4ffi 5--INI-- 6ffi.enable=1 7--FILE-- 8<?php 9$cdata_value = \FFI::new('int'); 10$cdata_array = \FFI::new('int[1]'); 11$cdata_free = \FFI::new('int[1]', false); 12\FFI::free($cdata_free); 13 14$ref_value = \WeakReference::create($cdata_value); 15$ref_array = \WeakReference::create($cdata_array); 16$ref_free = \WeakReference::create($cdata_free); 17 18var_dump($ref_value->get() === $cdata_value); 19var_dump($ref_array->get() === $cdata_array); 20var_dump($ref_free->get() === $cdata_free); 21 22unset($cdata_value); 23unset($cdata_array); 24unset($cdata_free); 25 26var_dump($ref_value->get() === null); 27var_dump($ref_array->get() === null); 28var_dump($ref_free->get() === null); 29?> 30--EXPECTF-- 31bool(true) 32bool(true) 33bool(true) 34bool(true) 35bool(true) 36bool(true) 37