File tree 2 files changed +52
-0
lines changed
2 files changed +52
-0
lines changed Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Test mandatory locking on Windows
3
+ --EXTENSIONS--
4
+ zlib
5
+ --SKIPIF--
6
+ <?php
7
+ if (PHP_OS_FAMILY !== "Windows " ) die ("skip Only for Windows because it has mandatory locking " );
8
+ ?>
9
+ --FILE--
10
+ <?php
11
+
12
+ echo "without wrapper \n" ;
13
+ $ f = __DIR__ ."/005.txt.gz " ;
14
+ $ h = gzopen ($ f ,'r ' );
15
+ $ h2 = gzopen ($ f , 'r ' );
16
+ stream_set_chunk_size ($ h2 ,1 );
17
+
18
+ var_dump (flock ($ h , LOCK_EX ));
19
+ var_dump (fread ($ h2 , 1 ));
20
+ var_dump (fread ($ h , 1 ));
21
+
22
+ gzclose ($ h );
23
+ gzclose ($ h2 );
24
+
25
+ echo "\nwith wrapper \n" ;
26
+ $ f = "compress.zlib:// " .__DIR__ ."/005.txt.gz " ;
27
+ $ h = fopen ($ f ,'r ' );
28
+ $ h2 = fopen ($ f , 'r ' );
29
+ stream_set_chunk_size ($ h2 , 1 );
30
+
31
+ var_dump (flock ($ h , LOCK_EX ));
32
+ var_dump (fread ($ h2 , 1 ));
33
+ var_dump (fread ($ h , 1 ));
34
+
35
+ gzclose ($ h );
36
+ gzclose ($ h2 );
37
+
38
+ ?>
39
+ --EXPECTF--
40
+ without wrapper
41
+ bool(true)
42
+
43
+ Notice: fread(): Read of 1 bytes failed with errno=13 Permission denied in %s on line %d
44
+ bool(false)
45
+ string(1) "W"
46
+
47
+ with wrapper
48
+ bool(true)
49
+
50
+ Notice: fread(): Read of 1 bytes failed with errno=13 Permission denied in %s on line %d
51
+ bool(false)
52
+ string(1) "W"
You can’t perform that action at this time.
0 commit comments