mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
On Linux, these two character devices are exceptions in that they can be seeked. Check their major/minor device number. Co-authored-by: divinity76 <hans@loltek.net>
23 lines
428 B
PHP
23 lines
428 B
PHP
--TEST--
|
|
GH-19570 (unable to fseek in /dev/zero and /dev/null)
|
|
--SKIPIF--
|
|
<?php
|
|
if (PHP_OS_FAMILY !== "Linux") die("skip only for Linux");
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
$devices = [
|
|
// Note: could test others but they're not necessarily available
|
|
"/dev/zero",
|
|
"/dev/null",
|
|
"/dev/full",
|
|
];
|
|
foreach ($devices as $device) {
|
|
var_dump(fseek(fopen($device, "rb"), 1*1024*1024, SEEK_SET));
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
int(0)
|
|
int(0)
|
|
int(0)
|