1--TEST-- 2FR #78270 (Usage of __vectorcall convention with FFI) 3--EXTENSIONS-- 4ffi 5zend_test 6--SKIPIF-- 7<?php 8if (substr(PHP_OS, 0, 3) != 'WIN') die("skip this test is for Windows platforms only"); 9 10require_once('utils.inc'); 11try { 12 FFI::cdef(<<<EOC 13 __vectorcall int bug78270(const char *str, size_t str_len); 14 EOC, "php_zend_test.dll"); 15} catch (FFI\ParserException $ex) { 16 die('skip __vectorcall not supported'); 17} 18?> 19--FILE-- 20<?php 21$x86 = (PHP_INT_SIZE === 4); 22$arglists = array( 23 'int, int, int, int, int, int, int' => true, 24 'double, int, int, int, int, int, int' => !$x86, 25 'int, double, int, int, int, int, int' => !$x86, 26 'int, int, double, int, int, int, int' => !$x86, 27 'int, int, int, double, int, int, int' => !$x86, 28 'int, int, int, int, double, int, int' => false, 29 'int, int, int, int, int, double, int' => false, 30 'int, int, int, int, int, int, double' => true, 31); 32foreach ($arglists as $arglist => $allowed) { 33 $signature = "__vectorcall void foobar($arglist);"; 34 try { 35 $ffi = FFI::cdef($signature); 36 } catch (FFI\ParserException $ex) { 37 if ($allowed) { 38 echo "($arglist): unexpected ParserException\n"; 39 } 40 } catch (FFI\Exception $ex) { 41 if (!$allowed) { 42 echo "($arglist): unexpected Exception\n"; 43 } 44 } 45} 46?> 47--EXPECT-- 48