-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Fixed bug #53603 (ZipArchive should quiet stat errors).
#It is unclear if url_stat handlers should emit a warning in case #PHP_STREAM_URL_STAT_QUIET is not specified and the resource does #not exist. Most url_stat handlers never emit messages; the plain #one does only so in the extraordinary event of an open_basedir #restriction. #But in case, php_stat uses PHP_STREAM_URL_STAT_QUIET for the #FS_EXISTS, which suggests that mere checks on file existence are #supposed to use this flag (arguably). #The downside is that important diagnostic messages might be #omitted.
- Loading branch information
1 parent
3143828
commit 44d0082
Showing
2 changed files
with
40 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--TEST-- | ||
Bug #53603 (ZipArchive should quiet stat errors) | ||
--SKIPIF-- | ||
<?php | ||
if(!extension_loaded('zip')) die('skip'); | ||
?> | ||
--FILE-- | ||
<?php | ||
|
||
class TestStream { | ||
function url_stat($path, $flags) { | ||
if (!($flags & STREAM_URL_STAT_QUIET)) | ||
trigger_error("not quiet"); | ||
return array(); | ||
} | ||
} | ||
|
||
stream_wrapper_register("teststream", "TestStream"); | ||
|
||
$dirname = dirname(__FILE__) . '/'; | ||
$file = $dirname . 'test_with_comment.zip'; | ||
$zip = new ZipArchive; | ||
if ($zip->open($file) !== TRUE) { | ||
echo "open failed.\n"; | ||
exit('failed'); | ||
} | ||
|
||
$a = $zip->extractTo('teststream://test'); | ||
var_dump($a); | ||
|
||
--EXPECTF-- | ||
Warning: ZipArchive::extractTo(teststream://test/foo): failed to open stream: "TestStream::stream_open" call failed in %s on line %d | ||
|
||
Warning: ZipArchive::extractTo(teststream://test/bar): failed to open stream: "TestStream::stream_open" call failed in %s on line %d | ||
|
||
Warning: ZipArchive::extractTo(teststream://test/foobar/baz): failed to open stream: "TestStream::stream_open" call failed in %s on line %d | ||
bool(true) | ||
|