Bug #53603 [Opn->Csd]: ZipArchive should quiet stat errors

From: Date: Fri, 24 Dec 2010 22:40:13 +0000
Subject: Bug #53603 [Opn->Csd]: ZipArchive should quiet stat errors
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-157309@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=53603&edit=1

 ID:                 53603
 Updated by:         cataphract@php.net
 Reported by:        brad dot froehle at gmail dot com
 Summary:            ZipArchive should quiet stat errors
-Status:             Open
+Status:             Closed
 Type:               Bug
 Package:            Zip Related
 Operating System:   OS X 10.6
 PHP Version:        5.3.4
-Assigned To:        
+Assigned To:        cataphract
 Block user comment: N
 Private report:     N



Previous Comments:
------------------------------------------------------------------------
[2010-12-24 23:40:02] 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:38:38] 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 10:06:26] 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
        )

)



------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=53603&edit=1


Thread (3 messages)

« previous php.bugs (#157309) next »