1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00
Files
archived-php-src/ext/ffi/tests/nested_addr.phpt
2022-09-26 23:15:38 +02:00

24 lines
480 B
PHP

--TEST--
FFI Cannot nest FFI::addr() calls
--EXTENSIONS--
ffi
--INI--
ffi.enable=1
--FILE--
<?php
$ffi = \FFI::cdef(<<<'CPP'
typedef struct {
int8_t bar;
} Foo;
CPP);
$struct = $ffi->new('Foo');
$structPtrPtr = \FFI::addr(\FFI::addr($struct));
?>
--EXPECTF--
Fatal error: Uncaught FFI\Exception: FFI::addr() cannot create a reference to a temporary pointer in %s:%d
Stack trace:
#0 %s(%d): FFI::addr(Object(FFI\CData:struct <anonymous>*))
#1 {main}
thrown in %s on line %d