Bug #70091 [Ver->Csd]: Phar does not mark UTF-8 filenames in ZIP archives

From: Date: Tue, 26 Jan 2021 18:16:56 +0000
Subject: Bug #70091 [Ver->Csd]: Phar does not mark UTF-8 filenames in ZIP archives
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-231786@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70091&edit=1

 ID:                 70091
 Updated by:         cmb@php.net
 Reported by:        david dot vantyghem at free dot fr
 Summary:            Phar does not mark UTF-8 filenames in ZIP archives
-Status:             Verified
+Status:             Closed
 Type:               Bug
 Package:            PHAR related
 Operating System:   Linux Mint MATE 17.2
 PHP Version:        5.5Git-2015-07-17 (Git)
 Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

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


Previous Comments:
------------------------------------------------------------------------
[2021-01-22 11:19:10] 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

------------------------------------------------------------------------
[2020-12-14 14:57:21] 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.

------------------------------------------------------------------------
[2015-07-22 09:26:32] 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'

------------------------------------------------------------------------
[2015-07-17 06:57:35] 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"



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=70091&edit=1


Thread (6 messages)

« previous php.bugs (#231786) next »