]> granicus.if.org Git - php/commitdiff
fix Bug #13786 on unix (Steph can you verify?)
authorGreg Beaver <cellog@php.net>
Wed, 30 Apr 2008 22:16:25 +0000 (22:16 +0000)
committerGreg Beaver <cellog@php.net>
Wed, 30 Apr 2008 22:16:25 +0000 (22:16 +0000)
ext/phar/tests/bug13786.phpt
ext/phar/util.c

index 68c47e94a3a810c25842acbea79877d458de95bc..572d1eb9aa70852cf9c1c46cb4ffeac18fd97695 100644 (file)
@@ -8,6 +8,7 @@ phar.readonly=0
 --FILE--
 <?php
 
+try {
 for ($i = 0; $i < 2; $i++) {
        $fname = "DataArchive.phar";
        $path = dirname(__FILE__) . DIRECTORY_SEPARATOR . $fname;
@@ -19,12 +20,13 @@ for ($i = 0; $i < 2; $i++) {
 }
 
 echo("\nWritten files: $i\n");
+} catch (Exception $e) {
+echo $e->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
index 1c2d8c3213b3e4174c1c4bf0c79f1d7883ef8e9c..d89de1b1be77a42faab9967e9bf93e1c36f1c4f9 100644 (file)
@@ -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);