Bug #69323 [Opn->Ver]: PHP Fatal error: Uncaught exception 'PharException' with message 'unable to se

From: Date: Mon, 30 Mar 2015 01:21:44 +0000
Subject: Bug #69323 [Opn->Ver]: PHP Fatal error: Uncaught exception 'PharException' with message 'unable to se
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-191700@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69323&edit=1 ID: 69323 Updated by: danack@php.net Reported by: nazar at mokrynskyi dot com Summary: PHP Fatal error: Uncaught exception 'PharException' with message 'unable to se -Status: Open +Status: Verified Type: Bug Package: PHAR related Operating System: Ubuntu x64 PHP Version: 5.6.7 Block user comment: N Private report: N New Comment: That does seem to be an issue - it's possible with code that doesn't involve unet as well. function foo() { ini_set('display_errors', 1); file_put_contents('test', 'some content'); $phar = new Phar('build.phar'); $phar->addFile('test', 'test'); $phar->addFile('test', 'test2'); } function bar() { $phar = new Phar('build.phar'); $phar->addFile('test', 'test'); echo "ok"; } foo(); rename('build.phar', 'build2.phar'); bar(); Previous Comments: ------------------------------------------------------------------------ [2015-03-28 23:08:57] nazar at mokrynskyi dot com Description: ------------ Test script is very simple, but when I run it - I get: > PHP Fatal error: Uncaught exception 'PharException' with message 'unable to > seek to start of file Note, that if we add one file (no matter the same or different) - it works fine, it two (no matter the same or different) - it crashes with exception. My thoughts are that after unsetting $phar, file is not properly closed and there is some uncleaned cache present. I can send pull request with this test case added on GitHub. Test script: --------------- <?php ini_set('display_errors', 1); file_put_contents('test', 'some content'); $phar = new Phar('build.phar'); $phar->addFile('test', 'test'); $phar->addFile('test', 'test2'); unset($phar); rename('build.phar', 'build2.phar'); $phar = new Phar('build.phar'); $phar->addFile('test', 'test'); echo "ok"; Expected result: ---------------- ok Actual result: -------------- Fatal error: Uncaught exception 'PharException' with message 'unable to seek to start of file "test2" while creating new phar "/path/build.phar"' in /path/build.php:10 Stack trace: #0 /path/build.php(10): Phar->addFile('test', 'test') #1 {main} thrown in /path/build.php on line 10 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=69323&edit=1

« previous php.bugs (#191700) next »