mirror of
https://github.com/php/php-src.git
synced 2024-11-23 18:04:36 +08:00
Make C functions returning "void" to return PHP "null"
In PHP-2.0 and below we by mistake returned "obcect(FFI\CData:void)#2 (0) {}". We decided not to fix this in PHP-2.0 and below to aboid BC breaks.
This commit is contained in:
parent
2abb5850ba
commit
851e4623f5
@ -2832,7 +2832,11 @@ static ZEND_FUNCTION(ffi_trampoline) /* {{{ */
|
||||
free_alloca(arg_values, arg_values_use_heap);
|
||||
}
|
||||
|
||||
zend_ffi_cdata_to_zval(NULL, ret, ZEND_FFI_TYPE(type->func.ret_type), BP_VAR_R, return_value, 0, 1, 0);
|
||||
if (ZEND_FFI_TYPE(type->func.ret_type)->kind != ZEND_FFI_TYPE_VOID) {
|
||||
zend_ffi_cdata_to_zval(NULL, ret, ZEND_FFI_TYPE(type->func.ret_type), BP_VAR_R, return_value, 0, 1, 0);
|
||||
} else {
|
||||
ZVAL_NULL(return_value);
|
||||
}
|
||||
free_alloca(ret, ret_use_heap);
|
||||
|
||||
exit:
|
||||
|
@ -20,6 +20,5 @@ var_dump($libc->strlen("abc"));
|
||||
?>
|
||||
DONE
|
||||
--EXPECT--
|
||||
object(FFI\CData:void)#2 (0) {
|
||||
}
|
||||
NULL
|
||||
DONE
|
||||
|
Loading…
Reference in New Issue
Block a user