php.net |  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 (profile)
Status: Closed Package: Zip Related
PHP Version: 5.3.4 OS: OS X 10.6
Private report: No CVE-ID: None
 [2010-12-24 10:06 UTC] brad dot froehle at gmail dot com
Description:
------------
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:
---------------
See http://drupal.org/node/1006302#comment-3864102

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.
Array
(
    [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
        )

)
Array
(
    [file] => 
/Applications/MAMP/htdocs/drupal/modules/system/system.archiver.inc
    [line] => 113
    [function] => extractTo
    [class] => ZipArchive
    [object] => ZipArchive Object
        (
            [status] => 0
            [statusSys] => 0
            [numFiles] => 41
            [filename] => /Applications/MAMP/tmp/php/update-cache/apachesolr-
7.x-1.x-dev.zip
            [comment] => 
        )

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

)


Patches

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

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-12-24 23:38 UTC] cataphract@php.net
Automatic comment from SVN on behalf of cataphract
Revision: http://svn.php.net/viewvc/?view=revision&revision=306627
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
#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.
 [2010-12-24 23:40 UTC] cataphract@php.net
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] cataphract@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cataphract
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 12:01:29 2024 UTC