---
 ext/phar/zip.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/ext/phar/zip.c b/ext/phar/zip.c
index 2a95580..2117b0e 100644
--- a/ext/phar/zip.c
+++ b/ext/phar/zip.c
@@ -1217,7 +1217,9 @@ int phar_zip_flush(phar_archive_data *phar, char 
*user_stub, zend_long len, int
        if (!phar->is_temporary_alias && phar->alias_len) {
                entry.fp = php_stream_fopen_tmpfile();
                if (entry.fp == NULL) {
-                       spprintf(error, 0, "phar error: unable to create 
temporary file");
+                       if (error) {
+                               spprintf(error, 0, "phar error: unable to 
create temporary file");
+                       }
                        return EOF;
                }
                if (phar->alias_len != (int)php_stream_write(entry.fp, 
phar->alias, phar->alias_len)) {
@@ -1309,7 +1311,9 @@ int phar_zip_flush(phar_archive_data *phar, char 
*user_stub, zend_long len, int
                len = pos - user_stub + 18;
                entry.fp = php_stream_fopen_tmpfile();
                if (entry.fp == NULL) {
-                       spprintf(error, 0, "phar error: unable to create 
temporary file");
+                       if (error) {
+                               spprintf(error, 0, "phar error: unable to 
create temporary file");
+                       }
                        return EOF;
                }
                entry.uncompressed_filesize = len + 5;
@@ -1346,7 +1350,9 @@ int phar_zip_flush(phar_archive_data *phar, char 
*user_stub, zend_long len, int
                /* Either this is a brand new phar (add the stub), or the 
default stub is required (overwrite the stub) */
                entry.fp = php_stream_fopen_tmpfile();
                if (entry.fp == NULL) {
-                       spprintf(error, 0, "phar error: unable to create 
temporary file");
+                       if (error) {
+                               spprintf(error, 0, "phar error: unable to 
create temporary file");
+                       }
                        return EOF;
                }
                if (sizeof(newstub)-1 != php_stream_write(entry.fp, newstub, 
sizeof(newstub)-1)) {
-- 
1.9.1


-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to