We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent dadc222 commit 632e88aCopy full SHA for 632e88a
1 file changed
ext/zip/tests/gh21698.phpt
@@ -0,0 +1,21 @@
1
+--TEST--
2
+GH-21698 (ZipArchive::addGlob memory leak when open_basedir rejects the match)
3
+--EXTENSIONS--
4
+zip
5
+--FILE--
6
+<?php
7
+$zipfile = __DIR__ . '/gh21698.zip';
8
+$zip = new ZipArchive();
9
+$zip->open($zipfile, ZipArchive::CREATE | ZipArchive::OVERWRITE);
10
+
11
+ini_set('open_basedir', '/nonexistent_dir_for_gh21698');
12
+var_dump($zip->addGlob(__FILE__, 0, []));
13
+$zip->close();
14
+?>
15
+--CLEAN--
16
17
+@unlink(__DIR__ . '/gh21698.zip');
18
19
+--EXPECTF--
20
+Warning: ZipArchive::addGlob(): open_basedir restriction in effect. File(%s) is not within the allowed path(s): (%s) in %s on line %d
21
+bool(false)
0 commit comments