mirror of
https://github.com/php/php-src.git
synced 2024-11-24 10:24:11 +08:00
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4: Fix #81223: flock() only locks first byte of file
This commit is contained in:
commit
d776413f0b
3
NEWS
3
NEWS
@ -32,6 +32,9 @@ PHP NEWS
|
|||||||
. Fixed bug #81208 (Segmentation fault while create newInstance from
|
. Fixed bug #81208 (Segmentation fault while create newInstance from
|
||||||
attribute). (Nikita)
|
attribute). (Nikita)
|
||||||
|
|
||||||
|
- Standard:
|
||||||
|
. Fixed bug #81223 (flock() only locks first byte of file). (cmb)
|
||||||
|
|
||||||
17 Jun 2021, PHP 8.0.8
|
17 Jun 2021, PHP 8.0.8
|
||||||
|
|
||||||
- Core:
|
- Core:
|
||||||
|
@ -103,7 +103,7 @@ PHPAPI int php_flock(int fd, int operation)
|
|||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
HANDLE hdl = (HANDLE) _get_osfhandle(fd);
|
HANDLE hdl = (HANDLE) _get_osfhandle(fd);
|
||||||
DWORD low = 1, high = 0;
|
DWORD low = 0xFFFFFFFF, high = 0xFFFFFFFF;
|
||||||
OVERLAPPED offset =
|
OVERLAPPED offset =
|
||||||
{0, 0, 0, 0, NULL};
|
{0, 0, 0, 0, NULL};
|
||||||
DWORD err;
|
DWORD err;
|
||||||
|
24
ext/standard/tests/file/bug81223.phpt
Normal file
24
ext/standard/tests/file/bug81223.phpt
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
--TEST--
|
||||||
|
Bug #81223 (flock() only locks first byte of file)
|
||||||
|
--SKIPIF--
|
||||||
|
<?php
|
||||||
|
if (PHP_OS_FAMILY !== "Windows") die("skip for Windows only");
|
||||||
|
?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
$filename = __FILE__;
|
||||||
|
$stream1 = fopen($filename, "r");
|
||||||
|
var_dump(flock($stream1, LOCK_EX));
|
||||||
|
$stream2 = fopen($filename, "r");
|
||||||
|
var_dump(fread($stream2, 5));
|
||||||
|
fseek($stream2, 1);
|
||||||
|
var_dump(fread($stream2, 4));
|
||||||
|
?>
|
||||||
|
--EXPECTF--
|
||||||
|
bool(true)
|
||||||
|
|
||||||
|
Notice: fread(): read of %d bytes failed with errno=13 Permission denied in %s on line %d
|
||||||
|
bool(false)
|
||||||
|
|
||||||
|
Notice: fread(): read of %d bytes failed with errno=13 Permission denied in %s on line %d
|
||||||
|
bool(false)
|
Loading…
Reference in New Issue
Block a user