|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2020-04-28 08:10 UTC] cmb@php.net
Description:
------------
The sizeof off_t is determined via the C macro SIZEOF_OFF_T which
is not defined. This causes wrong handling of off_t values on
some architectures, e.g. x86.
This issue has been found by girgias@php.net.
Test script:
---------------
// C code
void fill_array(off_t *array, size_t elems)
{
int i;
for (i = 0; i < elems; i++) {
array[i] = i;
}
}
<?php
$ffi = FFI::cdef('void fill_array(off_t *array, size_t elems);');
$array = FFI::new("off_t[3]");
$ffi->fill_array($array, 3);
var_dump($array);
?>
Expected result:
----------------
object(FFI\CData:int64_t[3])#2 (3) {
[0]=>
int(0)
[1]=>
int(1)
[2]=>
int(2)
}
Actual result:
--------------
object(FFI\CData:int32_t[3])#2 (3) {
[0]=>
int(0)
[1]=>
int(1)
[2]=>
int(2)
}
PatchesPull Requests
Pull requests:
HistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 05:00:01 2025 UTC |
Oops, I screwed up the expected and actual results. Should have been: Expected result: ---------------- object(FFI\CData:int32_t[3])#2 (3) { [0]=> int(0) [1]=> int(1) [2]=> int(2) } Actual result: -------------- object(FFI\CData:int64_t[3])#2 (3) { [0]=> int(0) [1]=> int(2) [2]=> int(0) }