From: Greg Beaver Date: Wed, 30 Apr 2008 22:16:25 +0000 (+0000) Subject: fix Bug #13786 on unix (Steph can you verify?) X-Git-Tag: RELEASE_2_0_0b1~130 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d16f86f528f9574e43e52be5f13710248cdaa39b;p=php fix Bug #13786 on unix (Steph can you verify?) --- diff --git a/ext/phar/tests/bug13786.phpt b/ext/phar/tests/bug13786.phpt index 68c47e94a3..572d1eb9aa 100644 --- a/ext/phar/tests/bug13786.phpt +++ b/ext/phar/tests/bug13786.phpt @@ -8,6 +8,7 @@ phar.readonly=0 --FILE-- getMessage() . "\n"; +} ?> ===DONE=== ---EXPECT-- +--EXPECTF-- string(26) "file 0 in DataArchive.phar" -string(26) "file 1 in DataArchive.phar" - -Written files: 2 -===DONE=== +unable to seek to start of file "0" while creating new phar "%sDataArchive.phar" +===DONE=== \ No newline at end of file diff --git a/ext/phar/util.c b/ext/phar/util.c index 1c2d8c3213..d89de1b1be 100644 --- a/ext/phar/util.c +++ b/ext/phar/util.c @@ -104,6 +104,9 @@ int phar_seek_efp(phar_entry_info *entry, off_t offset, int whence, off_t positi php_stream *fp = phar_get_efp(entry, follow_links TSRMLS_CC); off_t temp; + if (!fp) { + return -1; + } if (follow_links) { phar_entry_info *t; t = phar_get_link_source(entry TSRMLS_CC);