|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53603 ZipArchive should quiet stat errors
Submitted: 2010-12-24 10:06 UTC Modified: 2010-12-24 23:40 UTC
From: brad dot froehle at gmail dot com Assigned: cataphract
Status: Closed Package: Zip Related
PHP Version: 5.3.4 OS: OS X 10.6
Private report: No CVE-ID:
 [2010-12-24 10:06 UTC] brad dot froehle at gmail dot com
ZipArchive::php_zip_extract_file and ZipArchive::extractTo call 
php_stream_stat_path to determine if a specific directory exists.  Since it 
doesn't set STREAM_URL_STAT_QUIET, warnings may be emitted in the stream's 
implementation of url_stat.  Because we are only checking for the existence of a 
directory, these warnings should be silenced.

Test script:

Warnings are emitted in a stream's implementation of url_stat when called from ZipArchive::extractTo.

Expected result:
No warnings should appear.

Actual result:
Backtrace of PHP warnings.  Only the two calls are shown.
    [function] => url_stat
    [class] => DrupalLocalStreamWrapper
    [object] => DrupalTemporaryStreamWrapper Object
            [context] => 
            [handle] => 
            [uri:protected] => temporary://update-extraction/apachesolr/

    [type] => ->
    [args] => Array
            [0] => temporary://update-extraction/apachesolr/
            [1] => 0

    [file] => 
    [line] => 113
    [function] => extractTo
    [class] => ZipArchive
    [object] => ZipArchive Object
            [status] => 0
            [statusSys] => 0
            [numFiles] => 41
            [filename] => /Applications/MAMP/tmp/php/update-cache/apachesolr-
            [comment] => 

    [type] => ->
    [args] => Array
            [0] => temporary://update-extraction



zip-quiet-stat-warnings (last revision 2010-12-24 09:07 UTC) by brad dot froehle at gmail dot com)

Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-12-24 23:38 UTC]
Automatic comment from SVN on behalf of cataphract
Log: - 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
#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
 [2010-12-24 23:40 UTC]
Fixed in SVN, but you should probably also fix the url_stat of the stream wrapper to not emit messages when a file doesn't exist (since this is the behavior with the plain wrapper).
 [2010-12-24 23:40 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: cataphract
PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Thu Nov 26 01:01:34 2015 UTC