php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #57718 getFromName and FL_NODIR troncate files
Submitted: 2007-06-24 15:38 UTC Modified: 2007-06-26 06:01 UTC
From: mangaii2 at yahoo dot fr Assigned: pajoye (profile)
Status: Closed Package: zip (PECL)
PHP Version: 5.1.6 OS: linux FC5
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mangaii2 at yahoo dot fr
New email:
PHP Version: OS:

 

 [2007-06-24 15:38 UTC] mangaii2 at yahoo dot fr
Description:
------------
getFromName works but the data are troncated on some caracters (ex : 0xE0 , 0xE9 ... ) when used with FL_NODIR param. 

getFromName function and FL_NODIR param troncate the file on an accentuated caracter (in text file or extended caracter on binary file [ex : jpeg] / Caracters i have tested are 0xE0 and 0xE9 ). 

getFromName only works fine ...
getFromIndex and FL_NODIR works fine ...

System description :

OS : Linux FC5
PHP : php.i386   5.1.6-1.5
ZIP : php-pecl-zip.i386   1.8.10-1.fc5

All install with YUM and standart packages.

zip create by Winrar



Reproduce code:
---------------
$zip = new ZipArchive;
$res = $zip->open('test.zip',ZIPARCHIVE::CREATE);
if ($res === TRUE)
{
    $zip->addFromString('test.txt', 'd?d?');
    $zip->close();
    $res = $zip->open('test.zip');
    if ($res === TRUE)
    {
        echo $zip->getFromName( 'test.txt', ZIPARCHIVE::FL_NODIR );
        echo '<br />';
        echo $zip->getFromName( 'test.txt' );
        echo '<br />';
        $zip->close();
    }
}

Expected result:
----------------
d?d?

Actual result:
--------------
d?

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-06-24 17:41 UTC] pierre dot php at gmail dot com
Confirmed, I can reproduce it here with latest cvs.

Thanks for the reproduce script
 [2007-06-24 17:49 UTC] pierre dot php at gmail dot com
Stupid me, it is a documentation error. Only the: ::FL_COMPRESSED and ::FL_UNCHANGED flags can be used. getFromIndex manual is correct.

I updated the docs, it will show up in the next manual build.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Apr 16 04:01:23 2021 UTC