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