php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66972 $ZipArchive->addFile() don't see phar-inside file
Submitted: 2014-03-28 15:08 UTC Modified: 2015-04-16 12:52 UTC
From: sailormax at inbox dot lv Assigned:
Status: Open Package: Zip Related
PHP Version: master-Git-2014-03-28 (Git) OS:
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2014-03-28 15:08 UTC] sailormax at inbox dot lv
Description:
------------
Looks like $ZipArchive->addFile() don't see source file, if it placed near the executed script inside PHAR.

Steps:
1. create phar-file with:
- embed.xml with any data;
- index.php with:
~~~~
$objZip = new ZipArchive();
$objZip->open("test.zip", ZIPARCHIVE::CREATE);
$objZip->addFile(dirname(__FILE__) . '/embed.xml', 'test/embed.xml');
$objZip->close();
~~~~

Exp: test.zip with embed.xml
Act: test.zip without embed.xml . addFile() return false;

Test script:
---------------
$objZip = new ZipArchive();
$objZip->open("test.zip", ZIPARCHIVE::CREATE);
$objZip->addFile(dirname(__FILE__) . '/embed.xml', 'test/embed.xml');
$objZip->close();

Expected result:
----------------
test.zip with embed.xml

Actual result:
--------------
test.zip without embed.xml . addFile() return false;

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-04-02 08:02 UTC] ab@php.net
-Status: Open +Status: Feedback
 [2014-04-02 08:02 UTC] ab@php.net
Can't reproduce. Does this work from cli for you? It only fails by a real error, like if embed.xml doesn't exits.
 [2014-04-02 20:35 UTC] sailormax at inbox dot lv
-Status: Feedback +Status: Open
 [2014-04-02 20:35 UTC] sailormax at inbox dot lv
Actually I compressed PHPWord ( https://phpword.codeplex.com ) and result has this error.
I'll retest my sample little later.

thank you.
 [2015-04-16 12:52 UTC] cmb@php.net
-Package: zip +Package: Zip Related
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Fri Dec 06 22:01:24 2019 UTC