forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* PHP-7.4: Fix #79532: sizeof off_t can be wrong
- Loading branch information
Showing
8 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--TEST-- | ||
Bug #79532 (sizeof off_t can be wrong) | ||
--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 | ||
void bug79532(off_t *array, size_t elems); | ||
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()); | ||
} | ||
} | ||
|
||
$array = FFI::new("off_t[3]"); | ||
$ffi->bug79532($array, 3); | ||
var_dump($array); | ||
?> | ||
--EXPECTF-- | ||
object(FFI\CData:int%d_t[3])#%d (3) { | ||
[0]=> | ||
int(0) | ||
[1]=> | ||
int(1) | ||
[2]=> | ||
int(2) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters