<?xml version="1.0"?>
<?xml-stylesheet
href="http://www.w3.org/2000/08/w3c-synd/style.css" type="text/css"
?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel rdf:about="http://pear.php.net/bugs/search.php">
    <title>PEAR Bug Search Results</title>
    <link>http://pear.php.net/bugs/search.php?cmd=display&amp;package_name%5B0%5D=File_Archive</link>
    <description>Search Results</description>
    <dc:language>en-us</dc:language>
    <dc:creator>pear-webmaster@lists.php.net</dc:creator>
    <dc:publisher>pear-webmaster@lists.php.net</dc:publisher>
    <admin:generatorAgent rdf:resource="http://pear.php.net/bugs"/>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
    <items>
     <rdf:Seq>
      <rdf:li rdf:resource="http://pear.php.net/bug/20065" />
      <rdf:li rdf:resource="http://pear.php.net/bug/20064" />
      <rdf:li rdf:resource="http://pear.php.net/bug/19105" />
      <rdf:li rdf:resource="http://pear.php.net/bug/18337" />
      <rdf:li rdf:resource="http://pear.php.net/bug/18076" />
      <rdf:li rdf:resource="http://pear.php.net/bug/17836" />
      <rdf:li rdf:resource="http://pear.php.net/bug/17330" />
      <rdf:li rdf:resource="http://pear.php.net/bug/14622" />
      <rdf:li rdf:resource="http://pear.php.net/bug/14621" />
      <rdf:li rdf:resource="http://pear.php.net/bug/14559" />
      <rdf:li rdf:resource="http://pear.php.net/bug/14547" />
      <rdf:li rdf:resource="http://pear.php.net/bug/12617" />
      <rdf:li rdf:resource="http://pear.php.net/bug/10219" />
      <rdf:li rdf:resource="http://pear.php.net/bug/10144" />
      <rdf:li rdf:resource="http://pear.php.net/bug/6546" />

     </rdf:Seq>
    </items>
  </channel>

  <image rdf:about="http://pear.php.net/gifs/pearsmall.gif">
    <title>PEAR Bugs</title>
    <url>http://pear.php.net/gifs/pearsmall.gif</url>
    <link>http://pear.php.net/bugs</link>
  </image>

    <item rdf:about="http://pear.php.net/bug/20065">
      <title>File_Archive: Bug 20065 [Open] compress directory and generated double,triple file.</title>
      <link>http://pear.php.net/bugs/20065</link>
      <content:encoded><![CDATA[<pre>File_Archive Bug
Reported by mansony
2013-09-17T12:27:51+00:00
PHP: 5.4.3 OS: debian 6.0.6 Package Version: 1.5.5

Description:
------------
/File/Archive/Reader/Directory.php

111?121

            $file = readdir($this-&gt;directoryHandle);
            if ($file == '.' || $file == '..') {
                continue;
            }
            if ($file === false) {
                return false;
            }

            if ($this-&gt;source !== null) {
                $this-&gt;source-&gt;close();
            }            


Test script:
---------------
            $file = readdir($this-&gt;directoryHandle);
            if ($file == '.' || $file == '..') {
                continue;
            }
            if ($file === false) {
                return false;
            }

            if ($this-&gt;source !== null) {
                $this-&gt;source-&gt;close();
            }            


Expected result:
----------------
I expect to generate a zip file include one directory and one file.</pre>]]></content:encoded>
      <description><![CDATA[<pre>File_Archive Bug
Reported by mansony
2013-09-17T12:27:51+00:00
PHP: 5.4.3 OS: debian 6.0.6 Package Version: 1.5.5

Description:
------------
/File/Archive/Reader/Directory.php

111?121

            $file = readdir($this-&gt;directoryHandle);
            if ($file == '.' || $file == '..') {
                continue;
            }
            if ($file === false) {
                return false;
            }

            if ($this-&gt;source !== null) {
                $this-&gt;source-&gt;close();
            }            


Test script:
---------------
            $file = readdir($this-&gt;directoryHandle);
            if ($file == '.' || $file == '..') {
                continue;
            }
            if ($file === false) {
                return false;
            }

            if ($this-&gt;source !== null) {
                $this-&gt;source-&gt;close();
            }            


Expected result:
----------------
I expect to generate a zip file include one directory and one file.</pre>]]></description>
      <dc:date>2013-09-17T12:27:51+00:00</dc:date>
      <dc:creator>anything12new14 &amp;#x61;&amp;#116; gmail &amp;#x64;&amp;#111;&amp;#x74; com</dc:creator>
      <dc:subject>File_Archive Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/20064">
      <title>File_Archive: Bug 20064 [Open] compress directory and generated double,triple file.</title>
      <link>http://pear.php.net/bugs/20064</link>
      <content:encoded><![CDATA[<pre>File_Archive Bug
Reported by mansony
2013-09-17T12:27:19+00:00
PHP: 5.4.3 OS: debian 6.0.6 Package Version: 1.5.5

Description:
------------
/File/Archive/Reader/Directory.php

111?121

            $file = readdir($this-&gt;directoryHandle);
            if ($file == '.' || $file == '..') {
                continue;
            }
            if ($file === false) {
                return false;
            }

            if ($this-&gt;source !== null) {
                $this-&gt;source-&gt;close();
            }            


Test script:
---------------
            $file = readdir($this-&gt;directoryHandle);
            if ($file == '.' || $file == '..') {
                continue;
            }
            if ($file === false) {
                return false;
            }

            if ($this-&gt;source !== null) {
                $this-&gt;source-&gt;close();
            }            


Expected result:
----------------
I expect to generate a zip file include one directory and one file.</pre>]]></content:encoded>
      <description><![CDATA[<pre>File_Archive Bug
Reported by mansony
2013-09-17T12:27:19+00:00
PHP: 5.4.3 OS: debian 6.0.6 Package Version: 1.5.5

Description:
------------
/File/Archive/Reader/Directory.php

111?121

            $file = readdir($this-&gt;directoryHandle);
            if ($file == '.' || $file == '..') {
                continue;
            }
            if ($file === false) {
                return false;
            }

            if ($this-&gt;source !== null) {
                $this-&gt;source-&gt;close();
            }            


Test script:
---------------
            $file = readdir($this-&gt;directoryHandle);
            if ($file == '.' || $file == '..') {
                continue;
            }
            if ($file === false) {
                return false;
            }

            if ($this-&gt;source !== null) {
                $this-&gt;source-&gt;close();
            }            


Expected result:
----------------
I expect to generate a zip file include one directory and one file.</pre>]]></description>
      <dc:date>2013-09-17T12:27:19+00:00</dc:date>
      <dc:creator>anything12new14 &amp;#x61;&amp;#116; gmail &amp;#x64;&amp;#111;&amp;#x74; com</dc:creator>
      <dc:subject>File_Archive Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/19105">
      <title>File_Archive: Bug 19105 [Open] Notice error in File_Archive.php</title>
      <link>http://pear.php.net/bugs/19105</link>
      <content:encoded><![CDATA[<pre>File_Archive Bug
Reported by williamlp
2011-12-07T21:33:47+00:00
PHP: 5.3.6 OS: Centos Package Version: 1.5.4

Description:
------------
Notice: Only variable references should be returned by 
reference in \File\Archive.php on line 580

An identical problem has been fixed twice in the same method 
already, e.g. http://pear.php.net/bugs/bug.php?id=7650


This is fixed by the following patch, as has been used 
elsewhere in the file:


@@ -577,7 +577,8 @@ class File_Archive
                 return $obj;
             }
         } else if (is_array($source)) {
-            return File_Archive::readMulti($source);
+            $obj = File_Archive::readMulti($source);
+            return $obj;
         } else {</pre>]]></content:encoded>
      <description><![CDATA[<pre>File_Archive Bug
Reported by williamlp
2011-12-07T21:33:47+00:00
PHP: 5.3.6 OS: Centos Package Version: 1.5.4

Description:
------------
Notice: Only variable references should be returned by 
reference in \File\Archive.php on line 580

An identical problem has been fixed twice in the same method 
already, e.g. http://pear.php.net/bugs/bug.php?id=7650


This is fixed by the following patch, as has been used 
elsewhere in the file:


@@ -577,7 +577,8 @@ class File_Archive
                 return $obj;
             }
         } else if (is_array($source)) {
-            return File_Archive::readMulti($source);
+            $obj = File_Archive::readMulti($source);
+            return $obj;
         } else {</pre>]]></description>
      <dc:date>2011-12-07T21:33:47+00:00</dc:date>
      <dc:creator>william &amp;#x61;&amp;#116; freshbooks &amp;#x64;&amp;#111;&amp;#x74; com</dc:creator>
      <dc:subject>File_Archive Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/18337">
      <title>File_Archive: Bug 18337 [Open] Call to undefined method File_Archive_Reader_ChangeName</title>
      <link>http://pear.php.net/bugs/18337</link>
      <content:encoded><![CDATA[<pre>File_Archive Bug
Reported by ocyssau
2011-03-04T22:06:22+00:00
PHP: 5.3.5 OS: Ubuntu Package Version: 1.5.4

Description:
------------
Error Call to undefined method File_Archive_Reader_ChangeName on 5.3.2-1ubuntu4.7

To solve, replace php4 constructors call (name of class in function name) by __construct(). Example :
In File/Archive/Reader/ChangeName/Directory.php, line 53, replace parent::File_Archive_Reader_ChangeName($source); by parent::__construct($source);

This error occur because function File_Archive_Reader_ChangeName is not define in File_Archive_Reader_ChangeName class


Test script:
---------------
$file = /my/file.tar
require_once 'File/Archive.php';
$result =  File_Archive::read(&quot;$file/&quot;);


Actual result:
--------------
PHP Fatal error:  Call to undefined method File_Archive_Reader_ChangeName::File_Archive_Reader_ChangeName() in /SHARES/SIER/SCRIPTS/ranchbe/lib/PEAR/File/Archive/Reader/ChangeName/Directory.php on line 53</pre>]]></content:encoded>
      <description><![CDATA[<pre>File_Archive Bug
Reported by ocyssau
2011-03-04T22:06:22+00:00
PHP: 5.3.5 OS: Ubuntu Package Version: 1.5.4

Description:
------------
Error Call to undefined method File_Archive_Reader_ChangeName on 5.3.2-1ubuntu4.7

To solve, replace php4 constructors call (name of class in function name) by __construct(). Example :
In File/Archive/Reader/ChangeName/Directory.php, line 53, replace parent::File_Archive_Reader_ChangeName($source); by parent::__construct($source);

This error occur because function File_Archive_Reader_ChangeName is not define in File_Archive_Reader_ChangeName class


Test script:
---------------
$file = /my/file.tar
require_once 'File/Archive.php';
$result =  File_Archive::read(&quot;$file/&quot;);


Actual result:
--------------
PHP Fatal error:  Call to undefined method File_Archive_Reader_ChangeName::File_Archive_Reader_ChangeName() in /SHARES/SIER/SCRIPTS/ranchbe/lib/PEAR/File/Archive/Reader/ChangeName/Directory.php on line 53</pre>]]></description>
      <dc:date>2011-03-04T22:06:22+00:00</dc:date>
      <dc:creator>olivier &amp;#x64;&amp;#111;&amp;#x74; cyssau &amp;#x61;&amp;#116; acensea &amp;#x64;&amp;#111;&amp;#x74; com</dc:creator>
      <dc:subject>File_Archive Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/18076">
      <title>File_Archive: Bug 18076 [Open] Reader select error</title>
      <link>http://pear.php.net/bugs/18076</link>
      <content:encoded><![CDATA[<pre>File_Archive Bug
Reported by vingood
2010-11-19T07:26:25+00:00
PHP: 5.2.1 OS: Windows XP Package Version: 1.5.4

Description:
------------
For example file d:/1.zip contains
2.txt
3.txt

$a=File_Archive::read('d:/1.zip/');
$a-&gt;select('2.txt'); // return false, but need true

Bug was found in 
Archive/Reader/ChangeName/Directory.php
function unmodifyName

before fix:
substr($name, strlen($this-&gt;newBaseName)+1);

after fix:
substr($name, strlen($this-&gt;newBaseName));</pre>]]></content:encoded>
      <description><![CDATA[<pre>File_Archive Bug
Reported by vingood
2010-11-19T07:26:25+00:00
PHP: 5.2.1 OS: Windows XP Package Version: 1.5.4

Description:
------------
For example file d:/1.zip contains
2.txt
3.txt

$a=File_Archive::read('d:/1.zip/');
$a-&gt;select('2.txt'); // return false, but need true

Bug was found in 
Archive/Reader/ChangeName/Directory.php
function unmodifyName

before fix:
substr($name, strlen($this-&gt;newBaseName)+1);

after fix:
substr($name, strlen($this-&gt;newBaseName));</pre>]]></description>
      <dc:date>2010-11-19T07:26:25+00:00</dc:date>
      <dc:creator>antispamer &amp;#x61;&amp;#116; gmail &amp;#x64;&amp;#111;&amp;#x74; com</dc:creator>
      <dc:subject>File_Archive Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/17836">
      <title>File_Archive: Bug 17836 [Open] Deprecated functionality (as of PHP 5.3)</title>
      <link>http://pear.php.net/bugs/17836</link>
      <content:encoded><![CDATA[<pre>File_Archive Bug
Reported by doconnor
2010-08-31T19:26:08+00:00
PHP: 5.3.2 OS:  Package Version: SVN

Description:
------------
WARNING: Function 'set_magic_quotes_runtime' is deprecated, its use is no longer recommended in file ./File_Archive/Archive/Reader/File.php line 197
WARNING: Function 'set_magic_quotes_runtime' is deprecated, its use is no longer recommended in file ./File_Archive/Archive/Reader/File.php line 201
WARNING: Function 'ereg' is deprecated, please use 'preg_match' instead in file ./File_Archive/Archive/Predicate/Ereg.php line 55
WARNING: Function 'eregi' is deprecated, please use 'preg_match' instead in file ./File_Archive/Archive/Predicate/Eregi.php line 57
WARNING: Function 'split' is deprecated, please use 'explode' or 'preg_split' instead in file ./File_Archive/Archive.php line 42</pre>]]></content:encoded>
      <description><![CDATA[<pre>File_Archive Bug
Reported by doconnor
2010-08-31T19:26:08+00:00
PHP: 5.3.2 OS:  Package Version: SVN

Description:
------------
WARNING: Function 'set_magic_quotes_runtime' is deprecated, its use is no longer recommended in file ./File_Archive/Archive/Reader/File.php line 197
WARNING: Function 'set_magic_quotes_runtime' is deprecated, its use is no longer recommended in file ./File_Archive/Archive/Reader/File.php line 201
WARNING: Function 'ereg' is deprecated, please use 'preg_match' instead in file ./File_Archive/Archive/Predicate/Ereg.php line 55
WARNING: Function 'eregi' is deprecated, please use 'preg_match' instead in file ./File_Archive/Archive/Predicate/Eregi.php line 57
WARNING: Function 'split' is deprecated, please use 'explode' or 'preg_split' instead in file ./File_Archive/Archive.php line 42</pre>]]></description>
      <dc:date>2010-09-06T18:57:43+00:00</dc:date>
      <dc:creator>daniel &amp;#x64;&amp;#111;&amp;#x74; oconnor &amp;#x61;&amp;#116; gmail &amp;#x64;&amp;#111;&amp;#x74; com</dc:creator>
      <dc:subject>File_Archive Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/17330">
      <title>File_Archive: Bug 17330 [Open] File_Archive create invalid zip file</title>
      <link>http://pear.php.net/bugs/17330</link>
      <content:encoded><![CDATA[<pre>File_Archive Bug
Reported by onjo
2010-04-21T08:46:20+00:00
PHP: 5.2.10 OS: Solaris 8 Package Version: 1.5.4

Description:
------------
File_Archive create invalid file, it seems to be caused by file's mtime.

There are no problems on i386 linux + PHP 5.2.13 + File_Archive 1.5.4.

Test script:
---------------
% diff php.ini-dist php.ini
1195a1196
&gt; mbstring.internal_encoding = SJIS-WIN
% touch -m -t 201004131354 0413.txt
% touch -m -t 201004141354 0414.txt
% cat &gt;test.php
&lt;?
require_once('File/Archive.php');
File_Archive::extract( File_Archive::read(&quot;0413.txt&quot;), File_Archive::toArchive(&quot;./0413.zip&quot;, File_Archive::toFiles() ));
File_Archive::extract( File_Archive::read(&quot;0414.txt&quot;), File_Archive::toArchive(&quot;./0414.zip&quot;, File_Archive::toFiles() ));
?&gt;
% php -c php.ini test.php

Expected result:
----------------
% zipinfo 0413.zip
Archive:  0413.zip   116 bytes   1 file
-rw----     0.0 fat       0 b- defN 13-Apr-10 13:54 0413.txt
1 file, 0 bytes uncompressed, 2 bytes compressed:  0.0%
% zipinfo 0414.zip
Archive:  0414.zip   116 bytes   1 file
-rw----     0.0 fat       0 b- defN 14-Apr-10 13:54 0414.txt
1 file, 0 bytes uncompressed, 2 bytes compressed:  0.0%


Actual result:
--------------
% zipinfo 0413.zip
Archive:  0413.zip   116 bytes   1 file
-rw----     0.0 fat       0 b- defN 13-Apr-10 29:36 0413.txt
1 file, 0 bytes uncompressed, 2 bytes compressed:  0.0%
% zipinfo 0414.zip
Archive:  0414.zip   114 bytes   1 file
-rw----     0.0 fat 134217728 b- defN 28-Jan-80 29:36

note:  didn't find end-of-central-dir signature at end of central dir.
1 file, 134217728 bytes uncompressed, 0 bytes compressed:  100.0%</pre>]]></content:encoded>
      <description><![CDATA[<pre>File_Archive Bug
Reported by onjo
2010-04-21T08:46:20+00:00
PHP: 5.2.10 OS: Solaris 8 Package Version: 1.5.4

Description:
------------
File_Archive create invalid file, it seems to be caused by file's mtime.

There are no problems on i386 linux + PHP 5.2.13 + File_Archive 1.5.4.

Test script:
---------------
% diff php.ini-dist php.ini
1195a1196
&gt; mbstring.internal_encoding = SJIS-WIN
% touch -m -t 201004131354 0413.txt
% touch -m -t 201004141354 0414.txt
% cat &gt;test.php
&lt;?
require_once('File/Archive.php');
File_Archive::extract( File_Archive::read(&quot;0413.txt&quot;), File_Archive::toArchive(&quot;./0413.zip&quot;, File_Archive::toFiles() ));
File_Archive::extract( File_Archive::read(&quot;0414.txt&quot;), File_Archive::toArchive(&quot;./0414.zip&quot;, File_Archive::toFiles() ));
?&gt;
% php -c php.ini test.php

Expected result:
----------------
% zipinfo 0413.zip
Archive:  0413.zip   116 bytes   1 file
-rw----     0.0 fat       0 b- defN 13-Apr-10 13:54 0413.txt
1 file, 0 bytes uncompressed, 2 bytes compressed:  0.0%
% zipinfo 0414.zip
Archive:  0414.zip   116 bytes   1 file
-rw----     0.0 fat       0 b- defN 14-Apr-10 13:54 0414.txt
1 file, 0 bytes uncompressed, 2 bytes compressed:  0.0%


Actual result:
--------------
% zipinfo 0413.zip
Archive:  0413.zip   116 bytes   1 file
-rw----     0.0 fat       0 b- defN 13-Apr-10 29:36 0413.txt
1 file, 0 bytes uncompressed, 2 bytes compressed:  0.0%
% zipinfo 0414.zip
Archive:  0414.zip   114 bytes   1 file
-rw----     0.0 fat 134217728 b- defN 28-Jan-80 29:36

note:  didn't find end-of-central-dir signature at end of central dir.
1 file, 134217728 bytes uncompressed, 0 bytes compressed:  100.0%</pre>]]></description>
      <dc:date>2011-11-11T19:06:29+00:00</dc:date>
      <dc:creator>onjo &amp;#x61;&amp;#116; acm &amp;#x64;&amp;#111;&amp;#x74; org</dc:creator>
      <dc:subject>File_Archive Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/14622">
      <title>File_Archive: Bug 14622 [Assigned] reading tar files with split filenames needs slash inserted</title>
      <link>http://pear.php.net/bugs/14622</link>
      <content:encoded><![CDATA[<pre>File_Archive Bug
Reported by sharoncorrell
2008-09-08T22:17:11+00:00
PHP: 5.2.5 OS: Windows XP Package Version: 1.5.4

Description:
------------
There is code in File_Archive_Writer_Tar::tarHeader to split a long filename (&gt; 100 chars) into two pieces, ie, separating the path out into a separate field. But that field is not written with a slash at the end; nor does the base part of the filename include the intervening slash. So in File_Archive_Reader_Tar::_nextAdvance, it reads the prefix (path) and prepends it on the filename, but since there is no 		slash, the filename gets messed up.

I don't know if (according to the TAR specification) the path SHOULD have the slash included or not. But regardless, if it is not there, it ought to be inserted when reading the file. Here is how I've patched it:

if ($header['magic'] == 'ustar') {
    $prefix = $header['prefix'];
    if ( strlen( $prefix ) &gt; 0
              &amp;&amp; $prefix[strlen($prefix) - 1] != &quot;/&quot; ) {
        $prefix .= &quot;/&quot;;
    }
    $this-&gt;currentFilename = $this-&gt;getStandardURL(
                                              $prefix . $header['filename']
    );
} else {
// etc.
}</pre>]]></content:encoded>
      <description><![CDATA[<pre>File_Archive Bug
Reported by sharoncorrell
2008-09-08T22:17:11+00:00
PHP: 5.2.5 OS: Windows XP Package Version: 1.5.4

Description:
------------
There is code in File_Archive_Writer_Tar::tarHeader to split a long filename (&gt; 100 chars) into two pieces, ie, separating the path out into a separate field. But that field is not written with a slash at the end; nor does the base part of the filename include the intervening slash. So in File_Archive_Reader_Tar::_nextAdvance, it reads the prefix (path) and prepends it on the filename, but since there is no 		slash, the filename gets messed up.

I don't know if (according to the TAR specification) the path SHOULD have the slash included or not. But regardless, if it is not there, it ought to be inserted when reading the file. Here is how I've patched it:

if ($header['magic'] == 'ustar') {
    $prefix = $header['prefix'];
    if ( strlen( $prefix ) &gt; 0
              &amp;&amp; $prefix[strlen($prefix) - 1] != &quot;/&quot; ) {
        $prefix .= &quot;/&quot;;
    }
    $this-&gt;currentFilename = $this-&gt;getStandardURL(
                                              $prefix . $header['filename']
    );
} else {
// etc.
}</pre>]]></description>
      <dc:date>2010-09-06T19:05:44+00:00</dc:date>
      <dc:creator>sharon_correll &amp;#x61;&amp;#116; sil &amp;#x64;&amp;#111;&amp;#x74; org</dc:creator>
      <dc:subject>File_Archive Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/14621">
      <title>File_Archive: Bug 14621 [Open] unmodifyName mangles filename</title>
      <link>http://pear.php.net/bugs/14621</link>
      <content:encoded><![CDATA[<pre>File_Archive Bug
Reported by sharoncorrell
2008-09-08T20:47:56+00:00
PHP: 5.2.5 OS: Windows XP Package Version: 1.5.4

Description:
------------
When I run Directory::unmodifyName in some circumstances, the results seem obviously incorrect. My input is:

  $this-&gt;oldBaseName = &quot;importtest.tar&quot;
  $this-&gt;newBaseName = &quot;&quot;
  $name = &quot;ssproto-data-1220394271.xml&quot;

The value returned is    &quot;importtest.tar/sproto-data-1220394271.xml&quot;. Notice that the first character of the original filename ($name = &quot;ssproto-data-1220394271.xml&quot;) has been deleted. I don't really know how to patch it because I don't understand the purpose of this code:

  substr($name, strlen($this-&gt;newBaseName)+1)

The file &quot;ssproto-data-1220394271.xml&quot; is one of the files embedded in &quot;importtest.tar&quot;. The high level code looks like this:

  $zip_reader = File_Archive::read( &quot;importtest.tar&quot; . &quot;/&quot; );
  $xml_writer = File_Archive::toVariable( $result );
  $zip_reader-&gt;extractFile(&quot;ssproto-data-1220394271.xml&quot;, $xml_writer);

The embedded file has no path information attached.</pre>]]></content:encoded>
      <description><![CDATA[<pre>File_Archive Bug
Reported by sharoncorrell
2008-09-08T20:47:56+00:00
PHP: 5.2.5 OS: Windows XP Package Version: 1.5.4

Description:
------------
When I run Directory::unmodifyName in some circumstances, the results seem obviously incorrect. My input is:

  $this-&gt;oldBaseName = &quot;importtest.tar&quot;
  $this-&gt;newBaseName = &quot;&quot;
  $name = &quot;ssproto-data-1220394271.xml&quot;

The value returned is    &quot;importtest.tar/sproto-data-1220394271.xml&quot;. Notice that the first character of the original filename ($name = &quot;ssproto-data-1220394271.xml&quot;) has been deleted. I don't really know how to patch it because I don't understand the purpose of this code:

  substr($name, strlen($this-&gt;newBaseName)+1)

The file &quot;ssproto-data-1220394271.xml&quot; is one of the files embedded in &quot;importtest.tar&quot;. The high level code looks like this:

  $zip_reader = File_Archive::read( &quot;importtest.tar&quot; . &quot;/&quot; );
  $xml_writer = File_Archive::toVariable( $result );
  $zip_reader-&gt;extractFile(&quot;ssproto-data-1220394271.xml&quot;, $xml_writer);

The embedded file has no path information attached.</pre>]]></description>
      <dc:date>2008-09-08T20:47:56+00:00</dc:date>
      <dc:creator>sharon_correll &amp;#x61;&amp;#116; sil &amp;#x64;&amp;#111;&amp;#x74; org</dc:creator>
      <dc:subject>File_Archive Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/14559">
      <title>File_Archive: Feature/Change Request 14559 [Open] Use PHP ZIP extension</title>
      <link>http://pear.php.net/bugs/14559</link>
      <content:encoded><![CDATA[<pre>File_Archive Feature/Change Request
Reported by cbrunet
2008-08-25T13:07:08+00:00
PHP: Irrelevant OS:  Package Version: 1.5.4

Description:
------------
The use of PHP ZIP extension should allow faster operations, support more ZIP compression schemes, and reduce number of bugs.</pre>]]></content:encoded>
      <description><![CDATA[<pre>File_Archive Feature/Change Request
Reported by cbrunet
2008-08-25T13:07:08+00:00
PHP: Irrelevant OS:  Package Version: 1.5.4

Description:
------------
The use of PHP ZIP extension should allow faster operations, support more ZIP compression schemes, and reduce number of bugs.</pre>]]></description>
      <dc:date>2008-08-25T13:07:08+00:00</dc:date>
      <dc:creator>charles &amp;#x64;&amp;#111;&amp;#x74; fmj &amp;#x61;&amp;#116; gmail &amp;#x64;&amp;#111;&amp;#x74; com</dc:creator>
      <dc:subject>File_Archive Feature/Change Request</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/14547">
      <title>File_Archive: Feature/Change Request 14547 [Open] Unable to create archive with an empty directory</title>
      <link>http://pear.php.net/bugs/14547</link>
      <content:encoded><![CDATA[<pre>File_Archive Feature/Change Request
Reported by wwalc
2008-08-22T19:55:05+00:00
PHP: Irrelevant OS: Win XP/SP3 Package Version: 1.5.4

Description:
------------
I need to create empty directories inside of a zip archive. However it seems that it is impossible.

I've spent quite a lot of time on trying to resolve it, I'd appreciate if anyone could tell me how to do it... it seems that it is impossible at this moment.


Test script:
---------------
//create single file in subdirectory works:
$targetFile = &quot;test.zip&quot;;
require_once &quot;File/Archive.php&quot;;
$innerWriter = File_Archive::toFiles();
$dest = File_Archive::toArchive($targetFile, $innerWriter);
$dest-&gt;newFile(&quot;path/to/subdirectory/file.txt&quot;);
$dest-&gt;writeData(&quot;test&quot;);
$dest-&gt;close();

//but create single empty directory doesn't:
$targetFile = &quot;test.zip&quot;;
require_once &quot;File/Archive.php&quot;;
$innerWriter = File_Archive::toFiles();
$dest = File_Archive::toArchive($targetFile, $innerWriter);
$dest-&gt;newFile(&quot;path/to/subdirectory/&quot;);
$dest-&gt;close();


Expected result:
----------------
create a test.zip file with an empty directory structure in it

Actual result:
--------------
empty archive</pre>]]></content:encoded>
      <description><![CDATA[<pre>File_Archive Feature/Change Request
Reported by wwalc
2008-08-22T19:55:05+00:00
PHP: Irrelevant OS: Win XP/SP3 Package Version: 1.5.4

Description:
------------
I need to create empty directories inside of a zip archive. However it seems that it is impossible.

I've spent quite a lot of time on trying to resolve it, I'd appreciate if anyone could tell me how to do it... it seems that it is impossible at this moment.


Test script:
---------------
//create single file in subdirectory works:
$targetFile = &quot;test.zip&quot;;
require_once &quot;File/Archive.php&quot;;
$innerWriter = File_Archive::toFiles();
$dest = File_Archive::toArchive($targetFile, $innerWriter);
$dest-&gt;newFile(&quot;path/to/subdirectory/file.txt&quot;);
$dest-&gt;writeData(&quot;test&quot;);
$dest-&gt;close();

//but create single empty directory doesn't:
$targetFile = &quot;test.zip&quot;;
require_once &quot;File/Archive.php&quot;;
$innerWriter = File_Archive::toFiles();
$dest = File_Archive::toArchive($targetFile, $innerWriter);
$dest-&gt;newFile(&quot;path/to/subdirectory/&quot;);
$dest-&gt;close();


Expected result:
----------------
create a test.zip file with an empty directory structure in it

Actual result:
--------------
empty archive</pre>]]></description>
      <dc:date>2008-08-22T19:55:05+00:00</dc:date>
      <dc:creator>wiktor &amp;#x61;&amp;#116; fckeditor &amp;#x64;&amp;#111;&amp;#x74; net</dc:creator>
      <dc:subject>File_Archive Feature/Change Request</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/12617">
      <title>File_Archive: Feature/Change Request 12617 [Analyzed] Incorrectly marks an archive/file as compressed when it's not</title>
      <link>http://pear.php.net/bugs/12617</link>
      <content:encoded><![CDATA[<pre>File_Archive Feature/Change Request
Reported by andersapt
2007-12-05T08:45:02+00:00
PHP: 5.2.3 OS: Windows Package Version: 1.5.3

Description:
------------
I'm trying to make an archive of jpeg files, and only want them stored, not compressed. The archive is supposed to be loaded into a Flash 9 application, with the FZip library. This library can progressivly read zip files if they're not compressed. However, the zip file created by File_Archive incorrectly states that the files are compressed, when they're  not.

Test script:
---------------
$file = &quot;test_archive.zip&quot;;

// Store test jpeg
File_Archive::setOption(&quot;zipCompressionLevel&quot;, 0);
$source = File_Archive::read('test_file.jpg',null,0,2);
$source-&gt;close();  //Move back to the begining of the source
File_Archive::extract( $source, File_Archive::toArchive( $file, File_Archive::toFiles() ) ); 

// Load to check compression level
$zip = new ZipArchive();
if( $zip-&gt;open( $file )!==true ) die( 'Could not open file '.$file );
for ($x=0; $x&lt;$zip-&gt;numFiles; $x++) echo '&lt;pre&gt;'.print_r( $zip-&gt;statIndex($x), 1).'&lt;/pre&gt;';
$zip-&gt;close();

Expected result:
----------------
I expect the value of [comp_method] from ZipArchive to be 0, not 8.

Actual result:
--------------
The value of [comp_method] is 8.</pre>]]></content:encoded>
      <description><![CDATA[<pre>File_Archive Feature/Change Request
Reported by andersapt
2007-12-05T08:45:02+00:00
PHP: 5.2.3 OS: Windows Package Version: 1.5.3

Description:
------------
I'm trying to make an archive of jpeg files, and only want them stored, not compressed. The archive is supposed to be loaded into a Flash 9 application, with the FZip library. This library can progressivly read zip files if they're not compressed. However, the zip file created by File_Archive incorrectly states that the files are compressed, when they're  not.

Test script:
---------------
$file = &quot;test_archive.zip&quot;;

// Store test jpeg
File_Archive::setOption(&quot;zipCompressionLevel&quot;, 0);
$source = File_Archive::read('test_file.jpg',null,0,2);
$source-&gt;close();  //Move back to the begining of the source
File_Archive::extract( $source, File_Archive::toArchive( $file, File_Archive::toFiles() ) ); 

// Load to check compression level
$zip = new ZipArchive();
if( $zip-&gt;open( $file )!==true ) die( 'Could not open file '.$file );
for ($x=0; $x&lt;$zip-&gt;numFiles; $x++) echo '&lt;pre&gt;'.print_r( $zip-&gt;statIndex($x), 1).'&lt;/pre&gt;';
$zip-&gt;close();

Expected result:
----------------
I expect the value of [comp_method] from ZipArchive to be 0, not 8.

Actual result:
--------------
The value of [comp_method] is 8.</pre>]]></description>
      <dc:date>2008-05-29T20:54:04+00:00</dc:date>
      <dc:creator>anders &amp;#x61;&amp;#116; apt &amp;#x64;&amp;#111;&amp;#x74; no</dc:creator>
      <dc:subject>File_Archive Feature/Change Request</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/10219">
      <title>File_Archive: Bug 10219 [Verified] Not any Archive inside an archive wont be recognises while extracting</title>
      <link>http://pear.php.net/bugs/10219</link>
      <content:encoded><![CDATA[<pre>File_Archive Bug
Reported by marius.metzler@...
2007-02-28T12:37:30+00:00
PHP: 5.0.4 OS: Windows xp Package Version: 1.5.3

Description:
------------
When I would like to read an archive's content the archives inside wont be recognised.

Having this structure:

test.zip                 // this is the archive I want to read
    test1.txt
    dontknowthename1.zip
    dontknowthename2.zip
    test2.txt


Test script:
---------------
$source=File_Archive::read(&quot;test.zip/&quot;);   // read the archive's content

$source-&gt;close();
while($source-&gt;next()) {
    echo $source-&gt;getFilename().&quot;&lt;br&gt;\n&quot;;  // output content files
}

Expected result:
----------------
test1.txt
dontknowthename1.zip
dontknowthename2.zip
test2.txt


Actual result:
--------------
test1.txt
test2.txt</pre>]]></content:encoded>
      <description><![CDATA[<pre>File_Archive Bug
Reported by marius.metzler@...
2007-02-28T12:37:30+00:00
PHP: 5.0.4 OS: Windows xp Package Version: 1.5.3

Description:
------------
When I would like to read an archive's content the archives inside wont be recognised.

Having this structure:

test.zip                 // this is the archive I want to read
    test1.txt
    dontknowthename1.zip
    dontknowthename2.zip
    test2.txt


Test script:
---------------
$source=File_Archive::read(&quot;test.zip/&quot;);   // read the archive's content

$source-&gt;close();
while($source-&gt;next()) {
    echo $source-&gt;getFilename().&quot;&lt;br&gt;\n&quot;;  // output content files
}

Expected result:
----------------
test1.txt
dontknowthename1.zip
dontknowthename2.zip
test2.txt


Actual result:
--------------
test1.txt
test2.txt</pre>]]></description>
      <dc:date>2008-06-04T19:09:43+00:00</dc:date>
      <dc:creator>marius &amp;#x64;&amp;#111;&amp;#x74; metzler &amp;#x61;&amp;#116; gmx &amp;#x64;&amp;#111;&amp;#x74; de</dc:creator>
      <dc:subject>File_Archive Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/10144">
      <title>File_Archive: Bug 10144 [Verified] long filenames are not stored correctly</title>
      <link>http://pear.php.net/bugs/10144</link>
      <content:encoded><![CDATA[<pre>File_Archive Bug
Reported by fritsch+pear.php.net@...
2007-02-21T14:31:39+00:00
PHP: Irrelevant OS: Ubuntu Package Version: 1.5.3

Description:
------------
In Writer/Tar.php it reads like this:
        $filePrefix = '';
        if (strlen($filename) &gt; 255) {
            return PEAR::raiseError(
                &quot;$filename is too long to be put in a tar archive&quot;
            );
        } else if (strlen($filename) &gt; 100) {
            $filePrefix = substr($filename, 0, strlen($filename)-100);
            $filename = substr($filename, -100);
        }

Actually (at least unix tar handles archives like that) the prefix needs to be a path-component, so that &quot;$filePrefix/$filename&quot; is the actual filename. This is not handled correctly by the above code, so it will inject a slash at strlen()-100 for the filename, resulting in really messy tarfiles.



Test script:
---------------
A solution might look like this:
        } else if (strlen($filename) &gt; 100) {
	    #need a path component of max 155 bytes
            $pos = strrpos(substr($filename, 0, 155), '/');
	    if(strlen($filename) - $pos &gt; 100) #filename-component may not exceed 100 bytes
		return PEAR::raiseError(
                	&quot;$filename is too long to be put in a tar archive&quot;
            	);
	    $filePrefix = substr($filename, 0, $pos);
            $filename = substr($filename, $pos+1);
	    echo &quot;$filePrefix vs $filename&lt;br&gt;\n&quot;;
        }</pre>]]></content:encoded>
      <description><![CDATA[<pre>File_Archive Bug
Reported by fritsch+pear.php.net@...
2007-02-21T14:31:39+00:00
PHP: Irrelevant OS: Ubuntu Package Version: 1.5.3

Description:
------------
In Writer/Tar.php it reads like this:
        $filePrefix = '';
        if (strlen($filename) &gt; 255) {
            return PEAR::raiseError(
                &quot;$filename is too long to be put in a tar archive&quot;
            );
        } else if (strlen($filename) &gt; 100) {
            $filePrefix = substr($filename, 0, strlen($filename)-100);
            $filename = substr($filename, -100);
        }

Actually (at least unix tar handles archives like that) the prefix needs to be a path-component, so that &quot;$filePrefix/$filename&quot; is the actual filename. This is not handled correctly by the above code, so it will inject a slash at strlen()-100 for the filename, resulting in really messy tarfiles.



Test script:
---------------
A solution might look like this:
        } else if (strlen($filename) &gt; 100) {
	    #need a path component of max 155 bytes
            $pos = strrpos(substr($filename, 0, 155), '/');
	    if(strlen($filename) - $pos &gt; 100) #filename-component may not exceed 100 bytes
		return PEAR::raiseError(
                	&quot;$filename is too long to be put in a tar archive&quot;
            	);
	    $filePrefix = substr($filename, 0, $pos);
            $filename = substr($filename, $pos+1);
	    echo &quot;$filePrefix vs $filename&lt;br&gt;\n&quot;;
        }</pre>]]></description>
      <dc:date>2010-09-06T19:05:29+00:00</dc:date>
      <dc:creator>fritsch+pear &amp;#x64;&amp;#111;&amp;#x74; php &amp;#x64;&amp;#111;&amp;#x74; net &amp;#x61;&amp;#116; in &amp;#x64;&amp;#111;&amp;#x74; tum &amp;#x64;&amp;#111;&amp;#x74; de</dc:creator>
      <dc:subject>File_Archive Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/6546">
      <title>File_Archive: Bug 6546 [Assigned] File added twice</title>
      <link>http://pear.php.net/bugs/6546</link>
      <content:encoded><![CDATA[<pre>File_Archive Bug
Reported by david@...
2006-01-21T17:17:33+00:00
PHP: 5.1.2 OS: Red Hat Enterprise Linux Package Version: 

Description:
------------
If you archive a directory, the first file is added to the archive twice.

Test script:
---------------
Directory /home/frame4net/public_html/downloads/cart-2 contains:

-rw-r--r--  1 apache    apache    1024 Jan 21 12:02 1mb.test-file

&lt;?php
$tmpdir = '/home/frame4net/public_html/downloads/cart-2';
File_Archive::extract($tmpdir, File_Archive::toArchive('Cart-2.zip', File_Archive::toOutput()));
?&gt;

Expected result:
----------------
The output Cart-2.zip file should only contain 1 instance of 1mb.test-file

Actual result:
--------------
There are 2 instances of 1mb.test-file both exactly the same.</pre>]]></content:encoded>
      <description><![CDATA[<pre>File_Archive Bug
Reported by david@...
2006-01-21T17:17:33+00:00
PHP: 5.1.2 OS: Red Hat Enterprise Linux Package Version: 

Description:
------------
If you archive a directory, the first file is added to the archive twice.

Test script:
---------------
Directory /home/frame4net/public_html/downloads/cart-2 contains:

-rw-r--r--  1 apache    apache    1024 Jan 21 12:02 1mb.test-file

&lt;?php
$tmpdir = '/home/frame4net/public_html/downloads/cart-2';
File_Archive::extract($tmpdir, File_Archive::toArchive('Cart-2.zip', File_Archive::toOutput()));
?&gt;

Expected result:
----------------
The output Cart-2.zip file should only contain 1 instance of 1mb.test-file

Actual result:
--------------
There are 2 instances of 1mb.test-file both exactly the same.</pre>]]></description>
      <dc:date>2007-01-17T02:29:49+00:00</dc:date>
      <dc:creator>david &amp;#x61;&amp;#116; olate &amp;#x64;&amp;#111;&amp;#x74; co &amp;#x64;&amp;#111;&amp;#x74; uk</dc:creator>
      <dc:subject>File_Archive Bug</dc:subject>
    </item>
</rdf:RDF>
