php-src/ext/ffi/tests/bug79571.phpt
Max Semenik bd9f4fa676 Migrate skip checks to --EXTENSIONS--, p2
For rationale, see https://github.com/php/php-src/pull/6787

Make extension checks lowercase, add a special case for opcache
that has internal name not matching .so filename.

Extensions migrated in part 2:
* dom
* exif
* fileinfo
* ffi
2021-04-01 12:08:24 +01:00

33 lines
533 B
PHP

--TEST--
Bug #79571 (FFI: var_dumping unions may segfault)
--EXTENSIONS--
ffi
--SKIPIF--
<?php
if (pack('S', 0xABCD) !== pack('v', 0xABCD)) {
die('skip for little-endian architectures only');
}
?>
--FILE--
<?php
$ffi = FFI::cdef(<<<EOF
typedef union {
int num;
char *str;
} my_union;
EOF);
$union = $ffi->new('my_union');
$union->num = 42;
var_dump($union);
var_dump($union->num);
?>
--EXPECTF--
object(FFI\CData:union <anonymous>)#%d (2) {
["num"]=>
int(42)
["str"]=>
string(4) "0x2a"
}
int(42)