xref: /PHP-8.2/ext/standard/tests/file/bug81223.phpt (revision 52a00fe7)
1--TEST--
2Bug #81223 (flock() only locks first byte of file)
3--SKIPIF--
4<?php
5if (PHP_OS_FAMILY !== "Windows") die("skip for Windows only");
6?>
7--FILE--
8<?php
9$filename = __FILE__;
10$stream1 = fopen($filename, "r");
11var_dump(flock($stream1, LOCK_EX));
12$stream2 = fopen($filename, "r");
13var_dump(fread($stream2, 5));
14fseek($stream2, 1);
15var_dump(fread($stream2, 4));
16?>
17--EXPECTF--
18bool(true)
19
20Notice: fread(): Read of %d bytes failed with errno=13 Permission denied in %s on line %d
21bool(false)
22
23Notice: fread(): Read of %d bytes failed with errno=13 Permission denied in %s on line %d
24bool(false)
25