php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48791 open office files always reported as corrupted
Submitted: 2009-07-03 17:51 UTC Modified: 2009-08-02 22:20 UTC
From: RalfBecker at outdoor-training dot de Assigned: cellog (profile)
Status: Closed Package: PHAR related
PHP Version: 5.3.0 OS: CentOS5.3
Private report: No CVE-ID: None
 [2009-07-03 17:51 UTC] RalfBecker at outdoor-training dot de
Description:
------------
If I try to read content.xml of an odt file (just a few lines, tried several files, created with different odt version on different plattforms), it always fails with error message the zip file is corrupted. Open Office itself, unzip or kde's ark can read it without problem. So I think the problem is related the zip implementation in phar.
I get the same result with php5.2.9 under openSUSE11.0.
Reading the directory with:
   php -r "print_r(scandir('phar://test.odt/'));" 
shows the files and gives no error or warning.

Reproduce code:
---------------
php -r "echo file_get_contents('phar://test.odt/content.xml');"

Expected result:
----------------
xml of odt content

Actual result:
--------------
PHP Warning:  file_get_contents(phar://test.odt/content.xml): failed to open stream: phar error: internal corruption of zip-based phar "/root/test.odt" (local header of file "content.xml" does not match central directory) in Command line code on line 1

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-07-03 18:02 UTC] pajoye@php.net
duplicate #48763
 [2009-07-03 18:02 UTC] pajoye@php.net
oops, no :)
 [2009-07-04 05:46 UTC] cellog@php.net
please provide a link to an actual odt file that fails which I can use in a test case to reproduce the problem (no GPL things in it please)
 [2009-07-04 08:24 UTC] RalfBecker at outdoor-training dot de
Here's my test file: https://pole.outdoor-training.de/test.odt
Thought so far I was not able to produce an oo3 file, which can be read with phar.
Thanks for looking into it :-)
Ralf
 [2009-07-23 16:30 UTC] svn@php.net
Automatic comment from SVN on behalf of cellog
Revision: http://svn.php.net/viewvc/?view=revision&revision=284658
Log: fix PHP bug #48791: open office files always reported as corrupted
 [2009-07-23 16:30 UTC] cellog@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/

this is a fascinating issue - the fix was implementing the data descriptor part of the zip standard.  I didn't think anyone actually used that in modern ZIP implementations, since it is designed for creating streamed zip files, but I guess I was wrong.

:)
 [2009-07-31 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 02:01:28 2024 UTC