@@ -33,10 +33,26 @@ if (!$zip->addGlob($dirname . 'foo.*', GLOB_BRACE, $options)) {
3333$ options = [
3434 'remove_all_path ' => true ,
3535 'comp_method ' => ZipArchive::CM_STORE ,
36- 'comp_flags ' => 5 ,
36+ 'comp_flags ' => PHP_INT_MIN ,
3737 'enc_method ' => ZipArchive::EM_AES_256 ,
3838 'enc_password ' => 'secret ' ,
3939];
40+
41+ try {
42+ $ zip ->addGlob ($ dirname . 'bar.* ' , GLOB_BRACE , $ options );
43+ } catch (\ValueError $ e ) {
44+ echo $ e ->getMessage (), PHP_EOL ;
45+ }
46+
47+ $ options ['comp_flags ' ] = 65536 ;
48+
49+ try {
50+ $ zip ->addGlob ($ dirname . 'bar.* ' , GLOB_BRACE , $ options );
51+ } catch (\ValueError $ e ) {
52+ echo $ e ->getMessage (), PHP_EOL ;
53+ }
54+
55+ $ options ['comp_flags ' ] = 5 ;
4056if (!$ zip ->addGlob ($ dirname . 'bar.* ' , GLOB_BRACE , $ options )) {
4157 echo "failed 2 \n" ;
4258}
@@ -61,6 +77,9 @@ $dirname = __DIR__ . '/';
6177include $ dirname . 'utils.inc ' ;
6278rmdir_rf (__DIR__ . '/__tmp_oo_addglob2/ ' );
6379?>
64- --EXPECT--
80+ --EXPECTF--
81+ Warning: ZipArchive::addGlob(): Option "comp_flags" must be between 0 and 65535 in %s on line %d
82+
83+ Warning: ZipArchive::addGlob(): Option "comp_flags" must be between 0 and 65535 in %s on line %d
65840: foo.txt, comp=8, enc=0
66851: bar.txt, comp=0, enc=259
0 commit comments