|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2017-02-22 22:41 UTC] jlesueur at bamboohr dot com
Description:
------------
The test script creates a test directory, and 5 text files inside. It then uses loads those files into a PharData file, compresses it, and extracts to a "dest" directory. In php 7.0.15, the files had the correct contents, in 7.0.16, the files in "dest" are empty.
Test script:
---------------
<?php
`rm -rf test`;
mkdir('test');
file_put_contents('test/1.txt', str_repeat('h', 10000));
file_put_contents('test/2.txt', str_repeat('e', 10000));
file_put_contents('test/3.txt', str_repeat('l', 10000));
file_put_contents('test/4.txt', str_repeat('l', 10000));
file_put_contents('test/5.txt', str_repeat('o', 10000));
$phar = new PharData('test.tar');
$phar->buildFromDirectory('test');
$compPhar = $phar->compress(Phar::GZ);
unset($phar); //make sure that test.tar is closed
unlink('test.tar');
unset($compPhar); //make sure that test.tar.gz is closed
$extractingPhar = new PharData('test.tar.gz');
$extractingPhar->extractTo('dest');
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 12:00:01 2025 UTC |
If I understand correctly, the problem is that because the phar is not aliased, it closes the file handle prematurely? Previous versions would have left the file pointer open. Does the line $extractingPhar = new PharData('test.tar.gz'); try to reuse an existing Phar resource, and get the closed file pointer, and not reopen it?