File tree Expand file tree Collapse file tree 4 files changed +34
-1
lines changed Expand file tree Collapse file tree 4 files changed +34
-1
lines changed Original file line number Diff line number Diff line change 28
28
<license >PHP 3.01</license >
29
29
<notes >
30
30
- encode parameter is optional (PHP 8)
31
+ - Fixed bug #79678 Build fails due to undeclared ZIP_RDONLY
31
32
</notes >
32
33
<contents >
33
34
<dir name =" /" >
52
53
<file name =" bug53603.phpt" role =" test" />
53
54
<file name =" bug53854.phpt" role =" test" />
54
55
<file name =" bug53885.phpt" role =" test" />
56
+ <file name =" bug53885_php8.phpt" role =" test" />
55
57
<file name =" bug64342_0.phpt" role =" test" />
56
58
<file name =" bug64342_1.phpt" role =" test" />
57
59
<file name =" bug64342_1-mb.phpt" role =" test" />
Original file line number Diff line number Diff line change @@ -1456,7 +1456,11 @@ PHP_METHOD(ZipArchive, open)
1456
1456
"Do not accept empty files as valid zip archives any longer" */
1457
1457
1458
1458
/* open for write without option to empty the archive */
1459
+ #ifdef ZIP_RDONLY
1459
1460
if ((flags & (ZIP_TRUNCATE | ZIP_RDONLY )) == 0 ) {
1461
+ #else
1462
+ if ((flags & ZIP_TRUNCATE ) == 0 ) {
1463
+ #endif
1460
1464
zend_stat_t st ;
1461
1465
1462
1466
/* exists and is empty */
Original file line number Diff line number Diff line change @@ -3,14 +3,15 @@ Bug #53885 (ZipArchive segfault with FL_UNCHANGED on empty archive)
3
3
--SKIPIF--
4
4
<?php
5
5
if (!extension_loaded ('zip ' )) die ('skip ' );
6
+ if (PHP_VERSION_ID >= 80000 ) die ('skip only for PHP < 8 ' );
6
7
?>
7
8
--FILE--
8
9
<?php
9
10
$ fname = dirname (__FILE__ )."/test53885.zip " ;
10
11
if (file_exists ($ fname )) unlink ($ fname );
11
12
touch ($ fname );
12
13
$ nx =new ZipArchive ();
13
- @ $ nx ->open ($ fname );
14
+ $ nx ->open ($ fname );
14
15
$ nx ->locateName ("a " ,ZIPARCHIVE ::FL_UNCHANGED );
15
16
$ nx ->statName ("a " ,ZIPARCHIVE ::FL_UNCHANGED );
16
17
?>
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #53885 (ZipArchive segfault with FL_UNCHANGED on empty archive)
3
+ --SKIPIF--
4
+ <?php
5
+ if (!extension_loaded ('zip ' )) die ('skip ' );
6
+ if (PHP_VERSION_ID < 80000 ) die ('skip only for PHP 8 ' );
7
+ ?>
8
+ --FILE--
9
+ <?php
10
+ $ fname = __DIR__ ."/test53885.zip " ;
11
+ if (file_exists ($ fname )) unlink ($ fname );
12
+ touch ($ fname );
13
+ $ nx =new ZipArchive ();
14
+ $ nx ->open ($ fname );
15
+ $ nx ->locateName ("a " ,ZIPARCHIVE ::FL_UNCHANGED );
16
+ $ nx ->statName ("a " ,ZIPARCHIVE ::FL_UNCHANGED );
17
+ ?>
18
+ ==DONE==
19
+ --CLEAN--
20
+ <?php
21
+ $ fname = __DIR__ ."/test53885.zip " ;
22
+ unlink ($ fname );
23
+ ?>
24
+ --EXPECTF--
25
+ Deprecated: ZipArchive::open(): Using empty file as ZipArchive is deprecated in %s
26
+ ==DONE==
You can’t perform that action at this time.
0 commit comments