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

From: Date: Fri, 22 Jan 2021 11:13:58 +0000
Subject: Bug #70091 [Opn->Ver]: Phar does not mark UTF-8 filenames in ZIP archives
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-231706@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 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
 Type:               Bug
 Package:            PHAR related
 Operating System:   Linux Mint MATE 17.2
 PHP Version:        5.5Git-2015-07-17 (Git)
-Assigned To:        
+Assigned To:        cmb
 Block user comment: N
 Private report:     N



Previous Comments:
------------------------------------------------------------------------
[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 (#231706) next »