1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/ext/zlib/tests/zlib_lock_mandatory_windows.phpt
Gina Peter Banyard 5bd18e3fdc ext/zlib: Refactor tests (#18887)
- Use INI sections
- Use CGI sections
- Move data into a subfolder
- Remove ZPP tests
- Fix various bugs within tests
- Simplify some


Found while working on #18879
2025-06-21 18:03:50 +01:00

53 lines
983 B
PHP

--TEST--
Test mandatory locking on Windows
--EXTENSIONS--
zlib
--SKIPIF--
<?php
if (PHP_OS_FAMILY !== "Windows") die("skip Only for Windows because it has mandatory locking");
?>
--FILE--
<?php
echo "without wrapper\n";
$f = __DIR__."/data/windows-test.txt.gz";
$h = gzopen($f,'r');
$h2 = gzopen($f, 'r');
stream_set_chunk_size($h2,1);
var_dump(flock($h, LOCK_EX));
var_dump(fread($h2, 1));
var_dump(fread($h, 1));
gzclose($h);
gzclose($h2);
echo "\nwith wrapper\n";
$f2 = "compress.zlib://".$f;
$h = fopen($f2,'r');
$h2 = fopen($f2, 'r');
stream_set_chunk_size($h2, 1);
var_dump(flock($h, LOCK_EX));
var_dump(fread($h2, 1));
var_dump(fread($h, 1));
gzclose($h);
gzclose($h2);
?>
--EXPECTF--
without wrapper
bool(true)
Notice: fread(): Read of 1 bytes failed with errno=13 Permission denied in %s on line %d
bool(false)
string(1) "W"
with wrapper
bool(true)
Notice: fread(): Read of 1 bytes failed with errno=13 Permission denied in %s on line %d
bool(false)
string(1) "W"