1
0
mirror of https://github.com/php/php-src.git synced 2026-04-18 05:21:02 +02:00
Files
archived-php-src/ext/ffi/tests/bug79096.phpt
Nikita Popov dbe5725ff3 Rename zend-test to zend_test
The extension name should match the name of the ext/ directory,
otherwise it will not get picked up by run-tests. It would be possible
to remap this in run-tests, but I think it's better to rename the
extension to follow the standard format. Other extensions also
use underscore instead of hyphen (e.g. pdo_mysql and not pdo-mysql).
Of course, the ./configure option remains hyphenated.

Closes GH-6613.
2021-01-19 15:28:15 +01:00

40 lines
761 B
PHP

--TEST--
Bug #79096 (FFI Struct Segfault)
--SKIPIF--
<?php
if (!extension_loaded('ffi')) die('skip ffi extension not available');
if (!extension_loaded('zend_test')) die('skip zend_test extension not available');
?>
--FILE--
<?php
require_once('utils.inc');
$header = <<<HEADER
struct bug79096 {
uint64_t a;
uint64_t b;
};
struct bug79096 bug79096(void);
HEADER;
if (PHP_OS_FAMILY !== 'Windows') {
$ffi = FFI::cdef($header);
} else {
try {
$ffi = FFI::cdef($header, 'php_zend_test.dll');
} catch (FFI\Exception $ex) {
$ffi = FFI::cdef($header, ffi_get_php_dll_name());
}
}
$struct = $ffi->bug79096();
var_dump($struct);
?>
--EXPECTF--
object(FFI\CData:struct bug79096)#%d (2) {
["a"]=>
int(1)
["b"]=>
int(1)
}