1--TEST-- 2FFI 045: FFI::isNull() 3--EXTENSIONS-- 4ffi 5--INI-- 6ffi.enable=1 7--FILE-- 8<?php 9var_dump(FFI::isNull(FFI::cdef()->new("int*"))); 10$i = FFI::cdef()->new("int"); 11var_dump(FFI::isNull(FFI::addr($i))); 12try { 13 var_dump(FFI::isNull(null)); 14} catch (Throwable $e) { 15 echo get_class($e) . ": " . $e->getMessage()."\n"; 16} 17try { 18 var_dump(FFI::isNull(FFI::cdef()->new("int[0]"))); 19} catch (Throwable $e) { 20 echo get_class($e) . ": " . $e->getMessage()."\n"; 21} 22?> 23--EXPECT-- 24bool(true) 25bool(false) 26TypeError: FFI::isNull(): Argument #1 ($ptr) must be of type FFI\CData, null given 27FFI\Exception: Cannot instantiate FFI\CData of zero size 28