cvs: pecl /phar util.c /phar/tests bug13786.phpt
| From: | Greg Beaver | Date: | Wed, 30 Apr 2008 22:16:24 +0000 |
| Subject: | cvs: pecl /phar util.c /phar/tests bug13786.phpt | ||
| Groups: | php.pecl.cvs | ||
| Request: | Send a blank email to pecl-cvs+get-10665@lists.php.net to get a copy of this message | ||
cellog Wed Apr 30 22:16:24 2008 UTC
Modified files:
/pecl/phar util.c
/pecl/phar/tests bug13786.phpt
Log:
fix Bug #13786 on unix (Steph can you verify?)
http://cvs.php.net/viewvc.cgi/pecl/phar/util.c?r1=1.46&r2=1.47&diff_format=u
Index: pecl/phar/util.c
diff -u pecl/phar/util.c:1.46 pecl/phar/util.c:1.47
--- pecl/phar/util.c:1.46 Wed Apr 30 20:17:26 2008
+++ pecl/phar/util.c Wed Apr 30 22:16:23 2008
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: util.c,v 1.46 2008/04/30 20:17:26 cellog Exp $ */
+/* $Id: util.c,v 1.47 2008/04/30 22:16:23 cellog Exp $ */
#include "phar_internal.h"
#if !defined(PHP_VERSION_ID) || PHP_VERSION_ID < 50300
@@ -104,6 +104,9 @@
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);
http://cvs.php.net/viewvc.cgi/pecl/phar/tests/bug13786.phpt?r1=1.1&r2=1.2&diff_format=u
Index: pecl/phar/tests/bug13786.phpt
diff -u pecl/phar/tests/bug13786.phpt:1.1 pecl/phar/tests/bug13786.phpt:1.2
--- pecl/phar/tests/bug13786.phpt:1.1 Tue Apr 29 10:45:22 2008
+++ pecl/phar/tests/bug13786.phpt Wed Apr 30 22:16:24 2008
@@ -8,6 +8,7 @@
--FILE--
<?php
+try {
for ($i = 0; $i < 2; $i++) {
$fname = "DataArchive.phar";
$path = dirname(__FILE__) . DIRECTORY_SEPARATOR . $fname;
@@ -19,12 +20,13 @@
}
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