[PEAR-BUG] Bug #16481 [Opn->WFx]: Wrong way of getting directory listing

[email protected]
Newsgroups php.pear.bugs
Message-ID <[email protected]>
Edit report at http://pear.php.net/bugs/bug.php?id=16481&edit=1

 ID:               16481
 Updated by:       [email protected]
 Reported By:      kamazee at gmail dot com
 Summary:          Wrong way of getting directory listing
-Status:           Open
+Status:           Wont fix
 Type:             Bug
 Package:          Archive_Zip
 Operating System: Debian
 Package Version:  0.1.1
 PHP Version:      5.3.0
 Roadmap Versions: 
 New Comment:

-Status: Open
+Status: Wont fix
Thanks for the fix Alex; but this one is unfortunately a wontfix - the
zip extension 
does a much better job and has superceeded this package.


Previous Comments:
------------------------------------------------------------------------

[2009-07-30 12:47:53] kamazee

Description:
------------
Just for crazy people who still using this lib.
(Lines from 1209)
$p_hdir = opendir($p_filename);
$p_hitem = readdir($p_hdir); // '.' directory
$p_hitem = readdir($p_hdir); // '..' directory
while ($p_hitem = readdir($p_hdir))
{

'.' and '..' are not always above the real files in listing. So we get
an infinitive cycle.
If there is a file named like '0' the rest of files won't be listed at
all.

Solution.
Replace the piece of code above with the following:

$p_hdir = opendir($p_filename);
        
while (FALSE !== ($p_hitem = readdir($p_hdir)))
{
        if($p_hitem === '.' OR $p_hitem === '..')
          	continue;

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


-- 
Edit this bug report at http://pear.php.net/bugs/bug.php?id=16481&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.