php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70091 Phar does not mark UTF-8 filenames in ZIP archives
Submitted: 2015-07-17 06:57 UTC Modified: 2021-01-22 11:13 UTC
Votes:4
Avg. Score:3.8 ± 0.8
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: david dot vantyghem at free dot fr Assigned: cmb (profile)
Status: Closed Package: PHAR related
PHP Version: 5.5Git-2015-07-17 (Git) OS: Linux Mint MATE 17.2
Private report: No CVE-ID: None
 [2015-07-17 06:57 UTC] david dot vantyghem at free dot fr
Description:
------------
Fatal error: Uncaught exception 'BadMethodCallException' with message 'Entry Cliquez ici pour démarrer COMPILIBRE.bat cannot be created: phar error: invalid path "Cliquez ici pour démarrer COMPILIBRE.bat" contains illegal character' in /home/david/Documents/logiciels/COMPILIBRE/SourceForge Code/COMPILIBRE-source/COMPILIBRE/compilation.php:271 Stack trace: #0 /home/david/Documents/logiciels/COMPILIBRE/SourceForge Code/COMPILIBRE-source/COMPILIBRE/compilation.php(271): PharData->buildFromDirectory('compilations/1') #1 {main} thrown in /home/david/Documents/logiciels/COMPILIBRE/SourceForge Code/COMPILIBRE-source/COMPILIBRE/compilation.php on line 271

Test script:
---------------
	// Create the zip file

	$phar = new PharData("compilations/".az09_($compilation_name).".".$compilation_key.".zip");
	$phar->buildFromDirectory("compilations/".$compilation_key);

Name of the file that causes the error :
"Cliquez ici pour démarrer COMPILIBRE.bat"


Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-07-22 09:26 UTC] d dot dussouillez at 2n-tech dot com
Same here (PHP 5.6.6, linux) :
exception 'BadMethodCallException' with message 'Entry modules/Medicnet - Le sp�cialiste de la vente en ligne de mat�riel m�dical.URL cannot be created: phar error: invalid path "modules/Medicnet - Le sp�cialiste de la vente en ligne de mat�riel m�dical.URL" contains illegal character'
 [2020-12-14 14:57 UTC] cmb@php.net
Prior to PHP 5.4.29 and 5.5.13, respectively, Phar filenames could
only consist of printable ASCII characters.  As of these versions,
UTF-8 characters are supported as well, but apparently your
filenames are encoded in a different encoding (possibly
ISO-8859-1).  So far, this would be a documentation problem.  You
could still work around that by using PharData::addFromFile() or
::buildFromIterator().

However, ZIP archives traditionally store filenames encoded as CP
437, and Phar still solely supports the tradional mechanism, so
directly storing UTF-8 filenames as local names doesn't have the
desired result.  In my opion, this is an implementation bug.
 [2021-01-22 11:13 UTC] cmb@php.net
-Summary: PHAR can't make a zip when one file contain the é letter +Summary: Phar does not mark UTF-8 filenames in ZIP archives -Status: Open +Status: Verified -Assigned To: +Assigned To: cmb
 [2021-01-22 11:19 UTC] cmb@php.net
The following pull request has been associated:

Patch Name: Fix #70091: Phar does not mark UTF-8 filenames in ZIP archives
On GitHub:  https://github.com/php/php-src/pull/6630
Patch:      https://github.com/php/php-src/pull/6630.patch
 [2021-01-26 18:16 UTC] cmb@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=6a0b889f57b5f3c6b72253c0919eab10c7496263
Log: Fix #70091: Phar does not mark UTF-8 filenames in ZIP archives
 [2021-01-26 18:16 UTC] cmb@php.net
-Status: Verified +Status: Closed
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Apr 13 20:01:23 2021 UTC