Skip to content

PharData archive created with Phar::Zip format does not keep files metadata (datetime) #10766

Closed
@franck-paul

Description

@franck-paul

Description

Having a file created this day (2023-03-03) named myfile.txt in /tmp directory.

The following code:

<?php
$a = new \PharData('/tmp/archive.zip', \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::UNIX_PATHS, null, \Phar::ZIP);
$a->addFile('/tmp/myfile.txt', 'name');

$b = new \PharData('/tmp/archive.tar', \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::UNIX_PATHS, null, \Phar::TAR);
$b->addFile('/tmp/myfile.txt', 'name');

Resulted in this output (uncompress '/tmp/archive.zip' archive):

name 1980-01-01

But I expected this output instead (uncompress '/tmp/archive.tar' archive):

name 2023-03-03

PHP Version

PHP 8.2.0

Operating System

MacOS 13.2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions